summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp2
-rw-r--r--libkdepim/kpimprefs.cpp2
-rw-r--r--libkdepim/kpimprefs.h2
-rw-r--r--libkdepim/ksyncmanager.cpp87
-rw-r--r--libkdepim/ksyncmanager.h2
5 files changed, 64 insertions, 31 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index c3e9f75..02ca523 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -244,65 +244,65 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
244 setCentralWidget( mView ); 244 setCentralWidget( mView );
245 globalFlagBlockStartup = 0; 245 globalFlagBlockStartup = 0;
246 mView->show(); 246 mView->show();
247 delete splash; 247 delete splash;
248 if ( newFile ) 248 if ( newFile )
249 mView->updateConfig(); 249 mView->updateConfig();
250 // qApp->processEvents(); 250 // qApp->processEvents();
251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
252 //fillSyncMenu(); 252 //fillSyncMenu();
253 253
254 254
255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
258 mSyncManager->setDefaultFileName( defaultFileName()); 258 mSyncManager->setDefaultFileName( defaultFileName());
259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
260 mSyncManager->fillSyncMenu(); 260 mSyncManager->fillSyncMenu();
261 261
262 262
263 263
264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
265 if ( showWarning ) { 265 if ( showWarning ) {
266 KMessageBox::information( this, 266 KMessageBox::information( this,
267 "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"); 267 "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");
268 qApp->processEvents(); 268 qApp->processEvents();
269 mView->dialogManager()->showSyncOptions(); 269 mView->dialogManager()->showSyncOptions();
270 } 270 }
271 271
272 //US listen for result adressed from Ka/Pi 272 //US listen for result adressed from Ka/Pi
273#ifndef DESKTOP_VERSION 273#ifndef DESKTOP_VERSION
274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
275#endif 275#endif
276 276
277} 277}
278MainWindow::~MainWindow() 278MainWindow::~MainWindow()
279{ 279{
280 //qDebug("MainWindow::~MainWindow() "); 280 //qDebug("MainWindow::~MainWindow() ");
281 //save toolbar location 281 //save toolbar location
282 delete mCalendar; 282 delete mCalendar;
283 delete mSyncManager; 283 delete mSyncManager;
284 284
285 285
286} 286}
287void MainWindow::showMaximized () 287void MainWindow::showMaximized ()
288{ 288{
289#ifndef DESKTOP_VERSION 289#ifndef DESKTOP_VERSION
290 if ( ! globalFlagBlockStartup ) 290 if ( ! globalFlagBlockStartup )
291 if ( mClosed ) 291 if ( mClosed )
292 mView->goToday(); 292 mView->goToday();
293#endif 293#endif
294 QWidget::showMaximized () ; 294 QWidget::showMaximized () ;
295 mClosed = false; 295 mClosed = false;
296} 296}
297void MainWindow::closeEvent( QCloseEvent* ce ) 297void MainWindow::closeEvent( QCloseEvent* ce )
298{ 298{
299 299
300 300
301 301
302 if ( ! KOPrefs::instance()->mAskForQuit ) { 302 if ( ! KOPrefs::instance()->mAskForQuit ) {
303 saveOnClose(); 303 saveOnClose();
304 mClosed = true; 304 mClosed = true;
305 ce->accept(); 305 ce->accept();
306 return; 306 return;
307 307
308 } 308 }
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index c21ebaa..a05e65f 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -18,64 +18,66 @@
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35 35
36#include "kpimprefs.h" 36#include "kpimprefs.h"
37 37
38KPimPrefs::KPimPrefs( const QString &name ) : 38KPimPrefs::KPimPrefs( const QString &name ) :
39 KPrefs( name ) 39 KPrefs( name )
40{ 40{
41#ifdef _WIN32_ 41#ifdef _WIN32_
42 QString hdp= locateLocal("data","korganizer")+"\\\\"; 42 QString hdp= locateLocal("data","korganizer")+"\\\\";
43#else 43#else
44 QString hdp= locateLocal("data","korganizer")+"/"; 44 QString hdp= locateLocal("data","korganizer")+"/";
45#endif 45#endif
46 config()->setGroup("SyncOptions"); 46 config()->setGroup("SyncOptions");
47 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); 47 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
48 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); 48 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
49 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); 49 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
50 addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false );
51 addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false );
50 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); 52 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
51} 53}
52 54
53KPimPrefs::~KPimPrefs() 55KPimPrefs::~KPimPrefs()
54{ 56{
55} 57}
56 58
57void KPimPrefs::usrSetDefaults() 59void KPimPrefs::usrSetDefaults()
58{ 60{
59 setCategoryDefaults(); 61 setCategoryDefaults();
60} 62}
61 63
62void KPimPrefs::usrReadConfig() 64void KPimPrefs::usrReadConfig()
63{ 65{
64 kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl; 66 kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl;
65 67
66 config()->setGroup("General"); 68 config()->setGroup("General");
67 mCustomCategories = config()->readListEntry("Custom Categories"); 69 mCustomCategories = config()->readListEntry("Custom Categories");
68 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 70 if (mCustomCategories.isEmpty()) setCategoryDefaults();
69} 71}
70 72
71 73
72void KPimPrefs::usrWriteConfig() 74void KPimPrefs::usrWriteConfig()
73{ 75{
74 config()->setGroup("General"); 76 config()->setGroup("General");
75 config()->writeEntry("Custom Categories",mCustomCategories); 77 config()->writeEntry("Custom Categories",mCustomCategories);
76} 78}
77 79
78void KPimPrefs::setCategoryDefaults() 80void KPimPrefs::setCategoryDefaults()
79{ 81{
80 // empty implementation 82 // empty implementation
81} 83}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 9346f7d..c177bd6 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -28,44 +28,46 @@ Copyright (c) 2004 Ulf Schenk
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KPIMPREFS_H 31#ifndef KPIMPREFS_H
32#define KPIMPREFS_H 32#define KPIMPREFS_H
33 33
34#include <qstringlist.h> 34#include <qstringlist.h>
35 35
36#include "kprefs.h" 36#include "kprefs.h"
37 37
38class KPimPrefs : public KPrefs 38class KPimPrefs : public KPrefs
39{ 39{
40 public: 40 public:
41 41
42 KPimPrefs( const QString &name = QString::null ); 42 KPimPrefs( const QString &name = QString::null );
43 43
44 virtual ~KPimPrefs(); 44 virtual ~KPimPrefs();
45 45
46 /** Set preferences to default values */ 46 /** Set preferences to default values */
47 void usrSetDefaults(); 47 void usrSetDefaults();
48 48
49 /** Read preferences from config file */ 49 /** Read preferences from config file */
50 void usrReadConfig(); 50 void usrReadConfig();
51 51
52 /** Write preferences to config file */ 52 /** Write preferences to config file */
53 void usrWriteConfig(); 53 void usrWriteConfig();
54 54
55 55
56 public: 56 public:
57 QStringList mCustomCategories; 57 QStringList mCustomCategories;
58 QString mPassiveSyncPort; 58 QString mPassiveSyncPort;
59 QString mPassiveSyncPw; 59 QString mPassiveSyncPw;
60 bool mPassiveSyncWithDesktop;
61 bool mPassiveSyncAutoStart;
60 int mRingSyncAlgoPrefs; 62 int mRingSyncAlgoPrefs;
61 QString mLastSyncedLocalFile; 63 QString mLastSyncedLocalFile;
62 64
63 65
64 protected: 66 protected:
65 virtual void setCategoryDefaults(); 67 virtual void setCategoryDefaults();
66 68
67 69
68 70
69}; 71};
70 72
71#endif 73#endif
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 40d8e47..75c0b2b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -19,84 +19,87 @@
19*/ 19*/
20 20
21// $Id$ 21// $Id$
22 22
23#include "ksyncmanager.h" 23#include "ksyncmanager.h"
24 24
25#include <stdlib.h> 25#include <stdlib.h>
26 26
27#ifndef _WIN32_ 27#ifndef _WIN32_
28#include <unistd.h> 28#include <unistd.h>
29#endif 29#endif
30 30
31 31
32#include "ksyncprofile.h" 32#include "ksyncprofile.h"
33#include "ksyncprefsdialog.h" 33#include "ksyncprefsdialog.h"
34#include "kpimprefs.h" 34#include "kpimprefs.h"
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qradiobutton.h> 41#include <qradiobutton.h>
42#include <qbuttongroup.h> 42#include <qbuttongroup.h>
43#include <qtimer.h> 43#include <qtimer.h>
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qtextcodec.h> 49#include <qtextcodec.h>
50#include <qlabel.h> 50#include <qlabel.h>
51#include <qcheckbox.h>
51 52
52#include <klocale.h> 53#include <klocale.h>
53#include <kglobal.h> 54#include <kglobal.h>
54#include <kconfig.h> 55#include <kconfig.h>
55#include <kfiledialog.h> 56#include <kfiledialog.h>
56 57
57KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 58KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
58 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) 59 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu)
59{ 60{
60 mServerSocket = 0; 61 mServerSocket = 0;
61 bar = new QProgressBar ( 1, 0 ); 62 bar = new QProgressBar ( 1, 0 );
62 bar->setCaption (""); 63 bar->setCaption ("");
63 64
64 int w = 300; 65 int w = 300;
65 if ( QApplication::desktop()->width() < 320 ) 66 if ( QApplication::desktop()->width() < 320 )
66 w = 220; 67 w = 220;
67 int h = bar->sizeHint().height() ; 68 int h = bar->sizeHint().height() ;
68 int dw = QApplication::desktop()->width(); 69 int dw = QApplication::desktop()->width();
69 int dh = QApplication::desktop()->height(); 70 int dh = QApplication::desktop()->height();
70 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 71 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
72 if ( mPrefs->mPassiveSyncAutoStart )
73 enableQuick( false );
71 74
72} 75}
73 76
74KSyncManager::~KSyncManager() 77KSyncManager::~KSyncManager()
75{ 78{
76 delete bar; 79 delete bar;
77} 80}
78 81
79 82
80void KSyncManager::fillSyncMenu() 83void KSyncManager::fillSyncMenu()
81{ 84{
82 if ( mSyncMenu->count() ) 85 if ( mSyncMenu->count() )
83 mSyncMenu->clear(); 86 mSyncMenu->clear();
84 87
85 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 88 mSyncMenu->insertItem( i18n("Configure..."), 0 );
86 mSyncMenu->insertSeparator(); 89 mSyncMenu->insertSeparator();
87 if ( mServerSocket == 0 ) { 90 if ( mServerSocket == 0 ) {
88 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 91 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
89 } else { 92 } else {
90 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 93 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
91 } 94 }
92 mSyncMenu->insertSeparator(); 95 mSyncMenu->insertSeparator();
93 mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); 96 mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
94 mSyncMenu->insertSeparator(); 97 mSyncMenu->insertSeparator();
95 98
96 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 99 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
97 config.setGroup("General"); 100 config.setGroup("General");
98 QStringList prof = config.readListEntry("SyncProfileNames"); 101 QStringList prof = config.readListEntry("SyncProfileNames");
99 mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 102 mLocalMachineName = config.readEntry("LocalMachineName","undefined");
100 if ( prof.count() < 2 ) { 103 if ( prof.count() < 2 ) {
101 prof.clear(); 104 prof.clear();
102#ifdef DESKTOP_VERSION 105#ifdef DESKTOP_VERSION
@@ -238,110 +241,136 @@ void KSyncManager::slotSyncMenu( int action )
238 mPhoneDevice = temp->getPhoneDevice( ) ; 241 mPhoneDevice = temp->getPhoneDevice( ) ;
239 mPhoneConnection = temp->getPhoneConnection( ); 242 mPhoneConnection = temp->getPhoneConnection( );
240 mPhoneModel = temp->getPhoneModel( ); 243 mPhoneModel = temp->getPhoneModel( );
241 syncPhone(); 244 syncPhone();
242 } else if ( temp->getIsPiSync() ) { 245 } else if ( temp->getIsPiSync() ) {
243 if ( mTargetApp == KAPI ) { 246 if ( mTargetApp == KAPI ) {
244 mPassWordPiSync = temp->getRemotePwAB(); 247 mPassWordPiSync = temp->getRemotePwAB();
245 mActiveSyncPort = temp->getRemotePortAB(); 248 mActiveSyncPort = temp->getRemotePortAB();
246 mActiveSyncIP = temp->getRemoteIPAB(); 249 mActiveSyncIP = temp->getRemoteIPAB();
247 } else if ( mTargetApp == KOPI ) { 250 } else if ( mTargetApp == KOPI ) {
248 mPassWordPiSync = temp->getRemotePw(); 251 mPassWordPiSync = temp->getRemotePw();
249 mActiveSyncPort = temp->getRemotePort(); 252 mActiveSyncPort = temp->getRemotePort();
250 mActiveSyncIP = temp->getRemoteIP(); 253 mActiveSyncIP = temp->getRemoteIP();
251 } else { 254 } else {
252 mPassWordPiSync = temp->getRemotePwPWM(); 255 mPassWordPiSync = temp->getRemotePwPWM();
253 mActiveSyncPort = temp->getRemotePortPWM(); 256 mActiveSyncPort = temp->getRemotePortPWM();
254 mActiveSyncIP = temp->getRemoteIPPWM(); 257 mActiveSyncIP = temp->getRemoteIPPWM();
255 } 258 }
256 syncPi(); 259 syncPi();
257 while ( !mPisyncFinished ) { 260 while ( !mPisyncFinished ) {
258 //qDebug("waiting "); 261 //qDebug("waiting ");
259 qApp->processEvents(); 262 qApp->processEvents();
260 } 263 }
261 } else 264 } else
262 syncRemote( temp ); 265 syncRemote( temp );
263 266
264 } 267 }
265 } 268 }
266 delete temp; 269 delete temp;
267 setBlockSave(false); 270 setBlockSave(false);
268} 271}
269 272
270void KSyncManager::enableQuick() 273void KSyncManager::enableQuick( bool ask )
271{ 274{
272 QDialog dia ( 0, "input-dialog", true ); 275 bool autoStart;
273 QLineEdit lab ( &dia ); 276 if ( ask ) {
274 QVBoxLayout lay( &dia ); 277 QDialog dia ( 0, "input-dialog", true );
275 lab.setText( mPrefs->mPassiveSyncPort ); 278 QLineEdit lab ( &dia );
276 lay.setMargin(7); 279 QVBoxLayout lay( &dia );
277 lay.setSpacing(7); 280 lab.setText( mPrefs->mPassiveSyncPort );
278 int po = 9197+mTargetApp; 281 lay.setMargin(7);
279 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); 282 lay.setSpacing(7);
280 lay.addWidget( &label); 283 int po = 9197+mTargetApp;
281 lay.addWidget( &lab); 284 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
282 285 lay.addWidget( &label);
283 QLineEdit lepw ( &dia ); 286 lay.addWidget( &lab);
284 lepw.setText( mPrefs->mPassiveSyncPw ); 287
285 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 288 QLineEdit lepw ( &dia );
286 lay.addWidget( &label2); 289 lepw.setText( mPrefs->mPassiveSyncPw );
287 lay.addWidget( &lepw); 290 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
288 dia.setFixedSize( 230,80 ); 291 lay.addWidget( &label2);
289 dia.setCaption( i18n("Enter port for Pi-Sync") ); 292 lay.addWidget( &lepw);
290 QPushButton pb ( "OK", &dia); 293 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
291 lay.addWidget( &pb ); 294 lay.addWidget( &autostart);
292 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 295 autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
293 dia.show(); 296#ifdef DESKTOP_VERSION
294 if ( ! dia.exec() ) 297#ifdef _WIN32_
295 return; 298 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
296 dia.hide(); 299#else
297 qApp->processEvents(); 300 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
298 mPrefs->mPassiveSyncPw = lepw.text(); 301#endif
299 mPrefs->mPassiveSyncPort = lab.text(); 302 lay.addWidget( &syncdesktop);
303#else
304 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
305 syncdesktop.hide();
306#endif
307 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
308
309 dia.setFixedSize( 230,120 );
310 dia.setCaption( i18n("Enter port for Pi-Sync") );
311 QPushButton pb ( "OK", &dia);
312 lay.addWidget( &pb );
313 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
314 dia.show();
315 if ( ! dia.exec() )
316 return;
317 dia.hide();
318 qApp->processEvents();
319 mPrefs->mPassiveSyncPw = lepw.text();
320 mPrefs->mPassiveSyncPort = lab.text();
321 autoStart = autostart.isChecked();
322 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
323 }
324 else
325 autoStart = mPrefs->mPassiveSyncAutoStart;
300 bool ok; 326 bool ok;
327 mPrefs->mPassiveSyncAutoStart = false;
301 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); 328 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok);
302 if ( ! ok ) { 329 if ( ! ok ) {
303 KMessageBox::information( 0, i18n("No valid port")); 330 KMessageBox::information( 0, i18n("No valid port"));
304 return; 331 return;
305 } 332 }
306 //qDebug("port %d ", port); 333 //qDebug("port %d ", port);
307 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 334 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
308 mServerSocket->setFileName( defaultFileName() ); 335 mServerSocket->setFileName( defaultFileName() );
309 //qDebug("connected "); 336 //qDebug("connected ");
310 if ( !mServerSocket->ok() ) { 337 if ( !mServerSocket->ok() ) {
311 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); 338 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!"));
312 delete mServerSocket; 339 delete mServerSocket;
313 mServerSocket = 0; 340 mServerSocket = 0;
314 return; 341 return;
315 } 342 }
343
344 mPrefs->mPassiveSyncAutoStart = autoStart;
316 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 345 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
317 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 346 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
318} 347}
319 348
320void KSyncManager::syncLocalFile() 349void KSyncManager::syncLocalFile()
321{ 350{
322 351
323 QString fn =mPrefs->mLastSyncedLocalFile; 352 QString fn =mPrefs->mLastSyncedLocalFile;
324 QString ext; 353 QString ext;
325 354
326 switch(mTargetApp) 355 switch(mTargetApp)
327 { 356 {
328 case (KAPI): 357 case (KAPI):
329 ext = "(*.vcf)"; 358 ext = "(*.vcf)";
330 break; 359 break;
331 case (KOPI): 360 case (KOPI):
332 ext = "(*.ics/*.vcs)"; 361 ext = "(*.ics/*.vcs)";
333 break; 362 break;
334 case (PWMPI): 363 case (PWMPI):
335 ext = "(*.pwm)"; 364 ext = "(*.pwm)";
336 break; 365 break;
337 default: 366 default:
338 qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); 367 qDebug("KSyncManager::syncLocalFile: invalid apptype selected");
339 break; 368 break;
340 369
341 } 370 }
342 371
343 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); 372 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
344 if ( fn == "" ) 373 if ( fn == "" )
345 return; 374 return;
346 if ( syncWithFile( fn, false ) ) { 375 if ( syncWithFile( fn, false ) ) {
347 qDebug("syncLocalFile() successful "); 376 qDebug("syncLocalFile() successful ");
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index ffb1ea4..7b9c499 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -91,105 +91,105 @@ class KCommandSocket : public QObject
91 QSocket* mSocket; 91 QSocket* mSocket;
92 QString mPassWord; 92 QString mPassWord;
93 Q_UINT16 mPort; 93 Q_UINT16 mPort;
94 QString mHost; 94 QString mHost;
95 QString mFileName; 95 QString mFileName;
96 QTimer* mTimerSocket; 96 QTimer* mTimerSocket;
97 int mRetVal; 97 int mRetVal;
98 QTime mTime; 98 QTime mTime;
99 QString mFileString; 99 QString mFileString;
100 bool mFirst; 100 bool mFirst;
101}; 101};
102 102
103 103
104class KSyncManager : public QObject 104class KSyncManager : public QObject
105{ 105{
106 Q_OBJECT 106 Q_OBJECT
107 107
108 public: 108 public:
109 enum TargetApp { 109 enum TargetApp {
110 KOPI = 0, 110 KOPI = 0,
111 KAPI = 1, 111 KAPI = 1,
112 PWMPI = 2 }; 112 PWMPI = 2 };
113 113
114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
115 ~KSyncManager() ; 115 ~KSyncManager() ;
116 116
117 void multiSync( bool askforPrefs ); 117 void multiSync( bool askforPrefs );
118 bool blockSave() { return mBlockSaveFlag; } 118 bool blockSave() { return mBlockSaveFlag; }
119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
120 void setDefaultFileName( QString s) { mDefFileName = s ;} 120 void setDefaultFileName( QString s) { mDefFileName = s ;}
121 QString defaultFileName() { return mDefFileName ;} 121 QString defaultFileName() { return mDefFileName ;}
122 QString syncFileName(); 122 QString syncFileName();
123 void enableQuick( bool ask = true);
123 124
124 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 125 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
125 QString getCurrentSyncName() { return mCurrentSyncName; } 126 QString getCurrentSyncName() { return mCurrentSyncName; }
126 127
127 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 128 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
128 void hideProgressBar(); 129 void hideProgressBar();
129 bool isProgressBarCanceled(); 130 bool isProgressBarCanceled();
130 131
131 // sync stuff 132 // sync stuff
132 QString mLocalMachineName; 133 QString mLocalMachineName;
133 QStringList mExternSyncProfiles; 134 QStringList mExternSyncProfiles;
134 QStringList mSyncProfileNames; 135 QStringList mSyncProfileNames;
135 bool mAskForPreferences; 136 bool mAskForPreferences;
136 bool mShowSyncSummary; 137 bool mShowSyncSummary;
137 bool mIsKapiFile; 138 bool mIsKapiFile;
138 bool mWriteBackExistingOnly; 139 bool mWriteBackExistingOnly;
139 int mSyncAlgoPrefs; 140 int mSyncAlgoPrefs;
140 bool mWriteBackFile; 141 bool mWriteBackFile;
141 int mWriteBackInFuture; 142 int mWriteBackInFuture;
142 QString mPhoneDevice; 143 QString mPhoneDevice;
143 QString mPhoneConnection; 144 QString mPhoneConnection;
144 QString mPhoneModel; 145 QString mPhoneModel;
145 QString mPassWordPiSync; 146 QString mPassWordPiSync;
146 QString mActiveSyncPort; 147 QString mActiveSyncPort;
147 QString mActiveSyncIP ; 148 QString mActiveSyncIP ;
148 149
149 signals: 150 signals:
150 void save(); 151 void save();
151 void request_file(); 152 void request_file();
152 void getFile( bool ); 153 void getFile( bool );
153 154
154 public slots: 155 public slots:
155 void slotSyncMenu( int ); 156 void slotSyncMenu( int );
156 void deleteCommandSocket(KCommandSocket*s, int state); 157 void deleteCommandSocket(KCommandSocket*s, int state);
157 void readFileFromSocket(); 158 void readFileFromSocket();
158 void fillSyncMenu(); 159 void fillSyncMenu();
159 160
160 private: 161 private:
161 void syncPi(); 162 void syncPi();
162 KServerSocket * mServerSocket; 163 KServerSocket * mServerSocket;
163 void enableQuick();
164 KPimPrefs* mPrefs; 164 KPimPrefs* mPrefs;
165 QString mDefFileName; 165 QString mDefFileName;
166 QString mCurrentSyncDevice; 166 QString mCurrentSyncDevice;
167 QString mCurrentSyncName; 167 QString mCurrentSyncName;
168 void quickSyncLocalFile(); 168 void quickSyncLocalFile();
169 bool syncWithFile( QString fn , bool quick ); 169 bool syncWithFile( QString fn , bool quick );
170 void syncLocalFile(); 170 void syncLocalFile();
171 void syncPhone(); 171 void syncPhone();
172 void syncSharp(); 172 void syncSharp();
173 void syncKDE(); 173 void syncKDE();
174 bool syncExternalApplication(QString); 174 bool syncExternalApplication(QString);
175 int mCurrentSyncProfile ; 175 int mCurrentSyncProfile ;
176 void syncRemote( KSyncProfile* prof, bool ask = true); 176 void syncRemote( KSyncProfile* prof, bool ask = true);
177 void edit_sync_options(); 177 void edit_sync_options();
178 void edit_pisync_options(); 178 void edit_pisync_options();
179 int ringSync(); 179 int ringSync();
180 QString getPassword( ); 180 QString getPassword( );
181 bool mPisyncFinished; 181 bool mPisyncFinished;
182 bool mBlockSaveFlag; 182 bool mBlockSaveFlag;
183 QWidget* mParent; 183 QWidget* mParent;
184 KSyncInterface* mImplementation; 184 KSyncInterface* mImplementation;
185 TargetApp mTargetApp; 185 TargetApp mTargetApp;
186 QPopupMenu* mSyncMenu; 186 QPopupMenu* mSyncMenu;
187 QProgressBar* bar; 187 QProgressBar* bar;
188 188
189private slots: 189private slots:
190 void confSync(); 190 void confSync();
191 191
192 192
193}; 193};
194 194
195 195