author | zautrix <zautrix> | 2004-08-01 12:56:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-01 12:56:11 (UTC) |
commit | cc2643f4be54269db8c24f66fdcbbf6954d5f537 (patch) (side-by-side diff) | |
tree | 3562598dac624305dfb9fd1911a4b314ae40945d /korganizer | |
parent | c31e99f265dbe8762efca20667f8ccd973840f8f (diff) | |
download | kdepimpi-cc2643f4be54269db8c24f66fdcbbf6954d5f537.zip kdepimpi-cc2643f4be54269db8c24f66fdcbbf6954d5f537.tar.gz kdepimpi-cc2643f4be54269db8c24f66fdcbbf6954d5f537.tar.bz2 |
Made sync profile dialog korganizer independent
-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 @@ -237,5 +237,4 @@ void CalendarView::init() mReadOnly = false; mSelectedIncidence = 0; - mSyncProfiles.setAutoDelete(true); mCalPrinter = 0; mFilters.setAutoDelete(true); @@ -691,4 +690,5 @@ void CalendarView::confSync() sp = new KOSyncPrefsDialog( this, "syncprefs", true ); } + sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName ); sp->usrReadConfig(); #ifndef DESKTOP_VERSION @@ -698,5 +698,6 @@ void CalendarView::confSync() #endif sp->exec(); - + KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); + KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); } @@ -1564,27 +1565,4 @@ void CalendarView::readSettings() #endif - - // 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 @@ -483,6 +483,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser QDateTime loadedFileVersion; void checkSharpEvent( Event* lastSync, Incidence* toDelete ); - QPtrList<KSyncProfile> mSyncProfiles; - QStringList mSyncProfileNames; void checkZaurusId( int id, bool todo = false ); int mGlobalSyncMode; diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp index b7e4265..7c838f5 100644 --- a/korganizer/kosyncprefsdialog.cpp +++ b/korganizer/kosyncprefsdialog.cpp @@ -30,4 +30,5 @@ #include <qslider.h> #include <qfile.h> +#include <qdir.h> #include <qtextstream.h> #include <qcombobox.h> @@ -60,8 +61,8 @@ -#include "koprefs.h" +//#include "koprefs.h" #include "kosyncprefsdialog.h" -#include "koglobals.h" +//#include "koglobals.h" @@ -234,5 +235,5 @@ void KOSyncPrefsDialog::accept() void KOSyncPrefsDialog::chooseFile() { - QString fn =KOPrefs::instance()->mLastSyncedLocalFile; + QString fn = QDir::homeDirPath(); fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); @@ -414,10 +415,24 @@ 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; KSyncProfile* temp ; @@ -426,9 +441,9 @@ void KOSyncPrefsDialog::usrReadConfig() temp = new KSyncProfile (); temp->setName( mSyncProfileNames[i] ); - temp->readConfig( config ); + temp->readConfig( &config ); mSyncProfiles.append( temp ); } insertProfiles(); - mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); + //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); } @@ -439,14 +454,15 @@ void KOSyncPrefsDialog::usrWriteConfig() if ( currentSelection >= 0 ) 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 @@ -56,4 +56,8 @@ class KOSyncPrefsDialog : public KDialog ~KOSyncPrefsDialog(); void usrReadConfig(); + void setLocalMachineName ( const QString& name ); + QString getLocalMachineName ( ); + + QStringList getSyncProfileNames(); public slots: diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a487f14..589ab2d 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -819,9 +819,9 @@ void MainWindow::fillSyncMenu() syncMenu->insertItem( i18n("Multiple sync"), 1 ); 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(); prof << i18n("Sharp-DTM"); @@ -830,14 +830,13 @@ void MainWindow::fillSyncMenu() KSyncProfile* temp = new KSyncProfile (); 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; for ( i = 0; i < prof.count(); ++i ) { @@ -1801,5 +1800,5 @@ void MainWindow::confSync() mView->confSync(); fillSyncMenu(); - mView->writeSettings(); + //mView->writeSettings(); |