-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 | 21 |
5 files changed, 47 insertions, 52 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b543eca..c75d10e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -236,7 +236,6 @@ void CalendarView::init() mModified = false; mReadOnly = false; mSelectedIncidence = 0; - mSyncProfiles.setAutoDelete(true); mCalPrinter = 0; mFilters.setAutoDelete(true); @@ -690,6 +689,7 @@ void CalendarView::confSync() if ( ! sp ) { sp = new KOSyncPrefsDialog( this, "syncprefs", true ); } + sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName ); sp->usrReadConfig(); #ifndef DESKTOP_VERSION sp->showMaximized(); @@ -697,7 +697,8 @@ void CalendarView::confSync() sp->show(); #endif sp->exec(); - + KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); + KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); } @@ -1563,29 +1564,6 @@ 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 @@ -482,8 +482,6 @@ 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; QString mCurrentSyncDevice; diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp index b7e4265..7c838f5 100644 --- a/korganizer/kosyncprefsdialog.cpp +++ b/korganizer/kosyncprefsdialog.cpp @@ -29,6 +29,7 @@ #include <qfont.h> #include <qslider.h> #include <qfile.h> +#include <qdir.h> #include <qtextstream.h> #include <qcombobox.h> #include <qvbox.h> @@ -59,10 +60,10 @@ #include <libkdepim/ksyncprofile.h> -#include "koprefs.h" +//#include "koprefs.h" #include "kosyncprefsdialog.h" -#include "koglobals.h" +//#include "koglobals.h" KOSyncPrefsDialog::KOSyncPrefsDialog(QWidget *parent, char *name, bool modal) : @@ -233,7 +234,7 @@ 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 ); if ( fn == "" ) @@ -413,23 +414,37 @@ void KOSyncPrefsDialog::cloneProfile() newProfile(); } +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 ; mSyncProfiles.clear(); for ( i = 0; i < mSyncProfileNames.count();++i ) { 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 ); } @@ -438,15 +453,16 @@ void KOSyncPrefsDialog::usrWriteConfig() saveProfile(); 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 @@ -55,6 +55,10 @@ class KOSyncPrefsDialog : public KDialog KOSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); ~KOSyncPrefsDialog(); void usrReadConfig(); + void setLocalMachineName ( const QString& name ); + QString getLocalMachineName ( ); + + QStringList getSyncProfileNames(); public slots: protected slots: diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a487f14..589ab2d 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -818,27 +818,26 @@ void MainWindow::fillSyncMenu() syncMenu->insertSeparator(); 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"); prof << i18n("Local file"); prof << i18n("Last file"); 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 ) { @@ -1800,7 +1799,7 @@ void MainWindow::confSync() { mView->confSync(); fillSyncMenu(); - mView->writeSettings(); + //mView->writeSettings(); } |