summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp136
-rw-r--r--korganizer/calendarview.h11
-rw-r--r--korganizer/koprefs.cpp3
-rw-r--r--korganizer/koprefs.h20
-rw-r--r--korganizer/mainwindow.cpp556
-rw-r--r--korganizer/mainwindow.h24
6 files changed, 83 insertions, 667 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index ea9607d..b56f1f9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -697,25 +697,13 @@ void CalendarView::createPrinter()
}
#endif
}
void CalendarView::confSync()
{
- static KSyncPrefsDialog* sp = 0;
- if ( ! sp ) {
- sp = new KSyncPrefsDialog( this, "syncprefs", true );
- }
- sp->usrReadConfig();
-#ifndef DESKTOP_VERSION
- sp->showMaximized();
-#else
- sp->show();
-#endif
- sp->exec();
- KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
- KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
+ //DELETE
}
//KOPrefs::instance()->mWriteBackFile
//KOPrefs::instance()->mWriteBackExistingOnly
@@ -874,13 +862,13 @@ Event* CalendarView::getLastSyncEvent()
//qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
if (!lse) {
lse = new Event();
lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
QString sum = "";
- if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
+ if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
sum = "E: ";
lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
lse->setDtStart( mLastCalendarSync );
lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
lse->setCategories( i18n("SyncEvent") );
lse->setReadOnly( true );
@@ -1116,13 +1104,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
} else {
- if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
+ if ( ! mSyncManager->mWriteBackExistingOnly ) {
inL->removeID(mCurrentSyncDevice );
++addedEventR;
//qDebug("remote added Incidence %s ", inL->summary().latin1());
inL->setLastModified( modifiedCalendar );
inR = inL->clone();
inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
@@ -1132,30 +1120,30 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
} else {
if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
} else {
- if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
+ if ( ! mSyncManager->mWriteBackExistingOnly ) {
++addedEventR;
inL->setLastModified( modifiedCalendar );
remote->addIncidence( inL->clone() );
}
}
}
}
}
inL = el.next();
}
int delFut = 0;
- if ( KOPrefs::instance()->mWriteBackInFuture ) {
+ if ( mSyncManager->mWriteBackInFuture ) {
er = remote->rawIncidences();
inR = er.first();
QDateTime dt;
QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
- QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 );
+ QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
while ( inR ) {
if ( inR->type() == "Todo" ) {
Todo * t = (Todo*)inR;
if ( t->hasDueDate() )
dt = t->dtDue();
else
@@ -1189,16 +1177,16 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
remote->addEvent( eventRSync );
QString mes;
mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
QString delmess;
if ( delFut ) {
- delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture );
+ delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, mSyncManager->mWriteBackInFuture );
mes += delmess;
}
- if ( KOPrefs::instance()->mShowSyncSummary ) {
+ if ( mSyncManager->mShowSyncSummary ) {
KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
}
qDebug( mes );
mCalendar->checkAlarmForIncidence( 0, true );
return syncOK;
}
@@ -1222,13 +1210,13 @@ bool CalendarView::syncCalendar(QString filename, int mode)
// qDebug("loading ... ");
if ( storage->load() ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mode );
getEventViewerDialog()->setSyncMode( false );
if ( syncOK ) {
- if ( KOPrefs::instance()->mWriteBackFile )
+ if ( mSyncManager->mWriteBackFile )
{
storage->setSaveFormat( new ICalFormat() );
storage->save();
}
}
setModified( true );
@@ -1238,20 +1226,18 @@ bool CalendarView::syncCalendar(QString filename, int mode)
if ( syncOK )
updateView();
return syncOK;
}
void CalendarView::syncPhone()
{
- syncExternal( 1 );
+ //DELETE
}
void CalendarView::syncExternal( int mode )
{
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
- //mCurrentSyncDevice = "sharp-DTM";
- if ( KOPrefs::instance()->mAskForPreferences )
- edit_sync_options();
+
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
bool loadSuccess = false;
PhoneFormat* phoneFormat = 0;
@@ -1262,26 +1248,26 @@ void CalendarView::syncExternal( int mode )
loadSuccess = sharpFormat->load( calendar, mCalendar );
} else
#endif
if ( mode == 1 ) { // phone
phoneFormat = new PhoneFormat (mCurrentSyncDevice,
- KOPrefs::instance()->mPhoneDevice,
- KOPrefs::instance()->mPhoneConnection,
- KOPrefs::instance()->mPhoneModel);
+ mSyncManager->mPhoneDevice,
+ mSyncManager->mPhoneConnection,
+ mSyncManager->mPhoneModel);
loadSuccess = phoneFormat->load( calendar,mCalendar);
} else
return;
if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
- syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
+ syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
- if ( KOPrefs::instance()->mWriteBackFile )
+ if ( mSyncManager->mWriteBackFile )
{
QPtrList<Incidence> iL = mCalendar->rawIncidences();
Incidence* inc = iL.first();
if ( phoneFormat ) {
while ( inc ) {
inc->removeID(mCurrentSyncDevice);
@@ -1326,13 +1312,13 @@ void CalendarView::syncExternal( int mode )
updateView();
return ;//syncOK;
}
void CalendarView::syncSharp()
{
- syncExternal( 0 );
+ //DELETE
}
bool CalendarView::importBday()
{
@@ -1514,13 +1500,13 @@ bool CalendarView::importQtopia( const QString &categories,
updateView();
return true;
#if 0
mGlobalSyncMode = SYNC_MODE_QTOPIA;
mCurrentSyncDevice = "qtopia-XML";
- if ( KOPrefs::instance()->mAskForPreferences )
+ if ( mSyncManager->mAskForPreferences )
edit_sync_options();
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
QtopiaFormat qtopiaFormat;
@@ -1532,17 +1518,17 @@ bool CalendarView::importQtopia( const QString &categories,
loadOk = qtopiaFormat.load( calendar, datebook );
if ( loadOk && !todolist.isEmpty() )
loadOk = qtopiaFormat.load( calendar, todolist );
if ( loadOk ) {
getEventViewerDialog()->setSyncMode( true );
- syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
+ syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
- if ( KOPrefs::instance()->mWriteBackFile )
+ if ( mSyncManager->mWriteBackFile )
{
// write back XML file
}
setModified( true );
}
@@ -1680,17 +1666,17 @@ bool CalendarView::checkFileVersion(QString fn)
if ( km == KMessageBox::Cancel )
return false;
if ( km == KMessageBox::Yes )
return true;
setSyncDevice("deleteaftersync" );
- KOPrefs::instance()->mAskForPreferences = true;
- KOPrefs::instance()->mSyncAlgoPrefs = 3;
- KOPrefs::instance()->mWriteBackFile = false;
- KOPrefs::instance()->mWriteBackExistingOnly = false;
- KOPrefs::instance()->mShowSyncSummary = false;
+ mSyncManager->mAskForPreferences = true;
+ mSyncManager->mSyncAlgoPrefs = 3;
+ mSyncManager->mWriteBackFile = false;
+ mSyncManager->mWriteBackExistingOnly = false;
+ mSyncManager->mShowSyncSummary = false;
syncCalendar( fn, 3 );
Event * e = getLastSyncEvent();
mCalendar->deleteEvent ( e );
updateView();
return true;
}
@@ -2195,59 +2181,13 @@ void CalendarView::edit_options()
{
mDialogManager->showOptionsDialog();
//writeSettings();
}
void CalendarView::edit_sync_options()
{
- //mDialogManager->showSyncOptions();
- //KOPrefs::instance()->mSyncAlgoPrefs
- QDialog dia( this, "dia", true );
- dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
- QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
- QVBoxLayout lay ( &dia );
- lay.setSpacing( 2 );
- lay.setMargin( 3 );
- lay.addWidget(&gr);
- QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
- QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
- QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
- QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
- QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
- QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
- //QRadioButton both( i18n("Take both on conflict"), &gr );
- QPushButton pb ( "OK", &dia);
- lay.addWidget( &pb );
- connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- switch ( KOPrefs::instance()->mSyncAlgoPrefs ) {
- case 0:
- loc.setChecked( true);
- break;
- case 1:
- rem.setChecked( true );
- break;
- case 2:
- newest.setChecked( true);
- break;
- case 3:
- ask.setChecked( true);
- break;
- case 4:
- f_loc.setChecked( true);
- break;
- case 5:
- f_rem.setChecked( true);
- break;
- case 6:
- // both.setChecked( true);
- break;
- default:
- break;
- }
- if ( dia.exec() ) {
- KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
- }
+ // DELETE
}
void CalendarView::slotSelectPickerDate( QDate d)
{
mDateFrame->hide();
@@ -3765,9 +3705,29 @@ NavigatorBar *CalendarView::navigatorBar()
void CalendarView::keyPressEvent ( QKeyEvent *e)
{
//qDebug(" alendarView::keyPressEvent ");
e->ignore();
}
-//#include "calendarview.moc"
-//#include "calendarviewbase.moc"
+bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
+{
+ // mSyncManager = manager;
+ mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
+ mCurrentSyncName = mSyncManager->getCurrentSyncName();
+ return syncCalendar( filename, mode );
+}
+bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
+{
+ //mSyncManager = manager;
+ mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
+ mCurrentSyncName = mSyncManager->getCurrentSyncName();
+ if ( resource == "sharp" )
+ syncExternal( 0 );
+ if ( resource == "phone" )
+ syncExternal( 1 );
+ // pending setmodified
+}
+void CalendarView::setSyncManager(KSyncManager* manager)
+{
+ mSyncManager = manager;
+}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 8d329a9..751b8d9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -39,12 +39,14 @@
#include <libkcal/scheduler.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <korganizer/calendarviewbase.h>
+#include <ksyncmanager.h>
+
class QWidgetStack;
class QSplitter;
class CalPrinter;
class KOFilterView;
class KOViewManager;
@@ -74,13 +76,13 @@ using namespace KCal;
of the different views and controls the different dialogs like preferences,
event editor, search dialog etc.
@short main calendar view widget
@author Cornelius Schumacher
*/
-class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer
+class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
{
Q_OBJECT
public:
/**
Constructs a new calendar view widget.
@@ -457,14 +459,18 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void showDates( const KCal::DateList & );
void selectWeekNum ( int );
public:
// show a standard warning
// returns KMsgBox::yesNoCancel()
- int msgCalModified();
+ int msgCalModified();
+ virtual bool sync(KSyncManager* manager, QString filename, int mode);
+
+ virtual bool syncExternal(KSyncManager* manager, QString resource);
void confSync();
+ void setSyncManager(KSyncManager* manager);
void setLoadedFileVersion(QDateTime);
bool checkFileVersion(QString fn);
bool checkFileChanged(QString fn);
Event* getLastSyncEvent();
/** Adapt navigation units correpsonding to step size of navigation of the
* current view.
@@ -481,12 +487,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void showEventEditor();
void showTodoEditor();
void writeLocale();
Todo *selectedTodo();
private:
+ KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
QTimer* mRecheckAlarmTimer;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1210094..13035e0 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -193,14 +193,12 @@ KOPrefs::KOPrefs() :
// addItemBool("AskForPreferences",&mAskForPreferences,true);
// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
addItemInt("LastSyncTime",&mLastSyncTime,0);
- addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
- addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
#ifdef _WIN32_
QString hdp= locateLocal("data","korganizer")+"\\\\";
#else
QString hdp= locateLocal("data","korganizer")+"/";
#endif
@@ -214,13 +212,12 @@ KOPrefs::KOPrefs() :
KPrefs::setCurrentGroup("LoadSaveFileNames");
addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
- addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
KPrefs::setCurrentGroup("Locale");
addItemInt("PreferredLanguage",&mPreferredLanguage,0);
addItemInt("PreferredTime",&mPreferredTime,0);
addItemInt("PreferredDate",&mPreferredDate,0);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index ff09e19..03df59b 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -191,35 +191,16 @@ class KOPrefs : public KPimPrefs
bool mToolBarHor;
bool mToolBarUp;
bool mToolBarMiniIcons;
bool mAskForQuit;
bool mUsePassWd;
- bool mWriteBackFile;
- int mWriteBackInFuture;
- bool mAskForPreferences;
- bool mShowSyncSummary;
bool mShowSyncEvents;
bool mShowTodoInAgenda;
- bool mWriteBackExistingOnly;
-
- QString mRemoteIP;
- QString mRemoteUser;
- QString mRemotePassWd;
- QString mRemoteFile;
- QString mLocalTempFile;
- QString mPhoneDevice;
- QString mPhoneConnection;
- QString mPhoneModel;
int mLastSyncTime;
- int mSyncAlgoPrefs;
- int mRingSyncAlgoPrefs;
- QStringList mSyncProfileNames;
- QStringList mExternSyncProfiles;
- QString mLocalMachineName;
void setCategoryColor(QString cat,const QColor & color);
QColor *categoryColor(QString cat);
QString mArchiveFile;
QString mHtmlExportFile;
bool mHtmlWithSave;
@@ -227,13 +208,12 @@ class KOPrefs : public KPimPrefs
QStringList mSelectedPlugins;
QString mLastImportFile;
QString mLastVcalFile;
QString mLastSaveFile;
QString mLastLoadFile;
- QString mLastSyncedLocalFile;
QString mDefaultAlarmFile;
int mIMIPScheduler;
int mIMIPSend;
QStringList mAdditionalMails;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index e3324ee..f7766f8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -123,13 +123,13 @@ public:
};
int globalFlagBlockStartup;
MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
QMainWindow( parent, name )
{
- mPassWordPiSync = "abc";
+
#ifdef DESKTOP_VERSION
setFont( QFont("Arial"), 14 );
#endif
mServerSocket = 0;
mClosed = false;
//QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
@@ -139,16 +139,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
setIcon(SmallIcon( "ko24" ) );
mBlockAtStartup = true;
mFlagKeyPressed = false;
setCaption("KOrganizer/Pi");
KOPrefs *p = KOPrefs::instance();
KPimGlobalPrefs::instance()->setGlobalConfig();
- // if ( QApplication::desktop()->height() > 480 ) {
-// if ( p->mHourSize == 4 )
-// p->mHourSize = 6;
-// }
if ( p->mHourSize > 18 )
p->mHourSize = 18;
QMainWindow::ToolBarDock tbd;
if ( p->mToolBarHor ) {
if ( p->mToolBarUp )
tbd = Bottom;
@@ -163,13 +159,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
}
if ( KOPrefs::instance()->mUseAppColors )
QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
globalFlagBlockStartup = 1;
iconToolBar = new QPEToolBar( this );
addToolBar (iconToolBar , tbd );
- mBlockSaveFlag = false;
mCalendarModifiedFlag = false;
QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
splash->setAlignment ( AlignCenter );
setCentralWidget( splash );
#ifndef DESKTOP_VERSION
@@ -178,13 +173,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
//qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
setDefaultPreferences();
mCalendar = new CalendarLocal();
mView = new CalendarView( mCalendar, this,"mCalendar " );
mView->hide();
//mView->resize(splash->size() );
- initActions();
+ initActions();
+ mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
+ mSyncManager->setBlockSave(false);
+ mView->setSyncManager(mSyncManager);
#ifndef DESKTOP_VERSION
iconToolBar->show();
qApp->processEvents();
#endif
//qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
int vh = height() ;
@@ -249,13 +247,23 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
mView->show();
delete splash;
if ( newFile )
mView->updateConfig();
// qApp->processEvents();
//qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
- fillSyncMenu();
+ //fillSyncMenu();
+
+
+ connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
+ connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
+ connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
+ mSyncManager->setDefaultFileName( defaultFileName());
+ mSyncManager->fillSyncMenu();
+
+
+
mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
if ( showWarning ) {
KMessageBox::information( this,
"You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
qApp->processEvents();
mView->dialogManager()->showSyncOptions();
@@ -392,13 +400,13 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
mView->viewManager()->showDayView();
}
else if ( msg == "-showWWeek" ) {
mView->viewManager()->showWorkWeekView();
}
else if ( msg == "-ringSync" ) {
- multiSync( false );
+ mSyncManager->multiSync( false );
}
else if ( msg == "-showWeek" ) {
mView->viewManager()->showWeekView();
}
else if ( msg == "-showTodo" ) {
mView->viewManager()->showTodoView();
@@ -937,240 +945,13 @@ void MainWindow::initActions()
if (p-> mShowIconWhatsThis)
QWhatsThis::whatsThisButton ( iconToolBar );
connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
configureAgenda( p->mHourSize );
connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
}
-void MainWindow::fillSyncMenu()
-{
- if ( syncMenu->count() )
- syncMenu->clear();
- syncMenu->insertItem( i18n("Configure..."), 0 );
- syncMenu->insertSeparator();
- if ( mServerSocket == 0 ) {
- syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
- } else {
- syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
- }
- syncMenu->insertSeparator();
- syncMenu->insertItem( i18n("Multiple sync"), 1 );
- syncMenu->insertSeparator();
- KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- config.setGroup("General");
- QStringList prof = config.readListEntry("SyncProfileNames");
- KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
- if ( prof.count() < 3 ) {
- 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->setName( prof[1] );
- temp->writeConfig(&config);
- temp->setName( prof[2] );
- temp->writeConfig(&config);
- config.setGroup("General");
- config.writeEntry("SyncProfileNames",prof);
- config.writeEntry("ExternSyncProfiles","Sharp_DTM");
- config.sync();
- delete temp;
- }
- KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
- 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;
- if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
- syncMenu->setItemEnabled( false , 1000 );
- }
-}
-
-int MainWindow::ringSync()
-{
- int syncedProfiles = 0;
- int i;
- QTime timer;
- KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
- KSyncProfile* temp = new KSyncProfile ();
- KOPrefs::instance()->mAskForPreferences = false;
- for ( i = 0; i < syncProfileNames.count(); ++i ) {
- mCurrentSyncProfile = i;
- temp->setName(syncProfileNames[mCurrentSyncProfile]);
- temp->readConfig(&config);
- if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
- setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
- ++syncedProfiles;
- // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
- KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
- KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
- KOPrefs::instance()->mWriteBackInFuture = 0;
- if ( temp->getWriteBackFuture() )
- KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- KOPrefs::instance()->mShowSyncSummary = false;
- mView->setSyncDevice(syncProfileNames[i] );
- mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
- if ( i == 0 ) {
- syncSharp();
- } else {
- if ( temp->getIsLocalFileSync() ) {
- if ( syncWithFile( temp->getRemoteFileName( ), true ) )
- KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
- } else {
- if ( temp->getIsPhoneSync() ) {
- KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
- KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
- KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
- syncPhone();
- } else if ( temp->getIsPiSync() ) {
- mPassWordPiSync = temp->getRemotePw();
- KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
- KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
- syncPi();
- } else
- syncRemote( temp, false );
-
- }
- }
- timer.start();
- setCaption(i18n("Multiple sync in progress ... please wait!") );
- while ( timer.elapsed () < 2000 ) {
- qApp->processEvents();
-#ifndef _WIN32_
- sleep (1);
-#endif
- }
-
- }
-
- }
- delete temp;
- return syncedProfiles;
-}
-
-void MainWindow::multiSync( bool askforPrefs )
-{
- if (mBlockSaveFlag)
- return;
- mBlockSaveFlag = true;
- QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
- if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
- question,
- i18n("Yes"), i18n("No"),
- 0, 0 ) != 0 ) {
- mBlockSaveFlag = false;
- setCaption(i18n("Aborted! Nothing synced!"));
- return;
- }
- mView->setSyncDevice(i18n("Multiple profiles") );
- KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
- if ( askforPrefs ) {
- mView->edit_sync_options();
- KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
- }
- setCaption(i18n("Multiple sync started.") );
- qApp->processEvents();
- int num = ringSync() ;
- if ( num > 1 )
- ringSync();
- mBlockSaveFlag = false;
- if ( num )
- save();
- if ( num )
- setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
- else
- setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
- return;
-}
-void MainWindow::slotSyncMenu( int action )
-{
- qDebug("syncaction %d ", action);
- if ( action == 0 ) {
-
- // seems to be a Qt2 event handling bug
- // syncmenu.clear causes a segfault at first time
- // when we call it after the main event loop, it is ok
- // same behaviour when calling OM/Pi via QCOP for the first time
- QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
- //confSync();
- return;
- }
- if ( action == 1 ) {
- multiSync( true );
- return;
- }
- if ( action == 2 ) {
- enableQuick();
- QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
- return;
- }
- if ( action == 3 ) {
- delete mServerSocket;
- mServerSocket = 0;
- QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
- return;
- }
-
- if (mBlockSaveFlag)
- return;
- mBlockSaveFlag = true;
- mCurrentSyncProfile = action - 1000 ;
- mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
- mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
- KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
- KSyncProfile* temp = new KSyncProfile ();
- temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
- temp->readConfig(&config);
- KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
- KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
- KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
- KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
- KOPrefs::instance()->mWriteBackInFuture = 0;
- if ( temp->getWriteBackFuture() )
- KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
- KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
- if ( action == 1000 ) {
- syncSharp();
-
- } else if ( action == 1001 ) {
- syncLocalFile();
-
- } else if ( action == 1002 ) {
- quickSyncLocalFile();
-
- } else if ( action >= 1003 ) {
- if ( temp->getIsLocalFileSync() ) {
- if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
- } else {
- if ( temp->getIsPhoneSync() ) {
- KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
- KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
- KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
- syncPhone();
- } else if ( temp->getIsPiSync() ) {
- mPassWordPiSync = temp->getRemotePw();
- KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
- KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
- syncPi();
- } else
- syncRemote( temp );
-
- }
- }
- delete temp;
- mBlockSaveFlag = false;
-}
void MainWindow::exportToPhone( int mode )
{
//ex2phone->insertItem(i18n("Complete calendar..."), 1 );
//ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
KOex2phonePrefs ex2phone;
@@ -1581,26 +1362,25 @@ void MainWindow::slotModifiedChanged( bool changed )
{
if ( mBlockAtStartup )
return;
int msec;
// we store the changes after 1 minute,
// and for safety reasons after 10 minutes again
- if ( !mBlockSaveFlag )
+ if ( !mSyncManager->blockSave() )
msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
else
msec = 1000 * 600;
mSaveTimer.start( msec, true ); // 1 minute
qDebug("KO: Saving File in %d secs!", msec/1000);
mCalendarModifiedFlag = true;
}
void MainWindow::save()
{
- if ( mBlockSaveFlag )
+ if ( mSyncManager->blockSave() )
return;
- bool store = mBlockSaveFlag;
- mBlockSaveFlag = true;
+ mSyncManager->setBlockSave(true);
if ( mView->checkFileVersion( defaultFileName()) ) {
QTime neededSaveTime = QDateTime::currentDateTime().time();
setCaption(i18n("KO/Pi:Saving Data to File ..." ));
qDebug("KO: Start saving data to file!");
mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
@@ -1612,13 +1392,13 @@ void MainWindow::save()
QString savemes;
savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
setCaption(savemes);
} else
setCaption(i18n("Saving cancelled!"));
mCalendarModifiedFlag = false;
- mBlockSaveFlag = store;
+ mSyncManager->setBlockSave( false );
}
void MainWindow::keyReleaseEvent ( QKeyEvent * e)
{
if ( !e->isAutoRepeat() ) {
mFlagKeyPressed = false;
@@ -2026,319 +1806,29 @@ void MainWindow::exportVCalendar()
mes = i18n("KO/Pi:Exported to %1").arg(fn );
setCaption(mes);
}
}
}
-QString MainWindow::getPassword( )
-{
- QString retfile = "";
- QDialog dia ( this, "input-dialog", true );
- QLineEdit lab ( &dia );
- lab.setEchoMode( QLineEdit::Password );
- QVBoxLayout lay( &dia );
- lay.setMargin(7);
- lay.setSpacing(7);
- lay.addWidget( &lab);
- dia.setFixedSize( 230,50 );
- dia.setCaption( i18n("Enter password") );
- QPushButton pb ( "OK", &dia);
- lay.addWidget( &pb );
- connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- dia.show();
- int res = dia.exec();
- if ( res )
- retfile = lab.text();
- dia.hide();
- qApp->processEvents();
- return retfile;
-
-}
-void MainWindow::enableQuick()
+void MainWindow::syncFileRequest()
{
- QDialog dia ( this, "input-dialog", true );
- QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
- lab.setText( KOPrefs::instance()->mPassiveSyncPort );
- lay.setMargin(7);
- lay.setSpacing(7);
- QLabel label ( i18n("Port number (Default: 9197)"), &dia );
- lay.addWidget( &label);
- lay.addWidget( &lab);
-
- QLineEdit lepw ( &dia );
- lepw.setText( KOPrefs::instance()->mPassiveSyncPw );
- QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
- lay.addWidget( &label2);
- lay.addWidget( &lepw);
- dia.setFixedSize( 230,80 );
- dia.setCaption( i18n("Enter port for Pi-Sync") );
- QPushButton pb ( "OK", &dia);
- lay.addWidget( &pb );
- connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
- dia.show();
- if ( ! dia.exec() )
- return;
- dia.hide();
- qApp->processEvents();
- KOPrefs::instance()->mPassiveSyncPw = lepw.text();
- KOPrefs::instance()->mPassiveSyncPort = lab.text();
- bool ok;
- Q_UINT16 port = KOPrefs::instance()->mPassiveSyncPort.toUInt(&ok);
- if ( ! ok ) {
- KMessageBox::information( this, i18n("No valid port"));
- return;
- }
- //qDebug("port %d ", port);
- mServerSocket = new KServerSocket ( KOPrefs::instance()->mPassiveSyncPw, port ,1 );
- mServerSocket->setFileName( defaultFileName() );
- //qDebug("connected ");
- if ( !mServerSocket->ok() ) {
- KMessageBox::information( this, i18n("Failed to bind or\nlisten to the port!"));
- delete mServerSocket;
- mServerSocket = 0;
- return;
- }
- connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) );
- connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) );
+ save();
}
-
void MainWindow::getFile( bool success )
{
if ( ! success ) {
setCaption( i18n("Error receiving file. Nothing changed!") );
return;
}
mView->watchSavedFile();
mView->openCalendar( defaultFileName() );
setCaption( i18n("Pi-Sync successful!") );
}
-
-void MainWindow::syncPi()
-{
- qApp->processEvents();
- bool ok;
- Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok);
- if ( ! ok ) {
- setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
- return;
- }
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this );
- connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
- setCaption( i18n("Sending request for remote file ...") );
- commandSocket->readFile( syncFileName() );
-}
-
-void MainWindow::deleteCommandSocket(KCommandSocket*s, int state)
-{
- qDebug("MainWindow::deleteCommandSocket %d", state);
-
- //enum { success, errorW, errorR, quiet };
- if ( state == KCommandSocket::errorR ) {
- setCaption( i18n("ERROR: Receiving remote file failed.") );
- delete s;
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this );
- connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
- commandSocket->sendStop();
- return;
-
- } else if ( state == KCommandSocket::errorW ) {
- setCaption( i18n("ERROR:Writing back file failed.") );
-
- } else if ( state == KCommandSocket::successR ) {
- QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
-
- } else if ( state == KCommandSocket::successW ) {
- setCaption( i18n("Pi-Sync succesful!") );
- }
-
- delete s;
-}
-
-void MainWindow::readFileFromSocket()
-{
- QString fileName = syncFileName();
- setCaption( i18n("Remote file saved to temp file.") );
- if ( ! syncWithFile( fileName , true ) ) {
- setCaption( i18n("Syncing failed.") );
- qDebug("Syncing failed ");
- return;
- }
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this );
- connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
- if ( KOPrefs::instance()->mWriteBackFile )
- commandSocket->writeFile( fileName );
- else {
- commandSocket->sendStop();
- setCaption( i18n("Pi-Sync succesful!") );
- }
-}
-
-void MainWindow::syncLocalFile()
-{
-
- QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
-
- fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
- if ( fn == "" )
- return;
- //mView->setSyncDevice("local-file" );
- if ( syncWithFile( fn, false ) ) {
- // Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
-// e->setReadOnly( true );
- }
-
-}
-
-bool MainWindow::syncWithFile( QString fn , bool quick )
-{
- bool ret = false;
- QFileInfo info;
- info.setFile( fn );
- QString mess;
- bool loadbup = true;
- if ( !info. exists() ) {
- mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
- int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
- mess );
- return ret;
- }
- int result = 0;
- if ( !quick ) {
- mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
- result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
- mess,
- i18n("Sync"), i18n("Cancel"), 0,
- 0, 1 );
- if ( result )
- return false;
- }
- if ( KOPrefs::instance()->mAskForPreferences )
- mView->edit_sync_options();
- if ( result == 0 ) {
- //qDebug("Now sycing ... ");
- if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) )
- setCaption( i18n("Synchronization successful") );
- else
- setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
- if ( ! quick )
- KOPrefs::instance()->mLastSyncedLocalFile = fn;
- slotModifiedChanged( true );
- }
- return ret;
-}
-void MainWindow::quickSyncLocalFile()
-{
- //mView->setSyncDevice("local-file" );
- //qDebug("quickSyncLocalFile() ");
- if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
- // Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
-// e->setReadOnly( true );
-
- }
-}
-
-void MainWindow::confSync()
-{
- mView->confSync();
- fillSyncMenu();
-}
-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";
- if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
- question,
- i18n("Yes"), i18n("No"),
- 0, 0 ) != 0 )
- return;
- }
- QString command = prof->getPreSyncCommand();
- int fi;
- if ( (fi = command.find("$PWD$")) > 0 ) {
- QString pwd = getPassword();
- command = command.left( fi )+ pwd + command.mid( fi+5 );
-
- }
- int maxlen = 30;
- if ( QApplication::desktop()->width() > 320 )
- maxlen += 25;
- setCaption ( i18n( "Copy remote file to local machine..." ) );
- int fileSize = 0;
- int result = system ( command );
- // 0 : okay
- // 256: no such file or dir
- //
- qDebug("KO: Remote copy result(0 = okay): %d ",result );
- if ( result != 0 ) {
- int len = maxlen;
- while ( len < command.length() ) {
- command.insert( len , "\n" );
- len += maxlen +2;
- }
- question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
- QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
- question,
- i18n("Okay!")) ;
- setCaption ("KO/Pi");
- return;
- }
- setCaption ( i18n( "Copying succeed." ) );
- //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
- if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
-// Event* e = mView->getLastSyncEvent();
-// e->setReadOnly( false );
-// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
-// e->setReadOnly( true );
- if ( KOPrefs::instance()->mWriteBackFile ) {
- command = prof->getPostSyncCommand();
- int fi;
- if ( (fi = command.find("$PWD$")) > 0 ) {
- QString pwd = getPassword();
- command = command.left( fi )+ pwd + command.mid( fi+5 );
-
- }
- setCaption ( i18n( "Writing back file ..." ) );
- result = system ( command );
- qDebug("KO: Writing back file result: %d ", result);
- if ( result != 0 ) {
- setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
- return;
- } else {
- setCaption ( i18n( "Syncronization sucessfully completed" ) );
- }
- }
- }
- return;
-}
-
-void MainWindow::syncSharp()
-{
- if ( mCalendarModifiedFlag )
- save();
- mView->syncSharp();
- slotModifiedChanged( true );
-
-}
-void MainWindow::syncPhone()
-{
- if ( mCalendarModifiedFlag )
- save();
- mView->syncPhone();
- slotModifiedChanged( true );
-
-}
-
void MainWindow::printSel( )
{
mView->viewManager()->agendaView()->agenda()->printSelection();
}
void MainWindow::printCal()
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 0da0be0..ee7bd87 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -41,14 +41,12 @@ class MainWindow : public QMainWindow
void recieve( const QCString& msg, const QByteArray& data );
static QString defaultFileName();
static QString syncFileName();
static QString resourcePath();
protected slots:
void setCaptionToDates();
- int ringSync();
- void multiSync( bool askforPrefs = false );
void about();
void licence();
void faq();
void usertrans();
void features();
void synchowto();
@@ -76,73 +74,57 @@ class MainWindow : public QMainWindow
void loadCalendar();
void exportVCalendar();
void fillFilterMenu();
void selectFilter( int );
void exportToPhone( int );
- void slotSyncMenu( int );
- void confSync();
- void syncSharp();
- void syncPhone();
- void syncPi();
- void syncLocalFile();
- bool syncWithFile( QString, bool );
- void quickSyncLocalFile();
-
protected:
void displayText( QString, QString);
void displayFile( QString, QString);
void enableIncidenceActions( bool );
private slots:
QSocket* piSocket;
QString piFileString;
QTime piTime;
- void deleteCommandSocket(KCommandSocket* s, int state );
- void fillSyncMenu();
void getFile( bool );
- void readFileFromSocket();
+ void syncFileRequest();
private:
+ KSyncManager* mSyncManager;
//QTimer* mTimerCommandSocket;
- QString mPassWordPiSync;
KServerSocket * mServerSocket;
bool mClosed;
void saveOnClose();
- int mCurrentSyncProfile;
- void enableQuick();
- void syncRemote( KSyncProfile* , bool ask = true);
bool mFlagKeyPressed;
bool mBlockAtStartup;
QPEToolBar *iconToolBar;
void initActions();
void setDefaultPreferences();
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
QPopupMenu *configureToolBarMenu;
QPopupMenu *selectFilterMenu;
QPopupMenu *configureAgendaMenu, *syncMenu;
CalendarLocal *mCalendar;
CalendarView *mView;
- QString getPassword();
QAction *mNewSubTodoAction;
QAction *mShowAction;
QAction *mEditAction;
QAction *mDeleteAction;
QAction *mCloneAction;
QAction *mMoveAction;
QAction *mBeamAction;
QAction *mCancelAction;
-
void closeEvent( QCloseEvent* ce );
SimpleAlarmClient mAlarmClient;
QTimer mSaveTimer;
- bool mBlockSaveFlag;
+ //bool mBlockSaveFlag;
bool mCalendarModifiedFlag;
QPixmap loadPixmap( QString );
};
#endif