# HG changeset patch
# User koma...@a05-0904a
# Date 1237998588 -3600
# Node ID a9060637dbe5ed1592f0407da2b2ca349aef0fb9
# Parent  baf2ec72c4cfcfa625a61739386a14381d71a002
patch adds possibility to delete profile. (I already sent that patch but I 
added one dialog window for confirming deletation). It also solves problem with 
modifying user accounts and forbids duplicate profile names. I put delete and 
modifying account together because they share a new function crucial for 
improvements.

diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/model/profile/UserProfileFileStorage.cpp
--- a/wengophone/src/model/profile/UserProfileFileStorage.cpp   Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/model/profile/UserProfileFileStorage.cpp   Wed Mar 25 
17:29:48 2009 +0100
@@ -236,3 +236,22 @@
        file.write(serializer.serialize());
        return true;
 }
+
+bool UserProfileFileStorage::deleteProfile() {
+       RecursiveMutex::ScopedLock lock(_mutex);
+       
+       //find path to profile files
+       std::string profDirPath = getProfilePath(_userProfile.getName());
+       std::string profBackupDirPath = 
getBackupProfilePath(_userProfile.getName());
+       
+       File profDir(profDirPath);
+       File profBackupDir(profBackupDirPath);
+       
+       //delete profile files (also from backups)
+       if (!profDir.remove()) 
+               return false;
+       if (!profBackupDir.remove())
+               return false;
+       
+       return true;
+}
\ No newline at end of file
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/model/profile/UserProfileFileStorage.h
--- a/wengophone/src/model/profile/UserProfileFileStorage.h     Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/model/profile/UserProfileFileStorage.h     Wed Mar 25 
17:29:48 2009 +0100
@@ -61,7 +61,11 @@
        virtual bool load(const std::string & profileName);
 
        virtual bool save(const std::string & profileName);
-
+       
+       /**
+        *deletes profile files from both "profiles" and "backups" directory
+       */
+       virtual bool deleteProfile();
        /**
         * Loads the system IMAccountParameters data, this is used internally 
and
         * when creating a new IMAccount
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/model/profile/UserProfileHandler.cpp
--- a/wengophone/src/model/profile/UserProfileHandler.cpp       Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/model/profile/UserProfileHandler.cpp       Wed Mar 25 
17:29:48 2009 +0100
@@ -373,3 +373,10 @@
 void UserProfileHandler::uninitExtLibraries() {
        IMWrapperFactory::getFactory().terminate();
 }
+
+void UserProfileHandler::deleteUserProfile(UserProfile & userProfile) {
+       if (&userProfile) {
+               UserProfileFileStorage userProfileFileStorage(userProfile);
+               userProfileFileStorage.deleteProfile();
+       }
+}
\ No newline at end of file
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/model/profile/UserProfileHandler.h
--- a/wengophone/src/model/profile/UserProfileHandler.h Sun Mar 22 18:29:22 
2009 +0100
+++ b/wengophone/src/model/profile/UserProfileHandler.h Wed Mar 25 17:29:48 
2009 +0100
@@ -179,6 +179,12 @@
         * Destroy the UserProfile and uninitialize external libraries
         */
        void uninit();
+       
+       /**
+        * Deletes UserProfile
+        *...@param userProfile the UserProfile to delete
+        */
+       void deleteUserProfile(UserProfile & userProfile);
 
 private:
 
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/presentation/qt/lang/qtwengophone_cs.ts
--- a/wengophone/src/presentation/qt/lang/qtwengophone_cs.ts    Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/presentation/qt/lang/qtwengophone_cs.ts    Wed Mar 25 
17:29:48 2009 +0100
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="1.1">
 <context>
@@ -1589,6 +1589,11 @@
         <translation>Z&amp;měnit</translation>
     </message>
     <message>
+        <location filename="../login/LogAccount.ui" line="521"/>
+        <source>Delete</source>
+        <translation>Smazat</translation>
+    </message>
+    <message>
         <location filename="../login/LogAccount.ui" line="347"/>
         <source>Configure a &amp;New Profile</source>
         <translation>Nastavit &amp;nový profil</translation>
@@ -2064,6 +2069,11 @@
         <source>Configure your SIP profile</source>
         <translation>Nastavte svůj SIP profil</translation>
     </message>
+    <message>
+        <location filename="../login/QtAddSIPAccount.cpp" line="69"/>
+        <source>Your profile name already exists!</source>
+        <translation>Profil s tímto názvem již existuje!</translation>
+    </message>
 </context>
 <context>
     <name>QtAddWengoAccount</name>
@@ -3015,6 +3025,26 @@
         <source>Please choose a previously used profile&lt;br/&gt; or fill in 
the informations to connect to a&lt;br/&gt; @company@ account</source>
         <translation>Vyberte prosím dříve použitý účet&lt;br/&gt; nebo vyplňte 
informace potřebné k připojení se k&lt;br/&gt; @company@ account</translation>
     </message>
+    <message>
+        <location filename="../login/QtLogAccount.cpp" line="235"/>
+        <source>Warning</source>
+        <translation>Pozor</translation>
+    </message>
+    <message>
+        <location filename="../login/QtLogAccount.cpp" line="236"/>
+        <source>Do you really want to delete this profile</source>
+        <translation>Opravdu chcete smazat tento profil?</translation>
+    </message>
+    <message>
+        <location filename="../login/QtLogAccount.cpp" line="237"/>
+        <source>Yes</source>
+        <translation>Ano</translation>
+    </message>
+    <message>
+        <location filename="../login/QtLogAccount.cpp" line="237"/>
+        <source>No</source>
+        <translation>Ne</translation>
+    </message>
 </context>
 <context>
     <name>QtLoginDialog</name>
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/presentation/qt/login/LogAccount.ui
--- a/wengophone/src/presentation/qt/login/LogAccount.ui        Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/presentation/qt/login/LogAccount.ui        Wed Mar 25 
17:29:48 2009 +0100
@@ -1,7 +1,4 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>LogAccount</class>
  <widget class="QWidget" name="LogAccount" >
   <property name="geometry" >
@@ -22,277 +19,481 @@
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="2" column="0" colspan="3" >
+   <item row="2" column="0" colspan="4" >
     <widget class="Line" name="line" >
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
-   <item row="0" column="0" colspan="3" >
+   <item row="0" column="0" colspan="4" >
     <widget class="QLabel" name="loginLabel" >
      <property name="palette" >
       <palette>
        <active>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>0</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>234</red>
-         <green>229</green>
-         <blue>220</blue>
-        </color>
-        <color>
-         <red>128</red>
-         <green>128</green>
-         <blue>128</blue>
-        </color>
-        <color>
-         <red>141</red>
-         <green>139</green>
-         <blue>133</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>0</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>64</red>
-         <green>64</green>
-         <blue>64</blue>
-        </color>
-        <color>
-         <red>10</red>
-         <green>36</green>
-         <blue>106</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>0</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>232</red>
-         <green>232</green>
-         <blue>232</blue>
-        </color>
+        <colorrole role="WindowText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>0</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Button" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Light" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Midlight" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>234</red>
+           <green>229</green>
+           <blue>220</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Dark" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>128</red>
+           <green>128</green>
+           <blue>128</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Mid" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>141</red>
+           <green>139</green>
+           <blue>133</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Text" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="BrightText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="ButtonText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>0</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Base" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Window" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Shadow" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>64</red>
+           <green>64</green>
+           <blue>64</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Highlight" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>10</red>
+           <green>36</green>
+           <blue>106</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="HighlightedText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Link" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="LinkVisited" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="AlternateBase" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>232</red>
+           <green>232</green>
+           <blue>232</blue>
+          </color>
+         </brush>
+        </colorrole>
        </active>
        <inactive>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>0</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>234</red>
-         <green>229</green>
-         <blue>220</blue>
-        </color>
-        <color>
-         <red>128</red>
-         <green>128</green>
-         <blue>128</blue>
-        </color>
-        <color>
-         <red>141</red>
-         <green>139</green>
-         <blue>133</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>0</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>64</red>
-         <green>64</green>
-         <blue>64</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>0</blue>
-        </color>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>0</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>232</red>
-         <green>232</green>
-         <blue>232</blue>
-        </color>
+        <colorrole role="WindowText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>0</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Button" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Light" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Midlight" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>234</red>
+           <green>229</green>
+           <blue>220</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Dark" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>128</red>
+           <green>128</green>
+           <blue>128</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Mid" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>141</red>
+           <green>139</green>
+           <blue>133</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Text" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="BrightText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="ButtonText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>0</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Base" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Window" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Shadow" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>64</red>
+           <green>64</green>
+           <blue>64</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Highlight" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="HighlightedText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>0</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Link" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="LinkVisited" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="AlternateBase" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>232</red>
+           <green>232</green>
+           <blue>232</blue>
+          </color>
+         </brush>
+        </colorrole>
        </inactive>
        <disabled>
-        <color>
-         <red>106</red>
-         <green>104</green>
-         <blue>100</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>233</red>
-         <green>231</green>
-         <blue>227</blue>
-        </color>
-        <color>
-         <red>128</red>
-         <green>128</green>
-         <blue>128</blue>
-        </color>
-        <color>
-         <red>141</red>
-         <green>139</green>
-         <blue>133</blue>
-        </color>
-        <color>
-         <red>106</red>
-         <green>104</green>
-         <blue>100</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>106</red>
-         <green>104</green>
-         <blue>100</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>212</red>
-         <green>208</green>
-         <blue>200</blue>
-        </color>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>0</blue>
-        </color>
-        <color>
-         <red>10</red>
-         <green>36</green>
-         <blue>106</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>255</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>0</red>
-         <green>0</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>255</red>
-         <green>0</green>
-         <blue>255</blue>
-        </color>
-        <color>
-         <red>232</red>
-         <green>232</green>
-         <blue>232</blue>
-        </color>
+        <colorrole role="WindowText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>106</red>
+           <green>104</green>
+           <blue>100</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Button" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Light" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Midlight" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>233</red>
+           <green>231</green>
+           <blue>227</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Dark" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>128</red>
+           <green>128</green>
+           <blue>128</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Mid" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>141</red>
+           <green>139</green>
+           <blue>133</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Text" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>106</red>
+           <green>104</green>
+           <blue>100</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="BrightText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="ButtonText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>106</red>
+           <green>104</green>
+           <blue>100</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Base" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Window" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>212</red>
+           <green>208</green>
+           <blue>200</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Shadow" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>0</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Highlight" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>10</red>
+           <green>36</green>
+           <blue>106</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="HighlightedText" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>255</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="Link" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>0</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="LinkVisited" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>255</red>
+           <green>0</green>
+           <blue>255</blue>
+          </color>
+         </brush>
+        </colorrole>
+        <colorrole role="AlternateBase" >
+         <brush brushstyle="SolidPattern" >
+          <color alpha="255" >
+           <red>232</red>
+           <green>232</green>
+           <blue>232</blue>
+          </color>
+         </brush>
+        </colorrole>
        </disabled>
       </palette>
      </property>
@@ -307,7 +508,7 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="0" colspan="3" >
+   <item row="1" column="0" colspan="4" >
     <layout class="QGridLayout" >
      <property name="margin" >
       <number>0</number>
@@ -320,7 +521,7 @@
        <property name="orientation" >
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeHint" >
+       <property name="sizeHint" stdset="0" >
         <size>
          <width>86</width>
          <height>20</height>
@@ -333,7 +534,7 @@
        <property name="orientation" >
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeHint" >
+       <property name="sizeHint" stdset="0" >
         <size>
          <width>85</width>
          <height>20</height>
@@ -350,7 +551,7 @@
      </item>
     </layout>
    </item>
-   <item row="5" column="0" colspan="3" >
+   <item row="5" column="0" colspan="4" >
     <widget class="Line" name="line_2" >
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
@@ -362,7 +563,7 @@
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeHint" >
+     <property name="sizeHint" stdset="0" >
       <size>
        <width>41</width>
        <height>23</height>
@@ -370,14 +571,14 @@
      </property>
     </spacer>
    </item>
-   <item row="6" column="0" colspan="3" >
+   <item row="6" column="0" colspan="4" >
     <layout class="QHBoxLayout" >
+     <property name="spacing" >
+      <number>6</number>
+     </property>
      <property name="margin" >
       <number>0</number>
      </property>
-     <property name="spacing" >
-      <number>6</number>
-     </property>
      <item>
       <widget class="QLabel" name="label_4" >
        <property name="text" >
@@ -403,7 +604,7 @@
        <property name="orientation" >
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeHint" >
+       <property name="sizeHint" stdset="0" >
         <size>
          <width>0</width>
          <height>20</height>
@@ -433,12 +634,12 @@
      </item>
     </layout>
    </item>
-   <item row="3" column="2" >
+   <item row="3" column="3" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
-     <property name="sizeHint" >
+     <property name="sizeHint" stdset="0" >
       <size>
        <width>20</width>
        <height>31</height>
@@ -451,7 +652,7 @@
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
-     <property name="sizeHint" >
+     <property name="sizeHint" stdset="0" >
       <size>
        <width>20</width>
        <height>31</height>
@@ -505,9 +706,7 @@
      <item row="2" column="1" >
       <widget class="LinkLabel" name="forgotPasswordLabel" >
        <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>5</hsizetype>
-         <vsizetype>0</vsizetype>
+        <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -517,18 +716,22 @@
        </property>
       </widget>
      </item>
+     <item row="0" column="3" >
+      <widget class="QPushButton" name="deleteButton" >
+       <property name="text" >
+        <string>Delete</string>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
   </layout>
  </widget>
- <pixmapfunction></pixmapfunction>
  <customwidgets>
   <customwidget>
    <class>LinkLabel</class>
    <extends>QLabel</extends>
    <header>qtutil/LinkLabel.h</header>
-   <container>0</container>
-   <pixmap></pixmap>
   </customwidget>
  </customwidgets>
  <tabstops>
@@ -540,6 +743,8 @@
  </tabstops>
  <resources>
   <include location="../../../../resources/wengophone.qrc" />
+  <include location="../../../../resources/wengophone.qrc" />
+  <include location="../../../../resources/wengophone.qrc" />
  </resources>
  <connections/>
 </ui>
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/presentation/qt/login/QtAddSIPAccount.cpp
--- a/wengophone/src/presentation/qt/login/QtAddSIPAccount.cpp  Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/presentation/qt/login/QtAddSIPAccount.cpp  Wed Mar 25 
17:29:48 2009 +0100
@@ -79,6 +79,12 @@
        Config & config = ConfigManager::getInstance().getCurrentConfig();
 
        std::string accountname = _ui->accountname->text().toStdString();
+       if (profileNameExists(accountname)) {
+       //checks if profile name exists 
+               setErrorMessage(tr("Your profile name already exists!"));
+               return;
+       }
+       
        std::string login = _ui->login->text().toStdString();
        std::string password = _ui->password->text().toStdString();
        std::string realm = _ui->realm->text().toStdString();
@@ -117,21 +123,28 @@
        sipAccount.setDisplayName(displayname);
        sipAccount.setVisibleName(accountname);
        ////
+
+       if (_modify) {
+               //if modifying old profile is deleted
+               UserProfile * userProfile = 
_cUserProfileHandler.getUserProfileHandler().getUserProfile(_accountName);
+               //removes old profile
+               UserProfileFileStorage userProfileStorage(*userProfile);
+               userProfileStorage.deleteProfile();             
+       }
        
-       // Looking for the selected profile
-       if 
(!_cUserProfileHandler.userProfileExists(sipAccount.getFullIdentity())) {
+       // Looking for the selected profile, if modifiyng profile automatically 
added
+       if 
(!_cUserProfileHandler.userProfileExists(sipAccount.getFullIdentity()) || 
_modify) {
                // The selected profile does not exist. Creating a new one.
                UserProfile userProfile;
-
                Config & config = 
ConfigManager::getInstance().getCurrentConfig();
                QtAddAccountUtils::addTestContacts(&userProfile,
                        config.getSipAudioTestCall(),
                        config.getSipVideoTestCall()
                        );
-
+               
                userProfile.setSipAccount(sipAccount, false /* 
needInitialization */);
                UserProfileFileStorage userProfileStorage(userProfile);
-               userProfileStorage.save(sipAccount.getFullIdentity());
+               userProfileStorage.save(sipAccount.getFullIdentity());          
        }
        
_cUserProfileHandler.setCurrentUserProfile(sipAccount.getFullIdentity(), 
sipAccount);
        
@@ -169,7 +182,11 @@
                
_ui->proxyPort->setText(QString::number(sipAccount.getSIPProxyServerPort()));
                
_ui->accountname->setText(QString::fromStdString(sipAccount.getVisibleName()));
                _ui->activateSIMPLE->setChecked(sipAccount.isPIMEnabled());
+               _accountName = sipAccount.getFullIdentity();
+               _visibleName = sipAccount.getVisibleName();
                setInfoMessage();
+               //sets variable _modify to true
+               setModify();
        } else {
                LOG_DEBUG("SIP getType() = SipAccount::SipAccountTypeWengo");
                //_loginDialog->changePage(QtLoginDialog::AddWengoAccount, 
sipAccount);
@@ -194,7 +211,11 @@
                        
_ui->proxyPort->setText(QString::number(sipAccount->getSIPProxyServerPort()));
                        
_ui->accountname->setText(QString::fromStdString(sipAccount->getVisibleName()));
                        
_ui->activateSIMPLE->setChecked(sipAccount->isPIMEnabled());
+                       _accountName = sipAccount->getFullIdentity();
+                       _visibleName = sipAccount->getVisibleName();
                        setInfoMessage();
+                       //sets variable _modify to true
+                       setModify();
                } else {
                        //should be loaded as a wengo account
                        
_loginDialog->changePage(QtLoginDialog::AddWengoAccount, sipAccountName);
@@ -208,7 +229,9 @@
        _ui->accountname->setFocus();
        _ui->loginButton->setDefault(true);
        setInfoMessage();
-
+       _modify = false;
+       _accountName = "";
+       _visibleName = "";
        Config & config = ConfigManager::getInstance().getCurrentConfig();
        _ui->realm->setText(QString::fromStdString(config.getSipRealm()));
        
_ui->registerServer->setText(QString::fromStdString(config.getSipRegisterServer()));
@@ -263,3 +286,39 @@
                _loginDialog->resize(_loginDialog->width(), height);
        }
 }
+
+void QtAddSIPAccount::setModify(){
+       _modify=true;
+}
+
+bool QtAddSIPAccount::profileNameExists(std::string visibleName) {
+       
+       std::vector<std::string> profileNames = 
_cUserProfileHandler.getUserProfileNames(true);
+       std::vector<std::string> visibleNames;
+       
+       for (std::vector<std::string>::const_iterator it = 
profileNames.begin();it != profileNames.end();++it) {
+               
+               UserProfile userProfile;
+               SipAccount * sipaccount = NULL;
+               
+               if 
(_cUserProfileHandler.getUserProfileHandler().LoadUserProfileFromName(&userProfile,
 *it)) {
+                       sipaccount = userProfile.getSipAccount();
+                               if (sipaccount) {
+                                       std::string temp = 
sipaccount->getVisibleName();
+                                       
+                                       //if modifying old profile name is not 
added to the _visibleName vector
+                                       //if adding profile all current profile 
names added to the _visibleName vector
+                                       if (temp.compare(_visibleName) != 0 || 
!_modify)
+                                               visibleNames.push_back(temp);
+                               }
+               }
+       }
+       //search if there is another account name as the one adding
+       for (std::vector<std::string>::const_iterator it = 
visibleNames.begin();it != visibleNames.end();++it) {
+               if (visibleName.compare(*it) == 0) {
+                       return true;
+               }
+       }       
+       
+       return false;
+}
\ No newline at end of file
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/presentation/qt/login/QtAddSIPAccount.h
--- a/wengophone/src/presentation/qt/login/QtAddSIPAccount.h    Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/presentation/qt/login/QtAddSIPAccount.h    Wed Mar 25 
17:29:48 2009 +0100
@@ -66,10 +66,20 @@
        virtual void setErrorMessage(const QString & message);
 
        virtual void setLoginLabel(const QString & message);
+       
+       virtual void setModify();
+
+       virtual bool profileNameExists(std::string profileName);
 
        Ui::AddSIPAccount * _ui;
 
        int _reducedHeight;
+       
+       bool _modify;
+       //name of account that will be modified
+       std::string _accountName;
+       //visible name of account that will be modified
+       std::string _visibleName;
 };
 
 #endif //OWQTADDSIPACCOUNT_H
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/presentation/qt/login/QtLogAccount.cpp
--- a/wengophone/src/presentation/qt/login/QtLogAccount.cpp     Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/presentation/qt/login/QtLogAccount.cpp     Wed Mar 25 
17:29:48 2009 +0100
@@ -58,6 +58,7 @@
        SAFE_CONNECT(_ui->modifyButton, SIGNAL(clicked()), 
SLOT(modifyClicked()));
        SAFE_CONNECT(_ui->helpLabel, SIGNAL(linkActivated(const QString &)), 
SLOT(helpButtonClicked()));
        SAFE_CONNECT(_ui->forgotPasswordLabel, SIGNAL(linkActivated(const 
QString &)), SLOT(forgotPasswordButtonClicked()));
+       SAFE_CONNECT(_ui->deleteButton, SIGNAL(clicked()), 
SLOT(deleteClicked()));
 
 #ifndef CUSTOM_ACCOUNT
        _ui->forgotPasswordLabel->hide();
@@ -216,6 +217,28 @@
        }
 }
 
+void QtLogAccount::deleteClicked() {
+       std::string login = profileMap[ 
_ui->accountComboBox->currentText().toStdString() ];
+       
+       if (!login.empty()){
+               if (_cUserProfileHandler.userProfileExists(login)){
+                       //profile exists
+                       int buttonClicked = QMessageBox::question(this,
+                                       tr("Warning"),
+                                       tr("Do you really want to delete this 
profile"),
+                                       tr("Yes"), tr("No"));
+                       if (buttonClicked != 0)
+                               return;
+                       
+                       UserProfile * userProfile = 
_cUserProfileHandler.getUserProfileHandler().getUserProfile(login);
+                       UserProfileHandler &userProfileHandler = 
_cUserProfileHandler.getUserProfileHandler();
+                       userProfileHandler.deleteUserProfile(*userProfile);
+                       
+                       initPage();     
+               }
+       }
+}
+
 void QtLogAccount::setInfoMessage() {
        setLoginLabel(tr("Please choose a previously used profile<br/> or fill 
in the informations to connect to a<br/> @company@ account"));
 }
diff -r baf2ec72c4cf -r a9060637dbe5 
wengophone/src/presentation/qt/login/QtLogAccount.h
--- a/wengophone/src/presentation/qt/login/QtLogAccount.h       Sun Mar 22 
18:29:22 2009 +0100
+++ b/wengophone/src/presentation/qt/login/QtLogAccount.h       Wed Mar 25 
17:29:48 2009 +0100
@@ -67,6 +67,8 @@
        void loginClicked();
        
        void modifyClicked();
+       
+       void deleteClicked();
 
        virtual void languageChanged();
 
_______________________________________________
QuteCom-dev mailing list
[email protected]
http://lists.qutecom.org/mailman/listinfo/qutecom-dev

Reply via email to