summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 7319285..184cb39 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -44,55 +44,49 @@
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#include <qcheckbox.h>
52 52
53#include <klocale.h> 53#include <klocale.h>
54#include <kglobal.h> 54#include <kglobal.h>
55#include <kconfig.h> 55#include <kconfig.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57 57
58QDateTime KSyncManager::mRequestedSyncEvent; 58QDateTime KSyncManager::mRequestedSyncEvent;
59 59
60 60
61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
62 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) 62 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
63{ 63{
64 mServerSocket = 0; 64 mServerSocket = 0;
65 bar = new QProgressBar ( 1, 0 ); 65 bar = new QProgressBar ( 1, 0 );
66 bar->setCaption (""); 66 bar->setCaption ("");
67 mWriteBackInPast = 2; 67 mWriteBackInPast = 2;
68 int w = 300; 68
69 if ( QApplication::desktop()->width() < 320 )
70 w = 220;
71 int h = bar->sizeHint().height() ;
72 int dw = QApplication::desktop()->width();
73 int dh = QApplication::desktop()->height();
74 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
75 69
76} 70}
77 71
78KSyncManager::~KSyncManager() 72KSyncManager::~KSyncManager()
79{ 73{
80 delete bar; 74 delete bar;
81} 75}
82 76
83void KSyncManager::setDefaultFileName( QString s) 77void KSyncManager::setDefaultFileName( QString s)
84{ 78{
85 mDefFileName = s ; 79 mDefFileName = s ;
86 if ( mPrefs->mPassiveSyncAutoStart ) 80 if ( mPrefs->mPassiveSyncAutoStart )
87 enableQuick( false ); 81 enableQuick( false );
88} 82}
89 83
90void KSyncManager::fillSyncMenu() 84void KSyncManager::fillSyncMenu()
91{ 85{
92 if ( mSyncMenu->count() ) 86 if ( mSyncMenu->count() )
93 mSyncMenu->clear(); 87 mSyncMenu->clear();
94 88
95 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 89 mSyncMenu->insertItem( i18n("Configure..."), 0 );
96 mSyncMenu->insertSeparator(); 90 mSyncMenu->insertSeparator();
97 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); 91 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
98 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); 92 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
@@ -988,48 +982,55 @@ bool KSyncManager::syncExternalApplication(QString resource)
988 if ( !edit_sync_options()) { 982 if ( !edit_sync_options()) {
989 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 983 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
990 return false; 984 return false;
991 } 985 }
992 986
993 qDebug("KSM::Sync extern %s", resource.latin1()); 987 qDebug("KSM::Sync extern %s", resource.latin1());
994 988
995 bool syncOK = mImplementation->syncExternal(this, resource); 989 bool syncOK = mImplementation->syncExternal(this, resource);
996 990
997 return syncOK; 991 return syncOK;
998 992
999} 993}
1000 994
1001void KSyncManager::syncPhone() 995void KSyncManager::syncPhone()
1002{ 996{
1003 997
1004 syncExternalApplication("phone"); 998 syncExternalApplication("phone");
1005 999
1006} 1000}
1007 1001
1008void KSyncManager::showProgressBar(int percentage, QString caption, int total) 1002void KSyncManager::showProgressBar(int percentage, QString caption, int total)
1009{ 1003{
1010 if (!bar->isVisible()) 1004 if (!bar->isVisible())
1011 { 1005 {
1006 int w = 300;
1007 if ( QApplication::desktop()->width() < 320 )
1008 w = 220;
1009 int h = bar->sizeHint().height() ;
1010 int dw = QApplication::desktop()->width();
1011 int dh = QApplication::desktop()->height();
1012 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1012 bar->setCaption (caption); 1013 bar->setCaption (caption);
1013 bar->setTotalSteps ( total ) ; 1014 bar->setTotalSteps ( total ) ;
1014 bar->show(); 1015 bar->show();
1015 } 1016 }
1016 bar->raise(); 1017 bar->raise();
1017 bar->setProgress( percentage ); 1018 bar->setProgress( percentage );
1018 qApp->processEvents(); 1019 qApp->processEvents();
1019} 1020}
1020 1021
1021void KSyncManager::hideProgressBar() 1022void KSyncManager::hideProgressBar()
1022{ 1023{
1023 bar->hide(); 1024 bar->hide();
1024 qApp->processEvents(); 1025 qApp->processEvents();
1025} 1026}
1026 1027
1027bool KSyncManager::isProgressBarCanceled() 1028bool KSyncManager::isProgressBarCanceled()
1028{ 1029{
1029 return !bar->isVisible(); 1030 return !bar->isVisible();
1030} 1031}
1031 1032
1032QString KSyncManager::syncFileName() 1033QString KSyncManager::syncFileName()
1033{ 1034{
1034 1035
1035 QString fn = "tempfile"; 1036 QString fn = "tempfile";