summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 038e032..fc0ac6b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1,147 +1,148 @@
1/* 1/*
2 This file is part of KDE-Pim/Pi. 2 This file is part of KDE-Pim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
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#include <qcheckbox.h>
52#include <qapplication.h>
52 53
53#include <klocale.h> 54#include <klocale.h>
54#include <kglobal.h> 55#include <kglobal.h>
55#include <kconfig.h> 56#include <kconfig.h>
56#include <kfiledialog.h> 57#include <kfiledialog.h>
57 58
58QDateTime KSyncManager::mRequestedSyncEvent; 59QDateTime KSyncManager::mRequestedSyncEvent;
59 60
60 61
61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 62KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
62 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) 63 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
63{ 64{
64 mServerSocket = 0; 65 mServerSocket = 0;
65 bar = new QProgressBar ( 1, 0 ); 66 bar = new QProgressBar ( 1, 0 );
66 bar->setCaption (""); 67 bar->setCaption ("");
67 mWriteBackInPast = 2; 68 mWriteBackInPast = 2;
68 69
69 70
70} 71}
71 72
72KSyncManager::~KSyncManager() 73KSyncManager::~KSyncManager()
73{ 74{
74 delete bar; 75 delete bar;
75} 76}
76 77
77void KSyncManager::setDefaultFileName( QString s) 78void KSyncManager::setDefaultFileName( QString s)
78{ 79{
79 mDefFileName = s ; 80 mDefFileName = s ;
80 if ( mPrefs->mPassiveSyncAutoStart ) 81 if ( mPrefs->mPassiveSyncAutoStart )
81 enableQuick( false ); 82 enableQuick( false );
82} 83}
83 84
84void KSyncManager::fillSyncMenu() 85void KSyncManager::fillSyncMenu()
85{ 86{
86 if ( mSyncMenu->count() ) 87 if ( mSyncMenu->count() )
87 mSyncMenu->clear(); 88 mSyncMenu->clear();
88 89
89 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 90 mSyncMenu->insertItem( i18n("Configure..."), 0 );
90 mSyncMenu->insertSeparator(); 91 mSyncMenu->insertSeparator();
91 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); 92 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
92 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); 93 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
93 clearMenu->insertItem( i18n("For all profiles"), 1 ); 94 clearMenu->insertItem( i18n("For all profiles"), 1 );
94 clearMenu->insertSeparator(); 95 clearMenu->insertSeparator();
95 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); 96 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) );
96 mSyncMenu->insertSeparator(); 97 mSyncMenu->insertSeparator();
97 if ( mServerSocket == 0 ) { 98 if ( mServerSocket == 0 ) {
98 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 99 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
99 } else { 100 } else {
100 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 101 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
101 } 102 }
102 mSyncMenu->insertSeparator(); 103 mSyncMenu->insertSeparator();
103 mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); 104 mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
104 mSyncMenu->insertSeparator(); 105 mSyncMenu->insertSeparator();
105 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 106 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
106 config.setGroup("General"); 107 config.setGroup("General");
107 QStringList prof = config.readListEntry("SyncProfileNames"); 108 QStringList prof = config.readListEntry("SyncProfileNames");
108 mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 109 mLocalMachineName = config.readEntry("LocalMachineName","undefined");
109 if ( prof.count() < 2 ) { 110 if ( prof.count() < 2 ) {
110 prof.clear(); 111 prof.clear();
111 QString externalName; 112 QString externalName;
112#ifdef DESKTOP_VERSION 113#ifdef DESKTOP_VERSION
113#ifdef _WIN32_ 114#ifdef _WIN32_
114 externalName = "OutLook(not_implemented)"; 115 externalName = "OutLook(not_implemented)";
115#else 116#else
116 externalName = "KDE_Desktop"; 117 externalName = "KDE_Desktop";
117#endif 118#endif
118#else 119#else
119 externalName = "Sharp_DTM"; 120 externalName = "Sharp_DTM";
120#endif 121#endif
121 prof << externalName; 122 prof << externalName;
122 prof << i18n("Local_file"); 123 prof << i18n("Local_file");
123 prof << i18n("Last_file"); 124 prof << i18n("Last_file");
124 KSyncProfile* temp = new KSyncProfile (); 125 KSyncProfile* temp = new KSyncProfile ();
125 temp->setName( prof[0] ); 126 temp->setName( prof[0] );
126 temp->writeConfig(&config); 127 temp->writeConfig(&config);
127 temp->setName( prof[1] ); 128 temp->setName( prof[1] );
128 temp->writeConfig(&config); 129 temp->writeConfig(&config);
129 temp->setName( prof[2] ); 130 temp->setName( prof[2] );
130 temp->writeConfig(&config); 131 temp->writeConfig(&config);
131 config.setGroup("General"); 132 config.setGroup("General");
132 config.writeEntry("SyncProfileNames",prof); 133 config.writeEntry("SyncProfileNames",prof);
133 config.writeEntry("ExternSyncProfiles",externalName); 134 config.writeEntry("ExternSyncProfiles",externalName);
134 config.sync(); 135 config.sync();
135 delete temp; 136 delete temp;
136 } 137 }
137 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 138 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
138 mSyncProfileNames = prof; 139 mSyncProfileNames = prof;
139 unsigned int i; 140 unsigned int i;
140 for ( i = 0; i < prof.count(); ++i ) { 141 for ( i = 0; i < prof.count(); ++i ) {
141 QString insertText = prof[i]; 142 QString insertText = prof[i];
142 if ( i == 0 ) { 143 if ( i == 0 ) {
143#ifdef DESKTOP_VERSION 144#ifdef DESKTOP_VERSION
144#ifdef _WIN32_ 145#ifdef _WIN32_
145 insertText = "OutLook(not_implemented)"; 146 insertText = "OutLook(not_implemented)";
146#else 147#else
147 insertText = "KDE_Desktop"; 148 insertText = "KDE_Desktop";