Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Remove unused variables and clarify the type of certain variables in XABPreferences
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 2 Aug 2015 19:28:27 +0000 (20:28 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 2 Aug 2015 19:28:27 +0000 (20:28 +0100)
source/common/preferences.cpp

index 218b7b0..6fae06e 100644 (file)
@@ -16,8 +16,6 @@ XABPreferences::XABPreferences(wxString PreferencesFilename){
     //fstream preffile;
     wxString fullprefpath;
     
-    int accountnum = 0;
-    
     bool accountnamevalid, accountaddressvalid, accounttypevalid, accountportvalid,
         accountsslvalid, accountusernamevalid, accountpasswordvalid,
         accountdirprefixvalid, accountdirvalid, accountrefreshvalid = FALSE;
@@ -68,10 +66,10 @@ XABPreferences::XABPreferences(wxString PreferencesFilename){
 
                if (PosXValid == TRUE && PosYValid == TRUE && PosHValid == TRUE && PosWValid == TRUE){
 
-                       WindowPosition.SetX(PosX);
-                       WindowPosition.SetY(PosY);
-                       WindowPosition.SetHeight(PosH);
-                       WindowPosition.SetWidth(PosW);
+                       WindowPosition.SetX((int)PosX);
+                       WindowPosition.SetY((int)PosY);
+                       WindowPosition.SetHeight((int)PosH);
+                       WindowPosition.SetWidth((int)PosW);
 
                } else {
 
@@ -109,100 +107,99 @@ XABPreferences::XABPreferences(wxString PreferencesFilename){
     bool AccSSL = FALSE;
     int AccRef, AccPort = 0;
     long itemindex = 0;
-    long subitemindex = 0;
     bool ContinueAcc = TRUE;
-    bool ContinueProc = TRUE;
     
     ContinueAcc = cfgfile->GetFirstGroup(accountname, itemindex);
     
     while (ContinueAcc){
 
-       cfgfile->SetPath(accountname);
-       //ContinueProc = cfgfile->GetFirstEntry(EntryName, subitemindex);
-       cfgfile->Read(wxT("type"), &EntryValue);
-     
-       if (EntryValue == wxT("Local")){
-       
-               // Get the account directory.
-               
-               cfgfile->Read(wxT("accountdir"), &AccDir);
-       
-               if (AccDir.Len() > 4){
-
-                       accountdirvalid = TRUE;
-               
-               } else {
-
-                       accountdirvalid = FALSE;
-
-               }
-               
-               if (accountdirvalid == TRUE){
-               
-                       accounts.AddAccount(accountname, wxT("Local"), wxT(""), 0,
-                          0, wxT(""), wxT(""), 
-                          wxT(""), AccDir, 0);
-               
-               }
-       
-       } else if (EntryValue == wxT("CardDAV")){
-
-               cfgfile->Read(wxT("accountdir"), &AccDir);
-               accountaddressvalid = cfgfile->Read(wxT("address"), &AccAdr);
-               accountportvalid = cfgfile->Read(wxT("port"), &AccPort);
-               accountsslvalid = cfgfile->Read(wxT("ssl"), &AccSSLInc);
-               if (AccSSLInc == wxT("true")){
-                       AccSSL = TRUE;
-               }
-               accountusernamevalid = cfgfile->Read(wxT("username"), &AccUsr);
-               accountpasswordvalid = cfgfile->Read(wxT("password"), &AccPass);
-               accountdirprefixvalid = cfgfile->Read(wxT("prefix"), &AccPrefix);
-               accountrefreshvalid = cfgfile->Read(wxT("refresh"), &AccRef);
-               
-               if (AccDir.Len() > 4){
-
-                       accountdirvalid = TRUE;
-               
-               }
-                       
-               // Make sure it is not bigger than 65535 or less than 1.
-               // If so, default to port 8008.
-                       
-               if (accountport < 1 || accountport > 65535){
-                  accountport = 8008;
-                  accountportvalid = TRUE;
-               }
-               
-               accounts.AddAccount(accountname, wxT("CardDAV"), AccAdr, AccPort,
-                                   AccSSL, AccUsr, AccPass, 
-                                   AccPrefix, AccDir, AccRef);
-               
-       }
-
-       // Clear up for the next account.
+        cfgfile->SetPath(accountname);
+        //ContinueProc = cfgfile->GetFirstEntry(EntryName, subitemindex);
+        cfgfile->Read(wxT("type"), &EntryValue);
+         
+        if (EntryValue == wxT("Local")){
+        
+            // Get the account directory.
+            
+            cfgfile->Read(wxT("accountdir"), &AccDir);
+        
+            if (AccDir.Len() > 4){
+
+                accountdirvalid = TRUE;
+            
+            } else {
+
+                accountdirvalid = FALSE;
+
+            }
+            
+            if (accountdirvalid == TRUE){
+            
+                accounts.AddAccount(accountname, wxT("Local"), wxT(""), 0,
+                   0, wxT(""), wxT(""), 
+                   wxT(""), AccDir, 0);
+            
+            }
+        
+        } else if (EntryValue == wxT("CardDAV")){
+
+            cfgfile->Read(wxT("accountdir"), &AccDir);
+            accountaddressvalid = cfgfile->Read(wxT("address"), &AccAdr);
+            accountportvalid = cfgfile->Read(wxT("port"), &AccPort);
+            accountsslvalid = cfgfile->Read(wxT("ssl"), &AccSSLInc);
+            if (AccSSLInc == wxT("true")){
+                AccSSL = TRUE;
+            }
+                accountusernamevalid = cfgfile->Read(wxT("username"), &AccUsr);
+                accountpasswordvalid = cfgfile->Read(wxT("password"), &AccPass);
+                accountdirprefixvalid = cfgfile->Read(wxT("prefix"), &AccPrefix);
+                accountrefreshvalid = cfgfile->Read(wxT("refresh"), &AccRef);
+            
+            if (AccDir.Len() > 4){
+
+                accountdirvalid = TRUE;
+            
+            }
+                
+            // Make sure it is not bigger than 65535 or less than 1.
+            // If so, default to port 8008.
+                
+            if (accountport < 1 || accountport > 65535){
+               accountport = 8008;
+               accountportvalid = TRUE;
+            }
+            
+            accounts.AddAccount(accountname, wxT("CardDAV"), AccAdr, AccPort,
+                        AccSSL, AccUsr, AccPass, 
+                        AccPrefix, AccDir, AccRef);
+            
+        }
+
+        // Clear up for the next account.
     
-       accountnamevalid, accountaddressvalid, accounttypevalid, accountportvalid,
-       accountsslvalid, accountusernamevalid, accountpasswordvalid,
-       accountdirprefixvalid, accountdirvalid, accountrefreshvalid, accountssl, 
-       isvalidaccount, isvalidsection = FALSE;
-       AccAdr.Clear();
-       //AccPort.Clear();
-       AccDir.Clear();
-       AccUsr.Clear();
-       AccPass.Clear();
-       AccPrefix.Clear();
-       accountname.Clear();
-       accountaddress.Clear();
-       accounttype.Clear();
-       accountport = 0;
-       accountrefresh = 0;
-       accountusername.Clear();
-       accountpassword.Clear();
-       accountdirprefix.Clear();    
-       preaccountstage = TRUE;
+        accountnamevalid, accountaddressvalid, accounttypevalid, accountportvalid,
+        accountsslvalid, accountusernamevalid, accountpasswordvalid,
+        accountdirprefixvalid, accountdirvalid, accountrefreshvalid, accountssl,
+        isvalidaccount, isvalidsection = FALSE;
+        
+        AccAdr.Clear();
+        AccDir.Clear();
+        AccUsr.Clear();
+        AccPass.Clear();
+        AccPrefix.Clear();
+        accountname.Clear();
+        accountaddress.Clear();
+        accounttype.Clear();
+        accountport = 0;
+        accountrefresh = 0;
+        accountusername.Clear();
+        accountpassword.Clear();
+        accountdirprefix.Clear();
+        preaccountstage = TRUE;
     
        cfgfile->SetPath(wxT("/"));
-       ContinueAcc = cfgfile->GetNextGroup(accountname, itemindex);
+        ContinueAcc = cfgfile->GetNextGroup(accountname, itemindex);
+    
     }
   
 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy