summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp28
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/kosyncprefsdialog.cpp44
-rw-r--r--korganizer/kosyncprefsdialog.h4
-rw-r--r--korganizer/mainwindow.cpp21
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
@@ -231,17 +231,16 @@ void CalendarView::init()
mCurrentSyncDevice = "";
writeLocale();
mViewManager = new KOViewManager( this );
mDialogManager = new KODialogManager( this );
mEventViewerDialog = 0;
mModified = false;
mReadOnly = false;
mSelectedIncidence = 0;
- mSyncProfiles.setAutoDelete(true);
mCalPrinter = 0;
mFilters.setAutoDelete(true);
mCalendar->registerObserver( this );
// TODO: Make sure that view is updated, when calendar is changed.
mStorage = new FileStorage( mCalendar );
mNavigator = new DateNavigator( this, "datevav", mViewManager );
@@ -685,24 +684,26 @@ void CalendarView::createPrinter()
}
void CalendarView::confSync()
{
static KOSyncPrefsDialog* sp = 0;
if ( ! sp ) {
sp = new KOSyncPrefsDialog( this, "syncprefs", true );
}
+ sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName );
sp->usrReadConfig();
#ifndef DESKTOP_VERSION
sp->showMaximized();
#else
sp->show();
#endif
sp->exec();
-
+ KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
+ KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
}
//KOPrefs::instance()->mWriteBackFile
//KOPrefs::instance()->mWriteBackExistingOnly
// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
@@ -1558,39 +1559,16 @@ void CalendarView::readSettings()
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
getEventViewerDialog()->setGeometry(x,y,w,h);
}
#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 );
}
void CalendarView::writeSettings()
{
// kdDebug() << "CalendarView::writeSettings" << endl;
KConfig *config = KOGlobals::config();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index fda02f7..8aa5e1c 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -477,18 +477,16 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
QTimer* mAlarmTimer;
QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
void setSyncEventsReadOnly();
QDateTime loadedFileVersion;
void checkSharpEvent( Event* lastSync, Incidence* toDelete );
- QPtrList<KSyncProfile> mSyncProfiles;
- QStringList mSyncProfileNames;
void checkZaurusId( int id, bool todo = false );
int mGlobalSyncMode;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
KOBeamPrefs* beamDialog;
void init();
int mDatePickerMode;
bool mFlagEditDescription;
diff --git a/korganizer/kosyncprefsdialog.cpp b/korganizer/kosyncprefsdialog.cpp
index b7e4265..7c838f5 100644
--- a/korganizer/kosyncprefsdialog.cpp
+++ b/korganizer/kosyncprefsdialog.cpp
@@ -24,16 +24,17 @@
#include <qlayout.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <qbuttongroup.h>
#include <qlineedit.h>
#include <qfont.h>
#include <qslider.h>
#include <qfile.h>
+#include <qdir.h>
#include <qtextstream.h>
#include <qcombobox.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qspinbox.h>
#include <qdatetime.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
@@ -54,20 +55,20 @@
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <kurlrequester.h>
#include <klineedit.h>
#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) :
KDialog(parent,name,true)
{
setCaption( i18n("Synchronization Preferences"));
@@ -228,17 +229,17 @@ void KOSyncPrefsDialog::slotOK()
QDialog::accept();
}
void KOSyncPrefsDialog::accept()
{
slotOK();
}
void KOSyncPrefsDialog::chooseFile()
{
- QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
+ QString fn = QDir::homeDirPath();
fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
if ( fn == "" )
return;
mRemoteFile->setText( fn );
}
void KOSyncPrefsDialog::textChanged( const QString & s )
@@ -408,45 +409,60 @@ void KOSyncPrefsDialog::newProfile()
void KOSyncPrefsDialog::cloneProfile()
{
if ( currentSelection >= 0 )
addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
else
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 );
}
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
@@ -50,16 +50,20 @@ class KSyncProfile;
class KOSyncPrefsDialog : public KDialog
{
Q_OBJECT
public:
/** Initialize dialog and pages */
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:
void accept();
void deleteProfile();
void newProfile();
void cloneProfile();
void kindChanged(bool);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index a487f14..589ab2d 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -813,37 +813,36 @@ void MainWindow::initActions()
}
void MainWindow::fillSyncMenu()
{
syncMenu->clear();
syncMenu->insertItem( i18n("Configure..."), 0 );
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 ) {
syncMenu->insertItem( prof[i], 1000+i );
if ( i == 2 )
syncMenu->insertSeparator();
}
QDir app_dir;
@@ -1795,17 +1794,17 @@ void MainWindow::quickSyncLocalFile()
}
}
void MainWindow::confSync()
{
mView->confSync();
fillSyncMenu();
- mView->writeSettings();
+ //mView->writeSettings();
}
void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
{
QString question;
if ( ask ) {
question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";