-rw-r--r-- | korganizer/calendarview.cpp | 28 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/kosyncprefsdialog.cpp | 44 | ||||
-rw-r--r-- | korganizer/kosyncprefsdialog.h | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 19 |
5 files changed, 46 insertions, 51 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b543eca..c75d10e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -238,3 +238,2 @@ void CalendarView::init() mSelectedIncidence = 0; - mSyncProfiles.setAutoDelete(true); mCalPrinter = 0; @@ -692,2 +691,3 @@ void CalendarView::confSync() } + sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName ); sp->usrReadConfig(); @@ -699,3 +699,4 @@ void CalendarView::confSync() sp->exec(); - + KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); + KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); } @@ -1565,25 +1566,2 @@ void CalendarView::readSettings() - - // pending read sync settings; - mSyncProfileNames.clear(); - mSyncProfileNames << "Profile_1"; - mSyncProfileNames << "Profile_2"; - mSyncProfileNames << "Profile_3"; - mSyncProfileNames << "Profile_4"; - mSyncProfileNames << "Profile_5"; - KSyncProfile* temp = new KSyncProfile (); - temp->setName("Profile_1" ); - mSyncProfiles.append( temp ); - temp = new KSyncProfile (); - temp->setName("Profile_2" ); - mSyncProfiles.append( temp ); - temp = new KSyncProfile (); - temp->setName("Profile_3" ); - mSyncProfiles.append( temp ); - temp = new KSyncProfile (); - temp->setName("Profile_4" ); - mSyncProfiles.append( temp ); - temp = new KSyncProfile (); - temp->setName("Profile_5" ); - mSyncProfiles.append( temp ); } diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index fda02f7..8aa5e1c 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -484,4 +484,2 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void checkSharpEvent( Event* lastSync, Incidence* toDelete ); - QPtrList<KSyncProfile> mSyncProfiles; - QStringList mSyncProfileNames; void checkZaurusId( int id, bool todo = false ); diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp index b7e4265..7c838f5 100644 --- a/korganizer/kosyncprefsdialog.cpp +++ b/korganizer/kosyncprefsdialog.cpp @@ -31,2 +31,3 @@ #include <qfile.h> +#include <qdir.h> #include <qtextstream.h> @@ -61,6 +62,6 @@ -#include "koprefs.h" +//#include "koprefs.h" #include "kosyncprefsdialog.h" -#include "koglobals.h" +//#include "koglobals.h" @@ -235,3 +236,3 @@ void KOSyncPrefsDialog::chooseFile() { - QString fn =KOPrefs::instance()->mLastSyncedLocalFile; + QString fn = QDir::homeDirPath(); @@ -415,8 +416,22 @@ void KOSyncPrefsDialog::cloneProfile() +void KOSyncPrefsDialog::setLocalMachineName ( const QString& name ) +{ + mMyMachineName->setText( name ); +} +QString KOSyncPrefsDialog::getLocalMachineName ( ) +{ + return mMyMachineName->text(); +} + +QStringList KOSyncPrefsDialog::getSyncProfileNames() +{ + return mSyncProfileNames; +} void KOSyncPrefsDialog::usrReadConfig() { - KConfig *config = KOGlobals::config(); - config->setGroup("SyncProfiles"); - mSyncProfileNames = KOPrefs::instance()->mSyncProfileNames; + //KConfig *config = KOGlobals::config(); + KConfig config ( locateLocal( "config","syncprofilesrc" ) ); + config.setGroup("SyncProfiles"); + mSyncProfileNames =config.readListEntry("SyncProfileNames"); int i; @@ -427,3 +442,3 @@ void KOSyncPrefsDialog::usrReadConfig() temp->setName( mSyncProfileNames[i] ); - temp->readConfig( config ); + temp->readConfig( &config ); mSyncProfiles.append( temp ); @@ -431,3 +446,3 @@ void KOSyncPrefsDialog::usrReadConfig() insertProfiles(); - mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); + //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); } @@ -440,12 +455,13 @@ void KOSyncPrefsDialog::usrWriteConfig() profileChanged(currentSelection); - KConfig *config = KOGlobals::config(); - config->setGroup("SyncProfiles"); + //KConfig *config = KOGlobals::config(); + KConfig config ( locateLocal( "config","syncprofilesrc" ) ); + config.setGroup("SyncProfiles"); KSyncProfile* prof = mSyncProfiles.first(); while ( prof ) { - prof->writeConfig(config); + prof->writeConfig(&config); prof = mSyncProfiles.next(); } - KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; - KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); - config->writeEntry("SyncProfileNames",&mSyncProfileNames); + //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; + //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); + config.writeEntry("SyncProfileNames",&mSyncProfileNames); } diff --git a/korganizer/kosyncprefsdialog.h b/korganizer/kosyncprefsdialog.h index d2d8c6f..541d18b 100644 --- a/korganizer/kosyncprefsdialog.h +++ b/korganizer/kosyncprefsdialog.h @@ -57,2 +57,6 @@ class KOSyncPrefsDialog : public KDialog void usrReadConfig(); + void setLocalMachineName ( const QString& name ); + QString getLocalMachineName ( ); + + QStringList getSyncProfileNames(); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a487f14..589ab2d 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -820,7 +820,7 @@ void MainWindow::fillSyncMenu() syncMenu->insertSeparator(); - - QStringList prof = KOPrefs::instance()->mSyncProfileNames; + KConfig config ( locateLocal( "config","syncprofilesrc" ) ); + config.setGroup("SyncProfiles"); + QStringList prof = config.readListEntry("SyncProfileNames"); if ( prof.count() < 3 ) { - KConfig *config = KOGlobals::config(); prof.clear(); @@ -831,12 +831,11 @@ void MainWindow::fillSyncMenu() temp->setName( prof[0] ); - temp->writeConfig(config); + temp->writeConfig(&config); temp->setName( prof[1] ); - temp->writeConfig(config); + temp->writeConfig(&config); temp->setName( prof[2] ); - temp->writeConfig(config); - config->sync(); + temp->writeConfig(&config); + config.sync(); delete temp; - KOPrefs::instance()->mSyncProfileNames = prof; } - + KOPrefs::instance()->mSyncProfileNames = prof; int i; @@ -1802,3 +1801,3 @@ void MainWindow::confSync() fillSyncMenu(); - mView->writeSettings(); + //mView->writeSettings(); |