summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -252,49 +252,49 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
//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());
connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
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();
}
//US listen for result adressed from Ka/Pi
#ifndef DESKTOP_VERSION
connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
#endif
-
+
}
MainWindow::~MainWindow()
{
//qDebug("MainWindow::~MainWindow() ");
//save toolbar location
delete mCalendar;
delete mSyncManager;
}
void MainWindow::showMaximized ()
{
#ifndef DESKTOP_VERSION
if ( ! globalFlagBlockStartup )
if ( mClosed )
mView->goToday();
#endif
QWidget::showMaximized () ;
mClosed = false;
}
void MainWindow::closeEvent( QCloseEvent* ce )
{
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index c21ebaa..a05e65f 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -26,48 +26,50 @@ Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include "kpimprefs.h"
KPimPrefs::KPimPrefs( const QString &name ) :
KPrefs( name )
{
#ifdef _WIN32_
QString hdp= locateLocal("data","korganizer")+"\\\\";
#else
QString hdp= locateLocal("data","korganizer")+"/";
#endif
config()->setGroup("SyncOptions");
addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
+ addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false );
+ addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false );
addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
}
KPimPrefs::~KPimPrefs()
{
}
void KPimPrefs::usrSetDefaults()
{
setCategoryDefaults();
}
void KPimPrefs::usrReadConfig()
{
kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl;
config()->setGroup("General");
mCustomCategories = config()->readListEntry("Custom Categories");
if (mCustomCategories.isEmpty()) setCategoryDefaults();
}
void KPimPrefs::usrWriteConfig()
{
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 9346f7d..c177bd6 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -36,36 +36,38 @@ $Id$
#include "kprefs.h"
class KPimPrefs : public KPrefs
{
public:
KPimPrefs( const QString &name = QString::null );
virtual ~KPimPrefs();
/** Set preferences to default values */
void usrSetDefaults();
/** Read preferences from config file */
void usrReadConfig();
/** Write preferences to config file */
void usrWriteConfig();
public:
QStringList mCustomCategories;
QString mPassiveSyncPort;
QString mPassiveSyncPw;
+ bool mPassiveSyncWithDesktop;
+ bool mPassiveSyncAutoStart;
int mRingSyncAlgoPrefs;
QString mLastSyncedLocalFile;
protected:
virtual void setCategoryDefaults();
};
#endif
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 40d8e47..75c0b2b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -27,68 +27,71 @@
#ifndef _WIN32_
#include <unistd.h>
#endif
#include "ksyncprofile.h"
#include "ksyncprefsdialog.h"
#include "kpimprefs.h"
#include <kmessagebox.h>
#include <qdir.h>
#include <qprogressbar.h>
#include <qpopupmenu.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qtextcodec.h>
#include <qlabel.h>
+#include <qcheckbox.h>
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kfiledialog.h>
KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
: QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu)
{
mServerSocket = 0;
bar = new QProgressBar ( 1, 0 );
bar->setCaption ("");
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
+ if ( mPrefs->mPassiveSyncAutoStart )
+ enableQuick( false );
}
KSyncManager::~KSyncManager()
{
delete bar;
}
void KSyncManager::fillSyncMenu()
{
if ( mSyncMenu->count() )
mSyncMenu->clear();
mSyncMenu->insertItem( i18n("Configure..."), 0 );
mSyncMenu->insertSeparator();
if ( mServerSocket == 0 ) {
mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
} else {
mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
}
mSyncMenu->insertSeparator();
mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
mSyncMenu->insertSeparator();
@@ -246,94 +249,120 @@ void KSyncManager::slotSyncMenu( int action )
mActiveSyncIP = temp->getRemoteIPAB();
} else if ( mTargetApp == KOPI ) {
mPassWordPiSync = temp->getRemotePw();
mActiveSyncPort = temp->getRemotePort();
mActiveSyncIP = temp->getRemoteIP();
} else {
mPassWordPiSync = temp->getRemotePwPWM();
mActiveSyncPort = temp->getRemotePortPWM();
mActiveSyncIP = temp->getRemoteIPPWM();
}
syncPi();
while ( !mPisyncFinished ) {
//qDebug("waiting ");
qApp->processEvents();
}
} else
syncRemote( temp );
}
}
delete temp;
setBlockSave(false);
}
-void KSyncManager::enableQuick()
+void KSyncManager::enableQuick( bool ask )
{
- QDialog dia ( 0, "input-dialog", true );
- QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
- lab.setText( mPrefs->mPassiveSyncPort );
- lay.setMargin(7);
- lay.setSpacing(7);
- int po = 9197+mTargetApp;
- QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
- lay.addWidget( &label);
- lay.addWidget( &lab);
-
- QLineEdit lepw ( &dia );
- lepw.setText( mPrefs->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();
- mPrefs->mPassiveSyncPw = lepw.text();
- mPrefs->mPassiveSyncPort = lab.text();
+ bool autoStart;
+ if ( ask ) {
+ QDialog dia ( 0, "input-dialog", true );
+ QLineEdit lab ( &dia );
+ QVBoxLayout lay( &dia );
+ lab.setText( mPrefs->mPassiveSyncPort );
+ lay.setMargin(7);
+ lay.setSpacing(7);
+ int po = 9197+mTargetApp;
+ QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
+ lay.addWidget( &label);
+ lay.addWidget( &lab);
+
+ QLineEdit lepw ( &dia );
+ lepw.setText( mPrefs->mPassiveSyncPw );
+ QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
+ lay.addWidget( &label2);
+ lay.addWidget( &lepw);
+ QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
+ lay.addWidget( &autostart);
+ autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
+#ifdef DESKTOP_VERSION
+#ifdef _WIN32_
+ QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
+#else
+ QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
+#endif
+ lay.addWidget( &syncdesktop);
+#else
+ QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
+ syncdesktop.hide();
+#endif
+ syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
+
+ dia.setFixedSize( 230,120 );
+ 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();
+ mPrefs->mPassiveSyncPw = lepw.text();
+ mPrefs->mPassiveSyncPort = lab.text();
+ autoStart = autostart.isChecked();
+ mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
+ }
+ else
+ autoStart = mPrefs->mPassiveSyncAutoStart;
bool ok;
+ mPrefs->mPassiveSyncAutoStart = false;
Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok);
if ( ! ok ) {
KMessageBox::information( 0, i18n("No valid port"));
return;
}
//qDebug("port %d ", port);
mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
mServerSocket->setFileName( defaultFileName() );
//qDebug("connected ");
if ( !mServerSocket->ok() ) {
KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!"));
delete mServerSocket;
mServerSocket = 0;
return;
}
+
+ mPrefs->mPassiveSyncAutoStart = autoStart;
connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
}
void KSyncManager::syncLocalFile()
{
QString fn =mPrefs->mLastSyncedLocalFile;
QString ext;
switch(mTargetApp)
{
case (KAPI):
ext = "(*.vcf)";
break;
case (KOPI):
ext = "(*.ics/*.vcs)";
break;
case (PWMPI):
ext = "(*.pwm)";
break;
default:
qDebug("KSyncManager::syncLocalFile: invalid apptype selected");
break;
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index ffb1ea4..7b9c499 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -99,89 +99,89 @@ class KCommandSocket : public QObject
QString mFileString;
bool mFirst;
};
class KSyncManager : public QObject
{
Q_OBJECT
public:
enum TargetApp {
KOPI = 0,
KAPI = 1,
PWMPI = 2 };
KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
~KSyncManager() ;
void multiSync( bool askforPrefs );
bool blockSave() { return mBlockSaveFlag; }
void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
void setDefaultFileName( QString s) { mDefFileName = s ;}
QString defaultFileName() { return mDefFileName ;}
QString syncFileName();
+ void enableQuick( bool ask = true);
QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
QString getCurrentSyncName() { return mCurrentSyncName; }
void showProgressBar(int percentage, QString caption = QString::null, int total=100);
void hideProgressBar();
bool isProgressBarCanceled();
// sync stuff
QString mLocalMachineName;
QStringList mExternSyncProfiles;
QStringList mSyncProfileNames;
bool mAskForPreferences;
bool mShowSyncSummary;
bool mIsKapiFile;
bool mWriteBackExistingOnly;
int mSyncAlgoPrefs;
bool mWriteBackFile;
int mWriteBackInFuture;
QString mPhoneDevice;
QString mPhoneConnection;
QString mPhoneModel;
QString mPassWordPiSync;
QString mActiveSyncPort;
QString mActiveSyncIP ;
signals:
void save();
void request_file();
void getFile( bool );
public slots:
void slotSyncMenu( int );
void deleteCommandSocket(KCommandSocket*s, int state);
void readFileFromSocket();
void fillSyncMenu();
private:
void syncPi();
KServerSocket * mServerSocket;
- void enableQuick();
KPimPrefs* mPrefs;
QString mDefFileName;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
void quickSyncLocalFile();
bool syncWithFile( QString fn , bool quick );
void syncLocalFile();
void syncPhone();
void syncSharp();
void syncKDE();
bool syncExternalApplication(QString);
int mCurrentSyncProfile ;
void syncRemote( KSyncProfile* prof, bool ask = true);
void edit_sync_options();
void edit_pisync_options();
int ringSync();
QString getPassword( );
bool mPisyncFinished;
bool mBlockSaveFlag;
QWidget* mParent;
KSyncInterface* mImplementation;
TargetApp mTargetApp;
QPopupMenu* mSyncMenu;
QProgressBar* bar;