summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-22 03:08:05 (UTC)
committer zautrix <zautrix>2004-09-22 03:08:05 (UTC)
commitd63eac7a612a9724705bc58ad98c65c6ac052d07 (patch) (unidiff)
treedc584a0ddcbd5f828ea36b86b6af640e46e137f2
parent633522024e48efc423155a04b71083a03696211d (diff)
downloadkdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.zip
kdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.tar.gz
kdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.tar.bz2
connected global config
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/mainembedded.cpp15
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp18
-rw-r--r--kmicromail/opiemail.cpp2
-rw-r--r--korganizer/calendarview.cpp6
-rw-r--r--korganizer/koprefs.cpp2
-rw-r--r--korganizer/koprefsdialog.cpp106
-rw-r--r--korganizer/mainwindow.cpp2
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp2
-rw-r--r--libkdepim/kpimglobalprefs.cpp17
-rw-r--r--libkdepim/kpimglobalprefs.h4
10 files changed, 93 insertions, 81 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 10b1013..965fb06 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,223 +1,212 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#else 4#else
5#include <qapplication.h> 5#include <qapplication.h>
6#include <qwindowsstyle.h> 6#include <qwindowsstyle.h>
7#include <qplatinumstyle.h> 7#include <qplatinumstyle.h>
8#include <qmainwindow.h> 8#include <qmainwindow.h>
9#endif 9#endif
10 10
11#include <kstandarddirs.h> 11#include <kstandarddirs.h>
12#include <qregexp.h> 12#include <qregexp.h>
13#include <kglobal.h> 13#include <kglobal.h>
14#include <stdio.h> 14#include <stdio.h>
15#include <qdir.h> 15#include <qdir.h>
16#include "kaddressbookmain.h" 16#include "kaddressbookmain.h"
17#include "externalapphandler.h" 17#include "externalapphandler.h"
18#include <libkdepim/kpimglobalprefs.h>
18 19
19int main( int argc, char **argv ) 20int main( int argc, char **argv )
20{ 21{
21#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
22 QPEApplication a( argc, argv ); 23 QPEApplication a( argc, argv );
23 a.setKeepRunning (); 24 a.setKeepRunning ();
24#else 25#else
25 QApplication a( argc, argv ); 26 QApplication a( argc, argv );
26 QApplication::setStyle( new QPlatinumStyle ()); 27 QApplication::setStyle( new QPlatinumStyle ());
27 QString hdir = QDir::homeDirPath(); 28 QString hdir = QDir::homeDirPath();
28 // there is a bug when creating dirs for WIN 98 29 // there is a bug when creating dirs for WIN 98
29 // it is difficult to fix, because we have no WIN 98 runnung 30 // it is difficult to fix, because we have no WIN 98 runnung
30 // such that we try it to create the dirs at startup here 31 // such that we try it to create the dirs at startup here
31 if ( hdir == "C:\\" ) { // win 98 or ME 32 if ( hdir == "C:\\" ) { // win 98 or ME
32 QDir app_dir; 33 QDir app_dir;
33 if ( !app_dir.exists("C:\\kdepim") ) 34 if ( !app_dir.exists("C:\\kdepim") )
34 app_dir.mkdir ("C:\\kdepim"); 35 app_dir.mkdir ("C:\\kdepim");
35 if ( !app_dir.exists("C:\\kdepim\\apps") ) 36 if ( !app_dir.exists("C:\\kdepim\\apps") )
36 app_dir.mkdir ("C:\\kdepim\\apps"); 37 app_dir.mkdir ("C:\\kdepim\\apps");
37 if ( !app_dir.exists("C:\\kdepim\\config") ) 38 if ( !app_dir.exists("C:\\kdepim\\config") )
38 app_dir.mkdir ("C:\\kdepim\\config"); 39 app_dir.mkdir ("C:\\kdepim\\config");
39 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 40 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") )
40 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); 41 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
41 } 42 }
42#endif 43#endif
43 44
44 bool exitHelp = false; 45 bool exitHelp = false;
45 if ( argc > 1 ) { 46 if ( argc > 1 ) {
46 QString command = argv[1]; 47 QString command = argv[1];
47 if ( command == "-help" ){ 48 if ( command == "-help" ){
48 printf("KA/E command line commands:\n"); 49 printf("KA/E command line commands:\n");
49 printf(" no command: Start KA/E in usual way\n"); 50 printf(" no command: Start KA/E in usual way\n");
50 printf(" -help: This output\n"); 51 printf(" -help: This output\n");
51 printf(" KA/E is exiting now. Bye!\n"); 52 printf(" KA/E is exiting now. Bye!\n");
52 exitHelp = true; 53 exitHelp = true;
53 } 54 }
54 } 55 }
55 if ( ! exitHelp ) { 56 if ( ! exitHelp ) {
56 57
57 KGlobal::setAppName( "kaddressbook" ); 58 KGlobal::setAppName( "kaddressbook" );
58#ifndef DESKTOP_VERSION 59#ifndef DESKTOP_VERSION
59 if ( QApplication::desktop()->width() > 320 ) 60 if ( QApplication::desktop()->width() > 320 )
60 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 61 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
61 else 62 else
62 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 63 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
63#else 64#else
64 QString fileName ; 65 QString fileName ;
65 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 66 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
66 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 67 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
67 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 68 QApplication::addLibraryPath ( qApp->applicationDirPath () );
68 69
69#endif 70#endif
70 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 71 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
71 KAddressBookMain m ; 72 KAddressBookMain m ;
72//US MainWindow m; 73//US MainWindow m;
73 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 74 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
74 75
75 { 76 {
76 KConfig kon ( locateLocal( "config", "korganizerrc" ) ); 77 KPimGlobalPrefs::instance()->setGlobalConfig();
77 kon.setGroup("Locale");
78 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
79 QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
80 KGlobal::locale()->setHore24Format( !kon.readNumEntry( "PreferredTime",0 ) );
81 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
82 dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
83 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
84 kon.setGroup("Time & Date");
85 KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
86 kon.readNumEntry( "DaylightsavingStart", 90),
87 kon.readNumEntry( "DaylightsavingEnd",304) );
88 KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
89 } 78 }
90#ifndef DESKTOP_VERSION 79#ifndef DESKTOP_VERSION
91 a.showMainWidget( &m ); 80 a.showMainWidget( &m );
92#else 81#else
93 a.setMainWidget( &m ); 82 a.setMainWidget( &m );
94 m.resize (640, 480 ); 83 m.resize (640, 480 );
95 m.show(); 84 m.show();
96#endif 85#endif
97 a.exec(); 86 a.exec();
98 87
99 } 88 }
100 qDebug("KA: Bye! "); 89 qDebug("KA: Bye! ");
101} 90}
102 91
103/* 92/*
104#include <stdlib.h> 93#include <stdlib.h>
105 94
106#include <qstring.h> 95#include <qstring.h>
107 96
108#include <kabc/stdaddressbook.h> 97#include <kabc/stdaddressbook.h>
109#include <kaboutdata.h> 98#include <kaboutdata.h>
110#include <kcmdlineargs.h> 99#include <kcmdlineargs.h>
111#include <kcrash.h> 100#include <kcrash.h>
112#include <kdebug.h> 101#include <kdebug.h>
113#include <klocale.h> 102#include <klocale.h>
114#include <kstartupinfo.h> 103#include <kstartupinfo.h>
115#include <kuniqueapplication.h> 104#include <kuniqueapplication.h>
116#include <kwin.h> 105#include <kwin.h>
117 106
118#include "kaddressbookmain.h" 107#include "kaddressbookmain.h"
119#include "kabcore.h" 108#include "kabcore.h"
120 109
121extern "C" { 110extern "C" {
122 111
123void crashHandler( int ) 112void crashHandler( int )
124{ 113{
125 KABC::StdAddressBook::handleCrash(); 114 KABC::StdAddressBook::handleCrash();
126 ::exit( 0 ); 115 ::exit( 0 );
127} 116}
128 117
129} 118}
130 119
131class KAddressBookApp : public KUniqueApplication { 120class KAddressBookApp : public KUniqueApplication {
132 public: 121 public:
133 KAddressBookApp() : mMainWin( 0 ) {} 122 KAddressBookApp() : mMainWin( 0 ) {}
134 ~KAddressBookApp() {} 123 ~KAddressBookApp() {}
135 124
136 int newInstance(); 125 int newInstance();
137 126
138 private: 127 private:
139 KAddressBookMain *mMainWin; 128 KAddressBookMain *mMainWin;
140}; 129};
141 130
142int KAddressBookApp::newInstance() 131int KAddressBookApp::newInstance()
143{ 132{
144 if ( isRestored() ) { 133 if ( isRestored() ) {
145 // There can only be one main window 134 // There can only be one main window
146 if ( KMainWindow::canBeRestored( 1 ) ) { 135 if ( KMainWindow::canBeRestored( 1 ) ) {
147 mMainWin = new KAddressBookMain; 136 mMainWin = new KAddressBookMain;
148 mMainWin->show(); 137 mMainWin->show();
149 mMainWin->restore( 1 ); 138 mMainWin->restore( 1 );
150 } 139 }
151 } else { 140 } else {
152 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 141 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
153 142
154 QCString addrStr = args->getOption( "addr" ); 143 QCString addrStr = args->getOption( "addr" );
155 QCString uidStr = args->getOption( "uid" ); 144 QCString uidStr = args->getOption( "uid" );
156 QString addr; 145 QString addr;
157 QString uid; 146 QString uid;
158 if ( !addrStr.isEmpty() ) 147 if ( !addrStr.isEmpty() )
159 addr = QString::fromLocal8Bit( addrStr ); 148 addr = QString::fromLocal8Bit( addrStr );
160 if ( !uidStr.isEmpty() ) 149 if ( !uidStr.isEmpty() )
161 uid = QString::fromLocal8Bit( uidStr ); 150 uid = QString::fromLocal8Bit( uidStr );
162 151
163 152
164 if ( args->isSet( "editor-only" ) ) { 153 if ( args->isSet( "editor-only" ) ) {
165 if ( !mMainWin ) 154 if ( !mMainWin )
166 mMainWin = new KAddressBookMain; 155 mMainWin = new KAddressBookMain;
167 KStartupInfo::appStarted(); 156 KStartupInfo::appStarted();
168 mMainWin->hide(); 157 mMainWin->hide();
169 } else { 158 } else {
170 if ( mMainWin ) { 159 if ( mMainWin ) {
171 mMainWin->show(); 160 mMainWin->show();
172 KWin::setActiveWindow( mMainWin->winId() ); 161 KWin::setActiveWindow( mMainWin->winId() );
173 } else { 162 } else {
174 mMainWin = new KAddressBookMain; 163 mMainWin = new KAddressBookMain;
175 mMainWin->show(); 164 mMainWin->show();
176 } 165 }
177 } 166 }
178 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do 167 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do
179 if ( !addr.isEmpty() ) 168 if ( !addr.isEmpty() )
180 mMainWin->addEmail( addr ); 169 mMainWin->addEmail( addr );
181 170
182 if ( !uid.isEmpty() ) 171 if ( !uid.isEmpty() )
183 mMainWin->showContactEditor( uid ); 172 mMainWin->showContactEditor( uid );
184 if ( args->isSet( "new-contact" ) ) { 173 if ( args->isSet( "new-contact" ) ) {
185 mMainWin->newContact(); 174 mMainWin->newContact();
186 } 175 }
187 } 176 }
188 177
189 KCrash::setEmergencySaveFunction( crashHandler ); 178 KCrash::setEmergencySaveFunction( crashHandler );
190 179
191 return 0; 180 return 0;
192} 181}
193 182
194// the dummy argument is required, because KMail apparently sends an empty 183// the dummy argument is required, because KMail apparently sends an empty
195// argument. 184// argument.
196static KCmdLineOptions kmoptions[] = 185static KCmdLineOptions kmoptions[] =
197{ 186{
198 { "a", 0 , 0 }, 187 { "a", 0 , 0 },
199 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, 188 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 },
200 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, 189 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 },
201 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, 190 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 },
202 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, 191 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 },
203 { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, 192 { "+[argument]", I18N_NOOP( "dummy argument" ), 0},
204 { 0, 0, 0} 193 { 0, 0, 0}
205}; 194};
206 195
207int main( int argc, char *argv[] ) 196int main( int argc, char *argv[] )
208{ 197{
209 KLocale::setMainCatalogue( "kaddressbook" ); 198 KLocale::setMainCatalogue( "kaddressbook" );
210 199
211 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); 200 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() );
212 KCmdLineArgs::addCmdLineOptions( kmoptions ); 201 KCmdLineArgs::addCmdLineOptions( kmoptions );
213 KUniqueApplication::addCmdLineOptions(); 202 KUniqueApplication::addCmdLineOptions();
214 203
215 if ( !KAddressBookApp::start() ) 204 if ( !KAddressBookApp::start() )
216 exit( 0 ); 205 exit( 0 );
217 206
218 KAddressBookApp app; 207 KAddressBookApp app;
219 KGlobal::locale()->insertCatalogue( "libkdepim" ); 208 KGlobal::locale()->insertCatalogue( "libkdepim" );
220 209
221 return app.exec(); 210 return app.exec();
222} 211}
223*/ 212*/
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index 09a6447..e691082 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -1,548 +1,530 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "genericwrapper.h" 2#include "genericwrapper.h"
3#include <libetpan/libetpan.h> 3#include <libetpan/libetpan.h>
4#include "mailtypes.h" 4#include "mailtypes.h"
5 5
6#include <kconfig.h> 6#include <kconfig.h>
7#include <kglobal.h> 7#include <kglobal.h>
8#include <kstandarddirs.h> 8#include <kstandarddirs.h>
9 9
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12Genericwrapper::Genericwrapper() 12Genericwrapper::Genericwrapper()
13 : AbstractMail() 13 : AbstractMail()
14{ 14{
15 bodyCache.clear(); 15 bodyCache.clear();
16 m_storage = 0; 16 m_storage = 0;
17 m_folder = 0; 17 m_folder = 0;
18} 18}
19 19
20Genericwrapper::~Genericwrapper() 20Genericwrapper::~Genericwrapper()
21{ 21{
22 if (m_folder) { 22 if (m_folder) {
23 mailfolder_free(m_folder); 23 mailfolder_free(m_folder);
24 } 24 }
25 if (m_storage) { 25 if (m_storage) {
26 mailstorage_free(m_storage); 26 mailstorage_free(m_storage);
27 } 27 }
28 cleanMimeCache(); 28 cleanMimeCache();
29} 29}
30const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date ) 30const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
31{ 31{
32 static bool init = false ;
33 if ( ! init ) {
34 KConfig kon ( locateLocal( "config", "korganizerrc" ) );
35 kon.setGroup("Locale");
36 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
37 QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
38 KGlobal::locale()->setHore24Format( !kon.readNumEntry( "PreferredTime",0 ) );
39 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
40 dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
41 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
42 kon.setGroup("Time & Date");
43 KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
44 kon.readNumEntry( "DaylightsavingStart", 90),
45 kon.readNumEntry( "DaylightsavingEnd",304) );
46 KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
47
48 init = true;
49 32
50 }
51 QDate da (date->dt_year,date->dt_month, date->dt_day ); 33 QDate da (date->dt_year,date->dt_month, date->dt_day );
52 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); 34 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
53 QDateTime dt ( da ,ti ); 35 QDateTime dt ( da ,ti );
54 int addsec = -date->dt_zone*36; 36 int addsec = -date->dt_zone*36;
55 //qDebug("adsec1 %d ",addsec ); 37 //qDebug("adsec1 %d ",addsec );
56 dt = dt.addSecs( addsec ); 38 dt = dt.addSecs( addsec );
57 int off = KGlobal::locale()->localTimeOffset( dt ); 39 int off = KGlobal::locale()->localTimeOffset( dt );
58 //qDebug("adsec2 %d ",off*60 ); 40 //qDebug("adsec2 %d ",off*60 );
59 41
60 dt = dt.addSecs( off*60 ); 42 dt = dt.addSecs( off*60 );
61 return dt; 43 return dt;
62#if 0 44#if 0
63 QString ret; 45 QString ret;
64 if ( dt.date() == QDate::currentDate () ) 46 if ( dt.date() == QDate::currentDate () )
65 ret = KGlobal::locale()->formatTime( dt.time(),true); 47 ret = KGlobal::locale()->formatTime( dt.time(),true);
66 48
67 else { 49 else {
68 ret = KGlobal::locale()->formatDateTime( dt,true,true); 50 ret = KGlobal::locale()->formatDateTime( dt,true,true);
69 } 51 }
70#endif 52#endif
71#if 0 53#if 0
72 if ( off < 0 ) 54 if ( off < 0 )
73 ret += " -"; 55 ret += " -";
74 else 56 else
75 ret += " +"; 57 ret += " +";
76 ret += QString::number( off / 60 ); 58 ret += QString::number( off / 60 );
77 ret += "h"; 59 ret += "h";
78#endif 60#endif
79#if 0 61#if 0
80 char tmp[23]; 62 char tmp[23];
81 63
82 // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", 64 // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i",
83 // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 65 // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
84 snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", 66 snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i",
85 date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 67 date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
86 68
87 69
88 return QString( tmp ); 70 return QString( tmp );
89#endif 71#endif
90 //return ret; 72 //return ret;
91} 73}
92 74
93void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) 75void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime)
94{ 76{
95 if (!mime) { 77 if (!mime) {
96 return; 78 return;
97 } 79 }
98 mailmime_field*field = 0; 80 mailmime_field*field = 0;
99 mailmime_single_fields fields; 81 mailmime_single_fields fields;
100 memset(&fields, 0, sizeof(struct mailmime_single_fields)); 82 memset(&fields, 0, sizeof(struct mailmime_single_fields));
101 if (mime->mm_mime_fields != NULL) { 83 if (mime->mm_mime_fields != NULL) {
102 mailmime_single_fields_init(&fields, mime->mm_mime_fields, 84 mailmime_single_fields_init(&fields, mime->mm_mime_fields,
103 mime->mm_content_type); 85 mime->mm_content_type);
104 } 86 }
105 87
106 mailmime_content*type = fields.fld_content; 88 mailmime_content*type = fields.fld_content;
107 clistcell*current; 89 clistcell*current;
108 if (!type) { 90 if (!type) {
109 target->setType("text"); 91 target->setType("text");
110 target->setSubtype("plain"); 92 target->setSubtype("plain");
111 } else { 93 } else {
112 target->setSubtype(type->ct_subtype); 94 target->setSubtype(type->ct_subtype);
113 switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { 95 switch(type->ct_type->tp_data.tp_discrete_type->dt_type) {
114 case MAILMIME_DISCRETE_TYPE_TEXT: 96 case MAILMIME_DISCRETE_TYPE_TEXT:
115 target->setType("text"); 97 target->setType("text");
116 break; 98 break;
117 case MAILMIME_DISCRETE_TYPE_IMAGE: 99 case MAILMIME_DISCRETE_TYPE_IMAGE:
118 target->setType("image"); 100 target->setType("image");
119 break; 101 break;
120 case MAILMIME_DISCRETE_TYPE_AUDIO: 102 case MAILMIME_DISCRETE_TYPE_AUDIO:
121 target->setType("audio"); 103 target->setType("audio");
122 break; 104 break;
123 case MAILMIME_DISCRETE_TYPE_VIDEO: 105 case MAILMIME_DISCRETE_TYPE_VIDEO:
124 target->setType("video"); 106 target->setType("video");
125 break; 107 break;
126 case MAILMIME_DISCRETE_TYPE_APPLICATION: 108 case MAILMIME_DISCRETE_TYPE_APPLICATION:
127 target->setType("application"); 109 target->setType("application");
128 break; 110 break;
129 case MAILMIME_DISCRETE_TYPE_EXTENSION: 111 case MAILMIME_DISCRETE_TYPE_EXTENSION:
130 default: 112 default:
131 if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { 113 if (type->ct_type->tp_data.tp_discrete_type->dt_extension) {
132 target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); 114 target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension);
133 } 115 }
134 break; 116 break;
135 } 117 }
136 if (type->ct_parameters) { 118 if (type->ct_parameters) {
137 fillParameters(target,type->ct_parameters); 119 fillParameters(target,type->ct_parameters);
138 } 120 }
139 } 121 }
140 if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { 122 if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) {
141 for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { 123 for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) {
142 field = (mailmime_field*)current->data; 124 field = (mailmime_field*)current->data;
143 switch(field->fld_type) { 125 switch(field->fld_type) {
144 case MAILMIME_FIELD_TRANSFER_ENCODING: 126 case MAILMIME_FIELD_TRANSFER_ENCODING:
145 target->setEncoding(getencoding(field->fld_data.fld_encoding)); 127 target->setEncoding(getencoding(field->fld_data.fld_encoding));
146 break; 128 break;
147 case MAILMIME_FIELD_ID: 129 case MAILMIME_FIELD_ID:
148 target->setIdentifier(field->fld_data.fld_id); 130 target->setIdentifier(field->fld_data.fld_id);
149 break; 131 break;
150 case MAILMIME_FIELD_DESCRIPTION: 132 case MAILMIME_FIELD_DESCRIPTION:
151 target->setDescription(field->fld_data.fld_description); 133 target->setDescription(field->fld_data.fld_description);
152 break; 134 break;
153 default: 135 default:
154 break; 136 break;
155 } 137 }
156 } 138 }
157 } 139 }
158} 140}
159 141
160void Genericwrapper::fillParameters(RecPartP&target,clist*parameters) 142void Genericwrapper::fillParameters(RecPartP&target,clist*parameters)
161{ 143{
162 if (!parameters) {return;} 144 if (!parameters) {return;}
163 clistcell*current=0; 145 clistcell*current=0;
164 mailmime_parameter*param; 146 mailmime_parameter*param;
165 for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { 147 for (current=clist_begin(parameters);current!=0;current=clist_next(current)) {
166 param = (mailmime_parameter*)current->data; 148 param = (mailmime_parameter*)current->data;
167 if (param) { 149 if (param) {
168 target->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); 150 target->addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
169 } 151 }
170 } 152 }
171} 153}
172 154
173QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) 155QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
174{ 156{
175 QString enc="7bit"; 157 QString enc="7bit";
176 if (!aEnc) return enc; 158 if (!aEnc) return enc;
177 switch(aEnc->enc_type) { 159 switch(aEnc->enc_type) {
178 case MAILMIME_MECHANISM_7BIT: 160 case MAILMIME_MECHANISM_7BIT:
179 enc = "7bit"; 161 enc = "7bit";
180 break; 162 break;
181 case MAILMIME_MECHANISM_8BIT: 163 case MAILMIME_MECHANISM_8BIT:
182 enc = "8bit"; 164 enc = "8bit";
183 break; 165 break;
184 case MAILMIME_MECHANISM_BINARY: 166 case MAILMIME_MECHANISM_BINARY:
185 enc = "binary"; 167 enc = "binary";
186 break; 168 break;
187 case MAILMIME_MECHANISM_QUOTED_PRINTABLE: 169 case MAILMIME_MECHANISM_QUOTED_PRINTABLE:
188 enc = "quoted-printable"; 170 enc = "quoted-printable";
189 break; 171 break;
190 case MAILMIME_MECHANISM_BASE64: 172 case MAILMIME_MECHANISM_BASE64:
191 enc = "base64"; 173 enc = "base64";
192 break; 174 break;
193 case MAILMIME_MECHANISM_TOKEN: 175 case MAILMIME_MECHANISM_TOKEN:
194 default: 176 default:
195 if (aEnc->enc_token) { 177 if (aEnc->enc_token) {
196 enc = QString(aEnc->enc_token); 178 enc = QString(aEnc->enc_token);
197 } 179 }
198 break; 180 break;
199 } 181 }
200 return enc; 182 return enc;
201} 183}
202 184
203void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) 185void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
204{ 186{
205 if (current_rec >= 10) { 187 if (current_rec >= 10) {
206 ; // odebug << "too deep recursion!" << oendl; 188 ; // odebug << "too deep recursion!" << oendl;
207 } 189 }
208 if (!message || !mime) { 190 if (!message || !mime) {
209 return; 191 return;
210 } 192 }
211 int r; 193 int r;
212 char*data = 0; 194 char*data = 0;
213 size_t len; 195 size_t len;
214 clistiter * cur = 0; 196 clistiter * cur = 0;
215 QString b; 197 QString b;
216 RecPartP part = new RecPart(); 198 RecPartP part = new RecPart();
217 199
218 switch (mime->mm_type) { 200 switch (mime->mm_type) {
219 case MAILMIME_SINGLE: 201 case MAILMIME_SINGLE:
220 { 202 {
221 QValueList<int>countlist = recList; 203 QValueList<int>countlist = recList;
222 countlist.append(current_count); 204 countlist.append(current_count);
223 r = mailmessage_fetch_section(message,mime,&data,&len); 205 r = mailmessage_fetch_section(message,mime,&data,&len);
224 part->setSize(len); 206 part->setSize(len);
225 part->setPositionlist(countlist); 207 part->setPositionlist(countlist);
226 b = gen_attachment_id(); 208 b = gen_attachment_id();
227 part->setIdentifier(b); 209 part->setIdentifier(b);
228 fillSingleBody(part,message,mime); 210 fillSingleBody(part,message,mime);
229 if (part->Type()=="text" && target->Bodytext().isNull()) { 211 if (part->Type()=="text" && target->Bodytext().isNull()) {
230 encodedString*rs = new encodedString(); 212 encodedString*rs = new encodedString();
231 rs->setContent(data,len); 213 rs->setContent(data,len);
232 encodedString*res = decode_String(rs,part->Encoding()); 214 encodedString*res = decode_String(rs,part->Encoding());
233 if (countlist.count()>2) { 215 if (countlist.count()>2) {
234 bodyCache[b]=rs; 216 bodyCache[b]=rs;
235 target->addPart(part); 217 target->addPart(part);
236 } else { 218 } else {
237 delete rs; 219 delete rs;
238 } 220 }
239 b = QString(res->Content()); 221 b = QString(res->Content());
240 delete res; 222 delete res;
241 target->setBodytext(b); 223 target->setBodytext(b);
242 target->setDescription(part); 224 target->setDescription(part);
243 } else { 225 } else {
244 bodyCache[b]=new encodedString(data,len); 226 bodyCache[b]=new encodedString(data,len);
245 target->addPart(part); 227 target->addPart(part);
246 } 228 }
247 } 229 }
248 break; 230 break;
249 case MAILMIME_MULTIPLE: 231 case MAILMIME_MULTIPLE:
250 { 232 {
251 unsigned int ccount = 1; 233 unsigned int ccount = 1;
252 mailmime*cbody=0; 234 mailmime*cbody=0;
253 QValueList<int>countlist = recList; 235 QValueList<int>countlist = recList;
254 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { 236 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
255 cbody = (mailmime*)clist_content(cur); 237 cbody = (mailmime*)clist_content(cur);
256 if (cbody->mm_type==MAILMIME_MULTIPLE) { 238 if (cbody->mm_type==MAILMIME_MULTIPLE) {
257 RecPartP targetPart = new RecPart(); 239 RecPartP targetPart = new RecPart();
258 targetPart->setType("multipart"); 240 targetPart->setType("multipart");
259 countlist.append(current_count); 241 countlist.append(current_count);
260 targetPart->setPositionlist(countlist); 242 targetPart->setPositionlist(countlist);
261 target->addPart(targetPart); 243 target->addPart(targetPart);
262 } 244 }
263 traverseBody(target,message, cbody,countlist,current_rec+1,ccount); 245 traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
264 if (cbody->mm_type==MAILMIME_MULTIPLE) { 246 if (cbody->mm_type==MAILMIME_MULTIPLE) {
265 countlist = recList; 247 countlist = recList;
266 } 248 }
267 ++ccount; 249 ++ccount;
268 } 250 }
269 } 251 }
270 break; 252 break;
271 case MAILMIME_MESSAGE: 253 case MAILMIME_MESSAGE:
272 { 254 {
273 QValueList<int>countlist = recList; 255 QValueList<int>countlist = recList;
274 countlist.append(current_count); 256 countlist.append(current_count);
275 /* the own header is always at recursion 0 - we don't need that */ 257 /* the own header is always at recursion 0 - we don't need that */
276 if (current_rec > 0) { 258 if (current_rec > 0) {
277 part->setPositionlist(countlist); 259 part->setPositionlist(countlist);
278 r = mailmessage_fetch_section(message,mime,&data,&len); 260 r = mailmessage_fetch_section(message,mime,&data,&len);
279 part->setSize(len); 261 part->setSize(len);
280 part->setPositionlist(countlist); 262 part->setPositionlist(countlist);
281 b = gen_attachment_id(); 263 b = gen_attachment_id();
282 part->setIdentifier(b); 264 part->setIdentifier(b);
283 part->setType("message"); 265 part->setType("message");
284 part->setSubtype("rfc822"); 266 part->setSubtype("rfc822");
285 bodyCache[b]=new encodedString(data,len); 267 bodyCache[b]=new encodedString(data,len);
286 target->addPart(part); 268 target->addPart(part);
287 } 269 }
288 if (mime->mm_data.mm_message.mm_msg_mime != NULL) { 270 if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
289 traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); 271 traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
290 } 272 }
291 } 273 }
292 break; 274 break;
293 } 275 }
294} 276}
295 277
296RecBodyP Genericwrapper::parseMail( mailmessage * msg ) 278RecBodyP Genericwrapper::parseMail( mailmessage * msg )
297{ 279{
298 int err = MAILIMF_NO_ERROR; 280 int err = MAILIMF_NO_ERROR;
299 mailmime_single_fields fields; 281 mailmime_single_fields fields;
300 /* is bound to msg and will be freed there */ 282 /* is bound to msg and will be freed there */
301 mailmime * mime=0; 283 mailmime * mime=0;
302 RecBodyP body = new RecBody(); 284 RecBodyP body = new RecBody();
303 memset(&fields, 0, sizeof(struct mailmime_single_fields)); 285 memset(&fields, 0, sizeof(struct mailmime_single_fields));
304 err = mailmessage_get_bodystructure(msg,&mime); 286 err = mailmessage_get_bodystructure(msg,&mime);
305 QValueList<int>recList; 287 QValueList<int>recList;
306 traverseBody(body,msg,mime,recList); 288 traverseBody(body,msg,mime,recList);
307 return body; 289 return body;
308} 290}
309 291
310 292
311QString Genericwrapper::parseAddressList( mailimf_address_list *list ) 293QString Genericwrapper::parseAddressList( mailimf_address_list *list )
312{ 294{
313 QString result( "" ); 295 QString result( "" );
314 296
315 bool first = true; 297 bool first = true;
316 if (list == 0) return result; 298 if (list == 0) return result;
317 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { 299 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
318 mailimf_address *addr = (mailimf_address *) current->data; 300 mailimf_address *addr = (mailimf_address *) current->data;
319 301
320 if ( !first ) { 302 if ( !first ) {
321 result.append( "," ); 303 result.append( "," );
322 } else { 304 } else {
323 first = false; 305 first = false;
324 } 306 }
325 307
326 switch ( addr->ad_type ) { 308 switch ( addr->ad_type ) {
327 case MAILIMF_ADDRESS_MAILBOX: 309 case MAILIMF_ADDRESS_MAILBOX:
328 result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); 310 result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
329 break; 311 break;
330 case MAILIMF_ADDRESS_GROUP: 312 case MAILIMF_ADDRESS_GROUP:
331 result.append( parseGroup( addr->ad_data.ad_group ) ); 313 result.append( parseGroup( addr->ad_data.ad_group ) );
332 break; 314 break;
333 default: 315 default:
334 ; // odebug << "Generic: unkown mailimf address type" << oendl; 316 ; // odebug << "Generic: unkown mailimf address type" << oendl;
335 break; 317 break;
336 } 318 }
337 } 319 }
338 320
339 return result; 321 return result;
340} 322}
341 323
342QString Genericwrapper::parseGroup( mailimf_group *group ) 324QString Genericwrapper::parseGroup( mailimf_group *group )
343{ 325{
344 QString result( "" ); 326 QString result( "" );
345 327
346 result.append( group->grp_display_name ); 328 result.append( group->grp_display_name );
347 result.append( ": " ); 329 result.append( ": " );
348 330
349 if ( group->grp_mb_list != NULL ) { 331 if ( group->grp_mb_list != NULL ) {
350 result.append( parseMailboxList( group->grp_mb_list ) ); 332 result.append( parseMailboxList( group->grp_mb_list ) );
351 } 333 }
352 334
353 result.append( ";" ); 335 result.append( ";" );
354 336
355 return result; 337 return result;
356} 338}
357 339
358QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) 340QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
359{ 341{
360 QString result( "" ); 342 QString result( "" );
361 343
362 if ( box->mb_display_name == NULL ) { 344 if ( box->mb_display_name == NULL ) {
363 result.append( box->mb_addr_spec ); 345 result.append( box->mb_addr_spec );
364 } else { 346 } else {
365 result.append( convert_String(box->mb_display_name).latin1() ); 347 result.append( convert_String(box->mb_display_name).latin1() );
366 result.append( " <" ); 348 result.append( " <" );
367 result.append( box->mb_addr_spec ); 349 result.append( box->mb_addr_spec );
368 result.append( ">" ); 350 result.append( ">" );
369 } 351 }
370 352
371 return result; 353 return result;
372} 354}
373 355
374QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) 356QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list )
375{ 357{
376 QString result( "" ); 358 QString result( "" );
377 359
378 bool first = true; 360 bool first = true;
379 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { 361 for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) {
380 mailimf_mailbox *box = (mailimf_mailbox *) current->data; 362 mailimf_mailbox *box = (mailimf_mailbox *) current->data;
381 363
382 if ( !first ) { 364 if ( !first ) {
383 result.append( "," ); 365 result.append( "," );
384 } else { 366 } else {
385 first = false; 367 first = false;
386 } 368 }
387 369
388 result.append( parseMailbox( box ) ); 370 result.append( parseMailbox( box ) );
389 } 371 }
390 372
391 return result; 373 return result;
392} 374}
393 375
394encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part) 376encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part)
395{ 377{
396 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); 378 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier());
397 if (it==bodyCache.end()) return new encodedString(); 379 if (it==bodyCache.end()) return new encodedString();
398 encodedString*t = decode_String(it.data(),part->Encoding()); 380 encodedString*t = decode_String(it.data(),part->Encoding());
399 return t; 381 return t;
400} 382}
401 383
402encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part) 384encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part)
403{ 385{
404 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); 386 QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier());
405 if (it==bodyCache.end()) return new encodedString(); 387 if (it==bodyCache.end()) return new encodedString();
406 encodedString*t = it.data(); 388 encodedString*t = it.data();
407 return t; 389 return t;
408} 390}
409 391
410QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) 392QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
411{ 393{
412 encodedString*t = fetchDecodedPart(mail,part); 394 encodedString*t = fetchDecodedPart(mail,part);
413 QString text=t->Content(); 395 QString text=t->Content();
414 delete t; 396 delete t;
415 return text; 397 return text;
416} 398}
417 399
418void Genericwrapper::cleanMimeCache() 400void Genericwrapper::cleanMimeCache()
419{ 401{
420 QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); 402 QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
421 for (;it!=bodyCache.end();++it) { 403 for (;it!=bodyCache.end();++it) {
422 encodedString*t = it.data(); 404 encodedString*t = it.data();
423 //it.setValue(0); 405 //it.setValue(0);
424 if (t) delete t; 406 if (t) delete t;
425 } 407 }
426 bodyCache.clear(); 408 bodyCache.clear();
427 ; // odebug << "Genericwrapper: cache cleaned" << oendl; 409 ; // odebug << "Genericwrapper: cache cleaned" << oendl;
428} 410}
429 411
430QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) 412QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
431{ 413{
432 QStringList res; 414 QStringList res;
433 if (!in_replies || !in_replies->mid_list) return res; 415 if (!in_replies || !in_replies->mid_list) return res;
434 clistiter * current = 0; 416 clistiter * current = 0;
435 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { 417 for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
436 QString h((char*)current->data); 418 QString h((char*)current->data);
437 while (h.length()>0 && h[0]=='<') { 419 while (h.length()>0 && h[0]=='<') {
438 h.remove(0,1); 420 h.remove(0,1);
439 } 421 }
440 while (h.length()>0 && h[h.length()-1]=='>') { 422 while (h.length()>0 && h[h.length()-1]=='>') {
441 h.remove(h.length()-1,1); 423 h.remove(h.length()-1,1);
442 } 424 }
443 if (h.length()>0) { 425 if (h.length()>0) {
444 res.append(h); 426 res.append(h);
445 } 427 }
446 } 428 }
447 return res; 429 return res;
448} 430}
449 431
450void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb) 432void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb)
451{ 433{
452 int r; 434 int r;
453 mailmessage_list * env_list = 0; 435 mailmessage_list * env_list = 0;
454 r = mailsession_get_messages_list(session,&env_list); 436 r = mailsession_get_messages_list(session,&env_list);
455 if (r != MAIL_NO_ERROR) { 437 if (r != MAIL_NO_ERROR) {
456 ; // odebug << "Error message list" << oendl; 438 ; // odebug << "Error message list" << oendl;
457 return; 439 return;
458 } 440 }
459 r = mailsession_get_envelopes_list(session, env_list); 441 r = mailsession_get_envelopes_list(session, env_list);
460 if (r != MAIL_NO_ERROR) { 442 if (r != MAIL_NO_ERROR) {
461 ; // odebug << "Error filling message list" << oendl; 443 ; // odebug << "Error filling message list" << oendl;
462 if (env_list) { 444 if (env_list) {
463 mailmessage_list_free(env_list); 445 mailmessage_list_free(env_list);
464 } 446 }
465 return; 447 return;
466 } 448 }
467 mailimf_references * refs = 0; 449 mailimf_references * refs = 0;
468 mailimf_in_reply_to * in_replies = 0; 450 mailimf_in_reply_to * in_replies = 0;
469 uint32_t i = 0; 451 uint32_t i = 0;
470 for(; i < carray_count(env_list->msg_tab) ; ++i) { 452 for(; i < carray_count(env_list->msg_tab) ; ++i) {
471 mailmessage * msg; 453 mailmessage * msg;
472 QBitArray mFlags(7); 454 QBitArray mFlags(7);
473 msg = (mailmessage*)carray_get(env_list->msg_tab, i); 455 msg = (mailmessage*)carray_get(env_list->msg_tab, i);
474 if (msg->msg_fields == NULL) { 456 if (msg->msg_fields == NULL) {
475 //; // odebug << "could not fetch envelope of message " << i << "" << oendl; 457 //; // odebug << "could not fetch envelope of message " << i << "" << oendl;
476 continue; 458 continue;
477 } 459 }
478 RecMailP mail = new RecMail(); 460 RecMailP mail = new RecMail();
479 mail->setWrapper(this); 461 mail->setWrapper(this);
480 mail_flags * flag_result = 0; 462 mail_flags * flag_result = 0;
481 r = mailmessage_get_flags(msg,&flag_result); 463 r = mailmessage_get_flags(msg,&flag_result);
482 if (r == MAIL_ERROR_NOT_IMPLEMENTED) { 464 if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
483 mFlags.setBit(FLAG_SEEN); 465 mFlags.setBit(FLAG_SEEN);
484 } 466 }
485 mailimf_single_fields single_fields; 467 mailimf_single_fields single_fields;
486 mailimf_single_fields_init(&single_fields, msg->msg_fields); 468 mailimf_single_fields_init(&single_fields, msg->msg_fields);
487 mail->setMsgsize(msg->msg_size); 469 mail->setMsgsize(msg->msg_size);
488 mail->setFlags(mFlags); 470 mail->setFlags(mFlags);
489 mail->setMbox(mailbox); 471 mail->setMbox(mailbox);
490 mail->setNumber(msg->msg_index); 472 mail->setNumber(msg->msg_index);
491 if (single_fields.fld_subject) 473 if (single_fields.fld_subject)
492 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); 474 mail->setSubject( convert_String(single_fields.fld_subject->sbj_value));
493 if (single_fields.fld_from) 475 if (single_fields.fld_from)
494 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); 476 mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
495 if (!mbox_as_to) { 477 if (!mbox_as_to) {
496 if (single_fields.fld_to) 478 if (single_fields.fld_to)
497 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); 479 mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
498 } else { 480 } else {
499 mail->setTo(mailbox); 481 mail->setTo(mailbox);
500 } 482 }
501 if (single_fields.fld_cc) 483 if (single_fields.fld_cc)
502 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); 484 mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
503 if (single_fields.fld_bcc) 485 if (single_fields.fld_bcc)
504 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 486 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
505 if (single_fields.fld_orig_date) { 487 if (single_fields.fld_orig_date) {
506 QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time ); 488 QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time );
507 QString ret; 489 QString ret;
508 if ( dt.date() == QDate::currentDate () ) 490 if ( dt.date() == QDate::currentDate () )
509 ret = KGlobal::locale()->formatTime( dt.time(),true); 491 ret = KGlobal::locale()->formatTime( dt.time(),true);
510 else { 492 else {
511 ret = KGlobal::locale()->formatDateTime( dt,true,true); 493 ret = KGlobal::locale()->formatDateTime( dt,true,true);
512 } 494 }
513 mail->setDate( ret ); 495 mail->setDate( ret );
514 char tmp[20]; 496 char tmp[20];
515 snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", 497 snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i",
516 dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); 498 dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() );
517 //qDebug(" iso %s ", tmp); 499 //qDebug(" iso %s ", tmp);
518 mail->setIsoDate( QString( tmp ) ); 500 mail->setIsoDate( QString( tmp ) );
519 } 501 }
520 // crashes when accessing pop3 account? 502 // crashes when accessing pop3 account?
521 if (single_fields.fld_message_id) { 503 if (single_fields.fld_message_id) {
522 mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); 504 mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
523 ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; 505 ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl;
524 } 506 }
525 if (single_fields.fld_reply_to) { 507 if (single_fields.fld_reply_to) {
526 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); 508 QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list);
527 if (t.count()>0) { 509 if (t.count()>0) {
528 mail->setReplyto(t[0]); 510 mail->setReplyto(t[0]);
529 } 511 }
530 } 512 }
531#if 0 513#if 0
532 refs = single_fields.fld_references; 514 refs = single_fields.fld_references;
533 if (refs && refs->mid_list && clist_count(refs->mid_list)) { 515 if (refs && refs->mid_list && clist_count(refs->mid_list)) {
534 char * text = (char*)refs->mid_list->first->data; 516 char * text = (char*)refs->mid_list->first->data;
535 mail->setReplyto(QString(text)); 517 mail->setReplyto(QString(text));
536 } 518 }
537#endif 519#endif
538 if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && 520 if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list &&
539 clist_count(single_fields.fld_in_reply_to->mid_list)) { 521 clist_count(single_fields.fld_in_reply_to->mid_list)) {
540 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); 522 mail->setInreply(parseInreplies(single_fields.fld_in_reply_to));
541 } 523 }
542 if ( maxSizeInKb == 0 || mail->Msgsize()<=maxSizeInKb*1024 ) 524 if ( maxSizeInKb == 0 || mail->Msgsize()<=maxSizeInKb*1024 )
543 target.append(mail); 525 target.append(mail);
544 } 526 }
545 if (env_list) { 527 if (env_list) {
546 mailmessage_list_free(env_list); 528 mailmessage_list_free(env_list);
547 } 529 }
548} 530}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 9a1a750..164988c 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,466 +1,468 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4#include "settingsdialog.h" 4#include "settingsdialog.h"
5#include "opiemail.h" 5#include "opiemail.h"
6#include "editaccounts.h" 6#include "editaccounts.h"
7#include "composemail.h" 7#include "composemail.h"
8#include "mailistviewitem.h" 8#include "mailistviewitem.h"
9#include "viewmail.h" 9#include "viewmail.h"
10#include "selectstore.h" 10#include "selectstore.h"
11#include "selectsmtp.h" 11#include "selectsmtp.h"
12#include "accountitem.h" 12#include "accountitem.h"
13#include "koprefsdialog.h" 13#include "koprefsdialog.h"
14 14
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qtimer.h> 16#include <qtimer.h>
17#include <libkdepim/externalapphandler.h> 17#include <libkdepim/externalapphandler.h>
18#include <libkdepim/kpimglobalprefs.h>
18 19
19#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
20#include <libmailwrapper/smtpwrapper.h> 21#include <libmailwrapper/smtpwrapper.h>
21#include <libmailwrapper/mailtypes.h> 22#include <libmailwrapper/mailtypes.h>
22#include <libmailwrapper/abstractmail.h> 23#include <libmailwrapper/abstractmail.h>
23/* OPIE */ 24/* OPIE */
24//#include <qpe/resource.h> 25//#include <qpe/resource.h>
25//#include <qpe/qpeapplication.h> 26//#include <qpe/qpeapplication.h>
26 27
27/* QT */ 28/* QT */
28 29
29//using namespace Opie::Core; 30//using namespace Opie::Core;
30 31
31OpieMail::OpieMail( QWidget *parent, const char *name ) 32OpieMail::OpieMail( QWidget *parent, const char *name )
32 : MainWindow( parent, name) //, WStyle_ContextHelp ) 33 : MainWindow( parent, name) //, WStyle_ContextHelp )
33{ 34{
34 settings = new Settings(); 35 settings = new Settings();
36 KPimGlobalPrefs::instance()->setGlobalConfig();
35 37
36 folderView->populate( settings->getAccounts() ); 38 folderView->populate( settings->getAccounts() );
37 39
38} 40}
39 41
40OpieMail::~OpieMail() 42OpieMail::~OpieMail()
41{ 43{
42 if (settings) delete settings; 44 if (settings) delete settings;
43} 45}
44 46
45void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 47void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
46{ 48{
47 49
48} 50}
49#include <stdlib.h> 51#include <stdlib.h>
50void OpieMail::message(const QCString &msg, const QByteArray &data) 52void OpieMail::message(const QCString &msg, const QByteArray &data)
51{ 53{
52 // copied from old mail2 54 // copied from old mail2
53 static int ii = 0; 55 static int ii = 0;
54 //qDebug("QCOP CALL ############################# %d ", ii); 56 //qDebug("QCOP CALL ############################# %d ", ii);
55 //QString mess ( msg ); 57 //QString mess ( msg );
56 //qDebug("Message = %s ",mess.latin1()); 58 //qDebug("Message = %s ",mess.latin1());
57 ++ii; 59 ++ii;
58 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 60 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
59 61
60 mPendingEmail = QString::null; 62 mPendingEmail = QString::null;
61 mPendingName = QString::null; 63 mPendingName = QString::null;
62 if (msg == "writeMail(QString,QString)") 64 if (msg == "writeMail(QString,QString)")
63 { 65 {
64 //qDebug("writeMail(QString,QString) "); 66 //qDebug("writeMail(QString,QString) ");
65 QDataStream stream(data,IO_ReadOnly); 67 QDataStream stream(data,IO_ReadOnly);
66 stream >> mPendingName >> mPendingEmail; 68 stream >> mPendingName >> mPendingEmail;
67 // removing the whitespaces at beginning and end is needed! 69 // removing the whitespaces at beginning and end is needed!
68 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 70 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
69 } 71 }
70 else if (msg == "newMail()") 72 else if (msg == "newMail()")
71 { 73 {
72 //qDebug("slotComposeMail() "); 74 //qDebug("slotComposeMail() ");
73 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 75 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
74 // and a QCOP call does not like a processevents in his execution 76 // and a QCOP call does not like a processevents in his execution
75 // with the Qtimer we call slotComposeMail() after we reached the main event loop 77 // with the Qtimer we call slotComposeMail() after we reached the main event loop
76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 78 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
77 // slotComposeMail(); 79 // slotComposeMail();
78 } 80 }
79 else if (msg == "newMail(QString)") 81 else if (msg == "newMail(QString)")
80 { 82 {
81 //qDebug(" newMail(QString)"); 83 //qDebug(" newMail(QString)");
82 QDataStream stream(data,IO_ReadOnly); 84 QDataStream stream(data,IO_ReadOnly);
83 stream >> mPendingName; 85 stream >> mPendingName;
84 // the format is 86 // the format is
85 // NAME <EMAIL>:SUBJECT 87 // NAME <EMAIL>:SUBJECT
86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 88 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
87 } else { 89 } else {
88 mPendingData = data; 90 mPendingData = data;
89 mPendingMessage = msg; 91 mPendingMessage = msg;
90 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 92 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
91 } 93 }
92 94
93 //qDebug("END OpieMail::message "); 95 //qDebug("END OpieMail::message ");
94} 96}
95void OpieMail::slotExtAppHandler() 97void OpieMail::slotExtAppHandler()
96{ 98{
97 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 99 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
98} 100}
99void OpieMail::slotwriteMail2(const QString& namemail ) 101void OpieMail::slotwriteMail2(const QString& namemail )
100{ 102{
101 //qDebug("OpieMail::slotwriteMail2 "); 103 //qDebug("OpieMail::slotwriteMail2 ");
102 //qApp->processEvents(); 104 //qApp->processEvents();
103 ComposeMail compose( settings, this, 0, true ); 105 ComposeMail compose( settings, this, 0, true );
104 if ( !namemail.isEmpty() ) { 106 if ( !namemail.isEmpty() ) {
105 QString to = namemail; 107 QString to = namemail;
106 if ( namemail.find( " <") > 1 ) { 108 if ( namemail.find( " <") > 1 ) {
107 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 109 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
108 } else 110 } else
109 if ( namemail.find( "<") > 1 ) { 111 if ( namemail.find( "<") > 1 ) {
110 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 112 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
111 } 113 }
112 int sub = to.find( ">:"); 114 int sub = to.find( ">:");
113 if ( sub > 0 ) { 115 if ( sub > 0 ) {
114 compose.setTo( to.left(sub+1) ); 116 compose.setTo( to.left(sub+1) );
115 compose.setSubject( to.mid(sub+2) ); 117 compose.setSubject( to.mid(sub+2) );
116 } else 118 } else
117 compose.setTo( to ); 119 compose.setTo( to );
118 } 120 }
119 compose.slotAdjustColumns(); 121 compose.slotAdjustColumns();
120 compose.showMaximized(); 122 compose.showMaximized();
121 compose.exec(); 123 compose.exec();
122 raise(); 124 raise();
123 //qDebug("retttich "); 125 //qDebug("retttich ");
124} 126}
125void OpieMail::slotwriteMail(const QString&name,const QString&email) 127void OpieMail::slotwriteMail(const QString&name,const QString&email)
126{ 128{
127 // qDebug("OpieMail::slotwriteMail "); 129 // qDebug("OpieMail::slotwriteMail ");
128 ComposeMail compose( settings, this, 0, true ); 130 ComposeMail compose( settings, this, 0, true );
129 if (!email.isEmpty()) 131 if (!email.isEmpty())
130 { 132 {
131 if (!name.isEmpty()) 133 if (!name.isEmpty())
132 { 134 {
133 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 135 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
134 } 136 }
135 else 137 else
136 { 138 {
137 compose.setTo(email); 139 compose.setTo(email);
138 } 140 }
139 } 141 }
140 compose.slotAdjustColumns(); 142 compose.slotAdjustColumns();
141 compose.showMaximized(); 143 compose.showMaximized();
142 compose.exec(); 144 compose.exec();
143 raise(); 145 raise();
144} 146}
145 147
146void OpieMail::slotComposeMail() 148void OpieMail::slotComposeMail()
147{ 149{
148 if ( mPendingEmail == QString::null && mPendingName == QString::null) 150 if ( mPendingEmail == QString::null && mPendingName == QString::null)
149 slotwriteMail2( QString () ); 151 slotwriteMail2( QString () );
150 else { 152 else {
151 if ( mPendingEmail == QString::null ) 153 if ( mPendingEmail == QString::null )
152 slotwriteMail2( mPendingName ); 154 slotwriteMail2( mPendingName );
153 else 155 else
154 slotwriteMail( mPendingName, mPendingEmail ); 156 slotwriteMail( mPendingName, mPendingEmail );
155 } 157 }
156 //slotwriteMail(0l,0l); 158 //slotwriteMail(0l,0l);
157} 159}
158 160
159void OpieMail::slotSendQueued() 161void OpieMail::slotSendQueued()
160{ 162{
161 SMTPaccount *smtp = 0; 163 SMTPaccount *smtp = 0;
162 164
163 QList<Account> list = settings->getAccounts(); 165 QList<Account> list = settings->getAccounts();
164 QList<SMTPaccount> smtpList; 166 QList<SMTPaccount> smtpList;
165 smtpList.setAutoDelete(false); 167 smtpList.setAutoDelete(false);
166 Account *it; 168 Account *it;
167 for ( it = list.first(); it; it = list.next() ) 169 for ( it = list.first(); it; it = list.next() )
168 { 170 {
169 if ( it->getType() == MAILLIB::A_SMTP ) 171 if ( it->getType() == MAILLIB::A_SMTP )
170 { 172 {
171 smtp = static_cast<SMTPaccount *>(it); 173 smtp = static_cast<SMTPaccount *>(it);
172 smtpList.append(smtp); 174 smtpList.append(smtp);
173 } 175 }
174 } 176 }
175 if (smtpList.count()==0) 177 if (smtpList.count()==0)
176 { 178 {
177 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 179 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
178 return; 180 return;
179 } 181 }
180 if (smtpList.count()==1) 182 if (smtpList.count()==1)
181 { 183 {
182 smtp = smtpList.at(0); 184 smtp = smtpList.at(0);
183 } 185 }
184 else 186 else
185 { 187 {
186 smtp = 0; 188 smtp = 0;
187 selectsmtp selsmtp; 189 selectsmtp selsmtp;
188 selsmtp.setSelectionlist(&smtpList); 190 selsmtp.setSelectionlist(&smtpList);
189 selsmtp.showMaximized(); 191 selsmtp.showMaximized();
190 if ( selsmtp.exec() == QDialog::Accepted ) 192 if ( selsmtp.exec() == QDialog::Accepted )
191 { 193 {
192 smtp = selsmtp.selected_smtp(); 194 smtp = selsmtp.selected_smtp();
193 } 195 }
194 } 196 }
195 if (smtp) 197 if (smtp)
196 { 198 {
197 SMTPwrapper * wrap = new SMTPwrapper(smtp); 199 SMTPwrapper * wrap = new SMTPwrapper(smtp);
198 if ( wrap->flushOutbox() ) 200 if ( wrap->flushOutbox() )
199 { 201 {
200 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 202 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
201 } 203 }
202 delete wrap; 204 delete wrap;
203 } 205 }
204} 206}
205 207
206void OpieMail::slotSearchMails() 208void OpieMail::slotSearchMails()
207{ 209{
208 qDebug("OpieMail::slotSearchMails():not implemented "); 210 qDebug("OpieMail::slotSearchMails():not implemented ");
209} 211}
210 212
211void OpieMail::slotEditSettings() 213void OpieMail::slotEditSettings()
212{ 214{
213#if 0 215#if 0
214 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 216 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
215 settingsDialog.showMaximized(); 217 settingsDialog.showMaximized();
216 settingsDialog.exec(); 218 settingsDialog.exec();
217#endif 219#endif
218 KOPrefsDialog settingsDialog( this, "koprefs", true ); 220 KOPrefsDialog settingsDialog( this, "koprefs", true );
219 settingsDialog.showMaximized(); 221 settingsDialog.showMaximized();
220 settingsDialog.exec(); 222 settingsDialog.exec();
221} 223}
222 224
223void OpieMail::slotEditAccounts() 225void OpieMail::slotEditAccounts()
224{ 226{
225 EditAccounts eaDialog( settings, this, 0, true ); 227 EditAccounts eaDialog( settings, this, 0, true );
226 eaDialog.slotAdjustColumns(); 228 eaDialog.slotAdjustColumns();
227 eaDialog.showMaximized(); 229 eaDialog.showMaximized();
228 eaDialog.exec(); 230 eaDialog.exec();
229 if ( settings ) delete settings; 231 if ( settings ) delete settings;
230 settings = new Settings(); 232 settings = new Settings();
231 233
232 folderView->populate( settings->getAccounts() ); 234 folderView->populate( settings->getAccounts() );
233} 235}
234 236
235void OpieMail::displayMail() 237void OpieMail::displayMail()
236{ 238{
237 QListViewItem*item = mailView->currentItem(); 239 QListViewItem*item = mailView->currentItem();
238 if (!item) return; 240 if (!item) return;
239 RecMailP mail = ((MailListViewItem*)item)->data(); 241 RecMailP mail = ((MailListViewItem*)item)->data();
240 RecBodyP body = folderView->fetchBody(mail); 242 RecBodyP body = folderView->fetchBody(mail);
241 ViewMail readMail( this,"", Qt::WType_Modal ); 243 ViewMail readMail( this,"", Qt::WType_Modal );
242 readMail.setBody( body ); 244 readMail.setBody( body );
243 readMail.setMail( mail ); 245 readMail.setMail( mail );
244 readMail.showMaximized(); 246 readMail.showMaximized();
245 readMail.exec(); 247 readMail.exec();
246 248
247 if ( readMail.deleted ) 249 if ( readMail.deleted )
248 { 250 {
249 folderView->refreshCurrent(); 251 folderView->refreshCurrent();
250 } 252 }
251 else 253 else
252 { 254 {
253 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 255 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
254 } 256 }
255} 257}
256void OpieMail::slotGetAllMail() 258void OpieMail::slotGetAllMail()
257{ 259{
258 QListViewItem * item = folderView->firstChild(); 260 QListViewItem * item = folderView->firstChild();
259 while ( item ){ 261 while ( item ){
260 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 262 ((AccountViewItem *)item)->contextMenuSelected( 101 );
261 item = item->nextSibling (); 263 item = item->nextSibling ();
262 } 264 }
263} 265}
264void OpieMail::slotGetMail() 266void OpieMail::slotGetMail()
265{ 267{
266 QListViewItem * item = folderView->currentItem(); 268 QListViewItem * item = folderView->currentItem();
267 if ( ! item ) return; 269 if ( ! item ) return;
268 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 270 ((AccountViewItem *)item)->contextMenuSelected( 101 );
269} 271}
270void OpieMail::slotDeleteMail() 272void OpieMail::slotDeleteMail()
271{ 273{
272 if (!mailView->currentItem()) return; 274 if (!mailView->currentItem()) return;
273 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 275 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
274 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 276 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
275 { 277 {
276 mail->Wrapper()->deleteMail( mail ); 278 mail->Wrapper()->deleteMail( mail );
277 folderView->refreshCurrent(); 279 folderView->refreshCurrent();
278 } 280 }
279} 281}
280void OpieMail::slotDeleteAllMail() 282void OpieMail::slotDeleteAllMail()
281{ 283{
282 284
283 QValueList<RecMailP> t; 285 QValueList<RecMailP> t;
284 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 286 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
285 { 287 {
286 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 288 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
287 while ( item ) { 289 while ( item ) {
288 if ( item->isSelected() ) { 290 if ( item->isSelected() ) {
289 t.append( item->data() ); 291 t.append( item->data() );
290 } 292 }
291 item = (MailListViewItem*)item->nextSibling(); 293 item = (MailListViewItem*)item->nextSibling();
292 } 294 }
293 } 295 }
294 else 296 else
295 return; 297 return;
296 if ( t.count() == 0 ) 298 if ( t.count() == 0 )
297 return; 299 return;
298 RecMailP mail = t.first(); 300 RecMailP mail = t.first();
299 mail->Wrapper()->deleteMailList(t); 301 mail->Wrapper()->deleteMailList(t);
300 folderView->refreshCurrent(); 302 folderView->refreshCurrent();
301 303
302 304
303} 305}
304void OpieMail::clearSelection() 306void OpieMail::clearSelection()
305{ 307{
306 mailView->clearSelection(); 308 mailView->clearSelection();
307 309
308} 310}
309 311
310void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 312void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
311{ 313{
312 if (!mailView->currentItem()) return; 314 if (!mailView->currentItem()) return;
313 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 315 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
314 /* just the RIGHT button - or hold on pda */ 316 /* just the RIGHT button - or hold on pda */
315 if (button!=2) {return;} 317 if (button!=2) {return;}
316 if (!item) return; 318 if (!item) return;
317 QPopupMenu *m = new QPopupMenu(0); 319 QPopupMenu *m = new QPopupMenu(0);
318 if (m) 320 if (m)
319 { 321 {
320 if (mailtype==MAILLIB::A_NNTP) { 322 if (mailtype==MAILLIB::A_NNTP) {
321 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 323 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
322 m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 324 m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
323 m->insertSeparator(); 325 m->insertSeparator();
324 m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 326 m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
325 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 327 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
326 } else { 328 } else {
327 if (folderView->currentisDraft()) { 329 if (folderView->currentisDraft()) {
328 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 330 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
329 } 331 }
330 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 332 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
331 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 333 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
332 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 334 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
333 m->insertSeparator(); 335 m->insertSeparator();
334 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 336 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
335 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 337 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
336 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 338 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
337 } 339 }
338 m->setFocus(); 340 m->setFocus();
339 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 341 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
340 delete m; 342 delete m;
341 } 343 }
342} 344}
343 345
344void OpieMail::slotShowFolders( bool show ) 346void OpieMail::slotShowFolders( bool show )
345{ 347{
346 if ( show && folderView->isHidden() ) 348 if ( show && folderView->isHidden() )
347 { 349 {
348 folderView->show(); 350 folderView->show();
349 } 351 }
350 else if ( !show && !folderView->isHidden() ) 352 else if ( !show && !folderView->isHidden() )
351 { 353 {
352 folderView->hide(); 354 folderView->hide();
353 } 355 }
354} 356}
355 357
356void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 358void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
357{ 359{
358 MailListViewItem*item = 0; 360 MailListViewItem*item = 0;
359 mailView->clear(); 361 mailView->clear();
360 362
361 QValueList<RecMailP>::ConstIterator it; 363 QValueList<RecMailP>::ConstIterator it;
362 for (it = list.begin(); it != list.end();++it) 364 for (it = list.begin(); it != list.end();++it)
363 { 365 {
364 item = new MailListViewItem(mailView,item); 366 item = new MailListViewItem(mailView,item);
365 item->storeData((*it)); 367 item->storeData((*it));
366 item->showEntry(); 368 item->showEntry();
367 } 369 }
368} 370}
369 371
370void OpieMail::mailLeftClicked( QListViewItem *item ) 372void OpieMail::mailLeftClicked( QListViewItem *item )
371{ 373{
372 mailView->clearSelection(); 374 mailView->clearSelection();
373 /* just LEFT button - or tap with stylus on pda */ 375 /* just LEFT button - or tap with stylus on pda */
374 //if (button!=1) return; 376 //if (button!=1) return;
375 if (!item) return; 377 if (!item) return;
376 if (folderView->currentisDraft()) { 378 if (folderView->currentisDraft()) {
377 reEditMail(); 379 reEditMail();
378 } else { 380 } else {
379 displayMail(); 381 displayMail();
380 } 382 }
381} 383}
382 384
383void OpieMail::slotMoveCopyMail() 385void OpieMail::slotMoveCopyMail()
384{ 386{
385 if (!mailView->currentItem()) return; 387 if (!mailView->currentItem()) return;
386 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 388 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
387 AbstractMail*targetMail = 0; 389 AbstractMail*targetMail = 0;
388 QString targetFolder = ""; 390 QString targetFolder = "";
389 Selectstore sels; 391 Selectstore sels;
390 folderView->setupFolderselect(&sels); 392 folderView->setupFolderselect(&sels);
391 if (!sels.exec()) return; 393 if (!sels.exec()) return;
392 targetMail = sels.currentMail(); 394 targetMail = sels.currentMail();
393 targetFolder = sels.currentFolder(); 395 targetFolder = sels.currentFolder();
394 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 396 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
395 targetFolder.isEmpty()) 397 targetFolder.isEmpty())
396 { 398 {
397 return; 399 return;
398 } 400 }
399 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 401 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
400 { 402 {
401 QMessageBox::critical(0,tr("Error creating new Folder"), 403 QMessageBox::critical(0,tr("Error creating new Folder"),
402 tr("<center>Error while creating<br>new folder - breaking.</center>")); 404 tr("<center>Error while creating<br>new folder - breaking.</center>"));
403 return; 405 return;
404 } 406 }
405 sels.hide(); 407 sels.hide();
406 qApp->processEvents(); 408 qApp->processEvents();
407 // qDebug("hiding sels "); 409 // qDebug("hiding sels ");
408 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 410 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
409 folderView->refreshCurrent(); 411 folderView->refreshCurrent();
410} 412}
411 413
412void OpieMail::slotMoveCopyAllMail() 414void OpieMail::slotMoveCopyAllMail()
413{ 415{
414 416
415 if (!mailView->currentItem()) return; 417 if (!mailView->currentItem()) return;
416 QValueList<RecMailP> t; 418 QValueList<RecMailP> t;
417 // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 419 // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
418 { 420 {
419 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 421 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
420 while ( item ) { 422 while ( item ) {
421 if ( item->isSelected() ) { 423 if ( item->isSelected() ) {
422 t.append( item->data() ); 424 t.append( item->data() );
423 } 425 }
424 item = (MailListViewItem*)item->nextSibling(); 426 item = (MailListViewItem*)item->nextSibling();
425 } 427 }
426 } 428 }
427 // else 429 // else
428 // return; 430 // return;
429 if ( t.count() == 0 ) 431 if ( t.count() == 0 )
430 return; 432 return;
431 RecMailP mail = t.first(); 433 RecMailP mail = t.first();
432 AbstractMail*targetMail = 0; 434 AbstractMail*targetMail = 0;
433 QString targetFolder = ""; 435 QString targetFolder = "";
434 Selectstore sels; 436 Selectstore sels;
435 folderView->setupFolderselect(&sels); 437 folderView->setupFolderselect(&sels);
436 if (!sels.exec()) return; 438 if (!sels.exec()) return;
437 targetMail = sels.currentMail(); 439 targetMail = sels.currentMail();
438 targetFolder = sels.currentFolder(); 440 targetFolder = sels.currentFolder();
439 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 441 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
440 targetFolder.isEmpty()) 442 targetFolder.isEmpty())
441 { 443 {
442 return; 444 return;
443 } 445 }
444 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 446 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
445 { 447 {
446 QMessageBox::critical(0,tr("Error creating new Folder"), 448 QMessageBox::critical(0,tr("Error creating new Folder"),
447 tr("<center>Error while creating<br>new folder - breaking.</center>")); 449 tr("<center>Error while creating<br>new folder - breaking.</center>"));
448 return; 450 return;
449 } 451 }
450 sels.hide(); 452 sels.hide();
451 qApp->processEvents(); 453 qApp->processEvents();
452 //qDebug("hiding sels "); 454 //qDebug("hiding sels ");
453 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 455 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
454 folderView->refreshCurrent(); 456 folderView->refreshCurrent();
455} 457}
456 458
457void OpieMail::reEditMail() 459void OpieMail::reEditMail()
458{ 460{
459 if (!mailView->currentItem()) return; 461 if (!mailView->currentItem()) return;
460 462
461 ComposeMail compose( settings, this, 0, true ); 463 ComposeMail compose( settings, this, 0, true );
462 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 464 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
463 compose.slotAdjustColumns(); 465 compose.slotAdjustColumns();
464 compose.showMaximized(); 466 compose.showMaximized();
465 compose.exec(); 467 compose.exec();
466} 468}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index bc8625d..3635cfa 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,3616 +1,3620 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Requires the Qt and KDE widget libraries, available at no cost at 4 Requires the Qt and KDE widget libraries, available at no cost at
5 http://www.troll.no and http://www.kde.org respectively 5 http://www.troll.no and http://www.kde.org respectively
6 6
7 Copyright (c) 1997, 1998, 1999 7 Copyright (c) 1997, 1998, 1999
8 Preston Brown (preston.brown@yale.edu) 8 Preston Brown (preston.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h>
66 67
67#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
68#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
69#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
70#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
71#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
72#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
73#include <libkcal/journal.h> 74#include <libkcal/journal.h>
74#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
75#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
76#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
77#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
78#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
79#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
80#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
81#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
82 83
83#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
84#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
85#endif 86#endif
86#include <libkcal/phoneformat.h> 87#include <libkcal/phoneformat.h>
87#ifndef KORG_NOMAIL 88#ifndef KORG_NOMAIL
88#include "komailclient.h" 89#include "komailclient.h"
89#endif 90#endif
90#ifndef KORG_NOPRINTER 91#ifndef KORG_NOPRINTER
91#include "calprinter.h" 92#include "calprinter.h"
92#endif 93#endif
93#ifndef KORG_NOPLUGINS 94#ifndef KORG_NOPLUGINS
94#include "kocore.h" 95#include "kocore.h"
95#endif 96#endif
96#include "koeventeditor.h" 97#include "koeventeditor.h"
97#include "kotodoeditor.h" 98#include "kotodoeditor.h"
98#include "koprefs.h" 99#include "koprefs.h"
99#include "koeventviewerdialog.h" 100#include "koeventviewerdialog.h"
100#include "publishdialog.h" 101#include "publishdialog.h"
101#include "kofilterview.h" 102#include "kofilterview.h"
102#include "koglobals.h" 103#include "koglobals.h"
103#include "koviewmanager.h" 104#include "koviewmanager.h"
104#include "koagendaview.h" 105#include "koagendaview.h"
105#include "kodialogmanager.h" 106#include "kodialogmanager.h"
106#include "outgoingdialog.h" 107#include "outgoingdialog.h"
107#include "incomingdialog.h" 108#include "incomingdialog.h"
108#include "statusdialog.h" 109#include "statusdialog.h"
109#include "kdatenavigator.h" 110#include "kdatenavigator.h"
110#include "kotodoview.h" 111#include "kotodoview.h"
111#include "datenavigator.h" 112#include "datenavigator.h"
112#include "resourceview.h" 113#include "resourceview.h"
113#include "navigatorbar.h" 114#include "navigatorbar.h"
114#include "searchdialog.h" 115#include "searchdialog.h"
115#include "mainwindow.h" 116#include "mainwindow.h"
116 117
117#include "calendarview.h" 118#include "calendarview.h"
118#ifndef DESKTOP_VERSION 119#ifndef DESKTOP_VERSION
119#include <qtopia/alarmserver.h> 120#include <qtopia/alarmserver.h>
120#endif 121#endif
121#ifndef _WIN32_ 122#ifndef _WIN32_
122#include <stdlib.h> 123#include <stdlib.h>
123#include <stdio.h> 124#include <stdio.h>
124#include <unistd.h> 125#include <unistd.h>
125#else 126#else
126#include <qprocess.h> 127#include <qprocess.h>
127#endif 128#endif
128using namespace KOrg; 129using namespace KOrg;
129using namespace KCal; 130using namespace KCal;
130extern int globalFlagBlockAgenda; 131extern int globalFlagBlockAgenda;
131extern int globalFlagBlockStartup; 132extern int globalFlagBlockStartup;
132 133
133 134
134 135
135class KOBeamPrefs : public QDialog 136class KOBeamPrefs : public QDialog
136{ 137{
137 public: 138 public:
138 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 139 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
139 QDialog( parent, name, true ) 140 QDialog( parent, name, true )
140 { 141 {
141 setCaption( i18n("Beam Options") ); 142 setCaption( i18n("Beam Options") );
142 QVBoxLayout* lay = new QVBoxLayout( this ); 143 QVBoxLayout* lay = new QVBoxLayout( this );
143 lay->setSpacing( 3 ); 144 lay->setSpacing( 3 );
144 lay->setMargin( 3 ); 145 lay->setMargin( 3 );
145 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 146 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
146 lay->addWidget( format ); 147 lay->addWidget( format );
147 format->setExclusive ( true ) ; 148 format->setExclusive ( true ) ;
148 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 149 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
149 lay->addWidget( time ); time->setExclusive ( true ) ; 150 lay->addWidget( time ); time->setExclusive ( true ) ;
150 vcal = new QRadioButton(" vCalendar ", format ); 151 vcal = new QRadioButton(" vCalendar ", format );
151 ical = new QRadioButton(" iCalendar ", format ); 152 ical = new QRadioButton(" iCalendar ", format );
152 vcal->setChecked( true ); 153 vcal->setChecked( true );
153 tz = new QRadioButton(i18n(" With timezone "), time ); 154 tz = new QRadioButton(i18n(" With timezone "), time );
154 local = new QRadioButton(i18n(" Local time "), time ); 155 local = new QRadioButton(i18n(" Local time "), time );
155 tz->setChecked( true ); 156 tz->setChecked( true );
156 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 157 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
157 lay->addWidget( ok ); 158 lay->addWidget( ok );
158 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 159 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
159 lay->addWidget( cancel ); 160 lay->addWidget( cancel );
160 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 161 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
161 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 162 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
162 resize( 200, 200 ); 163 resize( 200, 200 );
163 } 164 }
164 165
165 bool beamVcal() { return vcal->isChecked(); } 166 bool beamVcal() { return vcal->isChecked(); }
166 bool beamLocal() { return local->isChecked(); } 167 bool beamLocal() { return local->isChecked(); }
167private: 168private:
168 QRadioButton* vcal, *ical, *local, *tz; 169 QRadioButton* vcal, *ical, *local, *tz;
169}; 170};
170class KOCatPrefs : public QDialog 171class KOCatPrefs : public QDialog
171{ 172{
172 public: 173 public:
173 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 174 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
174 QDialog( parent, name, true ) 175 QDialog( parent, name, true )
175 { 176 {
176 setCaption( i18n("Manage new Categories") ); 177 setCaption( i18n("Manage new Categories") );
177 QVBoxLayout* lay = new QVBoxLayout( this ); 178 QVBoxLayout* lay = new QVBoxLayout( this );
178 lay->setSpacing( 3 ); 179 lay->setSpacing( 3 );
179 lay->setMargin( 3 ); 180 lay->setMargin( 3 );
180 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 181 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
181 lay->addWidget( lab ); 182 lay->addWidget( lab );
182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 183 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
183 lay->addWidget( format ); 184 lay->addWidget( format );
184 format->setExclusive ( true ) ; 185 format->setExclusive ( true ) ;
185 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 186 addCatBut = new QRadioButton(i18n("Add to category list"), format );
186 new QRadioButton(i18n("Remove from Events/Todos"), format ); 187 new QRadioButton(i18n("Remove from Events/Todos"), format );
187 addCatBut->setChecked( true ); 188 addCatBut->setChecked( true );
188 QPushButton * ok = new QPushButton( i18n("OK"), this ); 189 QPushButton * ok = new QPushButton( i18n("OK"), this );
189 lay->addWidget( ok ); 190 lay->addWidget( ok );
190 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 191 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
191 lay->addWidget( cancel ); 192 lay->addWidget( cancel );
192 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 193 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
193 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 194 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
194 resize( 200, 200 ); 195 resize( 200, 200 );
195 } 196 }
196 197
197 bool addCat() { return addCatBut->isChecked(); } 198 bool addCat() { return addCatBut->isChecked(); }
198private: 199private:
199 QRadioButton* addCatBut; 200 QRadioButton* addCatBut;
200}; 201};
201 202
202 203
203 204
204CalendarView::CalendarView( CalendarResources *calendar, 205CalendarView::CalendarView( CalendarResources *calendar,
205 QWidget *parent, const char *name ) 206 QWidget *parent, const char *name )
206 : CalendarViewBase( parent, name ), 207 : CalendarViewBase( parent, name ),
207 mCalendar( calendar ), 208 mCalendar( calendar ),
208 mResourceManager( calendar->resourceManager() ) 209 mResourceManager( calendar->resourceManager() )
209{ 210{
210 211
211 mEventEditor = 0; 212 mEventEditor = 0;
212 mTodoEditor = 0; 213 mTodoEditor = 0;
213 214
214 init(); 215 init();
215} 216}
216 217
217CalendarView::CalendarView( Calendar *calendar, 218CalendarView::CalendarView( Calendar *calendar,
218 QWidget *parent, const char *name ) 219 QWidget *parent, const char *name )
219 : CalendarViewBase( parent, name ), 220 : CalendarViewBase( parent, name ),
220 mCalendar( calendar ), 221 mCalendar( calendar ),
221 mResourceManager( 0 ) 222 mResourceManager( 0 )
222{ 223{
223 224
224 mEventEditor = 0; 225 mEventEditor = 0;
225 mTodoEditor = 0; 226 mTodoEditor = 0;
226 init();} 227 init();}
227 228
228void CalendarView::init() 229void CalendarView::init()
229{ 230{
230 beamDialog = new KOBeamPrefs(); 231 beamDialog = new KOBeamPrefs();
231 mDatePickerMode = 0; 232 mDatePickerMode = 0;
232 mCurrentSyncDevice = ""; 233 mCurrentSyncDevice = "";
233 writeLocale(); 234 writeLocale();
234 mViewManager = new KOViewManager( this ); 235 mViewManager = new KOViewManager( this );
235 mDialogManager = new KODialogManager( this ); 236 mDialogManager = new KODialogManager( this );
236 mEventViewerDialog = 0; 237 mEventViewerDialog = 0;
237 mModified = false; 238 mModified = false;
238 mReadOnly = false; 239 mReadOnly = false;
239 mSelectedIncidence = 0; 240 mSelectedIncidence = 0;
240 mCalPrinter = 0; 241 mCalPrinter = 0;
241 mFilters.setAutoDelete(true); 242 mFilters.setAutoDelete(true);
242 243
243 mCalendar->registerObserver( this ); 244 mCalendar->registerObserver( this );
244 // TODO: Make sure that view is updated, when calendar is changed. 245 // TODO: Make sure that view is updated, when calendar is changed.
245 246
246 mStorage = new FileStorage( mCalendar ); 247 mStorage = new FileStorage( mCalendar );
247 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 248 mNavigator = new DateNavigator( this, "datevav", mViewManager );
248 249
249 QBoxLayout *topLayout = (QBoxLayout*)layout(); 250 QBoxLayout *topLayout = (QBoxLayout*)layout();
250#ifndef KORG_NOSPLITTER 251#ifndef KORG_NOSPLITTER
251 // create the main layout frames. 252 // create the main layout frames.
252 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 253 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
253 topLayout->addWidget(mPanner); 254 topLayout->addWidget(mPanner);
254 255
255 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 256 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
256 "CalendarView::LeftFrame"); 257 "CalendarView::LeftFrame");
257 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 258 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
258 259
259 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 260 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
260 "CalendarView::DateNavigator", QDate::currentDate() ); 261 "CalendarView::DateNavigator", QDate::currentDate() );
261 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 262 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
262 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 263 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
263 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 264 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
264 265
265#ifdef KORG_NORESOURCEVIEW 266#ifdef KORG_NORESOURCEVIEW
266 mResourceView = 0; 267 mResourceView = 0;
267#else 268#else
268 if ( mResourceManager ) { 269 if ( mResourceManager ) {
269 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 270 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
270 mResourceView->updateView(); 271 mResourceView->updateView();
271 connect( mResourceView, SIGNAL( resourcesChanged() ), 272 connect( mResourceView, SIGNAL( resourcesChanged() ),
272 SLOT( updateView() ) ); 273 SLOT( updateView() ) );
273 } else { 274 } else {
274 mResourceView = 0; 275 mResourceView = 0;
275 } 276 }
276#endif 277#endif
277 QWidget *rightBox = new QWidget( mPanner ); 278 QWidget *rightBox = new QWidget( mPanner );
278 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 279 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
279 280
280 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 281 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
281 rightLayout->addWidget( mNavigatorBar ); 282 rightLayout->addWidget( mNavigatorBar );
282 283
283 mRightFrame = new QWidgetStack( rightBox ); 284 mRightFrame = new QWidgetStack( rightBox );
284 rightLayout->addWidget( mRightFrame, 1 ); 285 rightLayout->addWidget( mRightFrame, 1 );
285 286
286 mLeftFrame = mLeftSplitter; 287 mLeftFrame = mLeftSplitter;
287#else 288#else
288 QWidget *mainBox = new QWidget( this ); 289 QWidget *mainBox = new QWidget( this );
289 QWidget *leftFrame = new QWidget( mainBox ); 290 QWidget *leftFrame = new QWidget( mainBox );
290 291
291 QBoxLayout * mainBoxLayout; 292 QBoxLayout * mainBoxLayout;
292 QBoxLayout * leftFrameLayout; 293 QBoxLayout * leftFrameLayout;
293 if ( KOPrefs::instance()->mVerticalScreen ) { 294 if ( KOPrefs::instance()->mVerticalScreen ) {
294 mainBoxLayout = new QVBoxLayout(mainBox); 295 mainBoxLayout = new QVBoxLayout(mainBox);
295 leftFrameLayout = new QHBoxLayout(leftFrame ); 296 leftFrameLayout = new QHBoxLayout(leftFrame );
296 } else { 297 } else {
297 mainBoxLayout = new QHBoxLayout(mainBox); 298 mainBoxLayout = new QHBoxLayout(mainBox);
298 leftFrameLayout = new QVBoxLayout(leftFrame ); 299 leftFrameLayout = new QVBoxLayout(leftFrame );
299 } 300 }
300 topLayout->addWidget( mainBox ); 301 topLayout->addWidget( mainBox );
301 mainBoxLayout->addWidget (leftFrame); 302 mainBoxLayout->addWidget (leftFrame);
302 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 303 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
303 "CalendarView::DateNavigator", QDate::currentDate()); 304 "CalendarView::DateNavigator", QDate::currentDate());
304 // mDateNavigator->blockSignals( true ); 305 // mDateNavigator->blockSignals( true );
305 leftFrameLayout->addWidget( mDateNavigator ); 306 leftFrameLayout->addWidget( mDateNavigator );
306 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 307 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
307 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); 308 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist");
308 309
309 if ( QApplication::desktop()->width() < 480 ) { 310 if ( QApplication::desktop()->width() < 480 ) {
310 leftFrameLayout->addWidget(mFilterView); 311 leftFrameLayout->addWidget(mFilterView);
311 leftFrameLayout->addWidget(mTodoList, 2 ); 312 leftFrameLayout->addWidget(mTodoList, 2 );
312 313
313 } else { 314 } else {
314 leftFrameLayout->addWidget(mTodoList,2 ); 315 leftFrameLayout->addWidget(mTodoList,2 );
315 leftFrameLayout->addWidget(mFilterView ); 316 leftFrameLayout->addWidget(mFilterView );
316 } 317 }
317 mFilterView->hide(); 318 mFilterView->hide();
318 QWidget *rightBox = new QWidget( mainBox ); 319 QWidget *rightBox = new QWidget( mainBox );
319 mainBoxLayout->addWidget ( rightBox, 10 ); 320 mainBoxLayout->addWidget ( rightBox, 10 );
320 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 321 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
321 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 322 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
322 mRightFrame = new QWidgetStack( rightBox ); 323 mRightFrame = new QWidgetStack( rightBox );
323 rightLayout->addWidget( mNavigatorBar ); 324 rightLayout->addWidget( mNavigatorBar );
324 rightLayout->addWidget( mRightFrame, 10 ); 325 rightLayout->addWidget( mRightFrame, 10 );
325 326
326 mLeftFrame = leftFrame; 327 mLeftFrame = leftFrame;
327 if ( KOPrefs::instance()->mVerticalScreen ) { 328 if ( KOPrefs::instance()->mVerticalScreen ) {
328 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 329 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
329 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 330 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
330 } else { 331 } else {
331 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 332 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
332 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 333 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
333 } 334 }
334 335
335 //qDebug("Calendarview Size %d %d ", width(), height()); 336 //qDebug("Calendarview Size %d %d ", width(), height());
336#endif 337#endif
337 338
338 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 339 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
339 SLOT( showDates( const KCal::DateList & ) ) ); 340 SLOT( showDates( const KCal::DateList & ) ) );
340 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 341 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
341 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 342 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
342 343
343 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 344 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
344 mNavigator, SLOT( selectPreviousYear() ) ); 345 mNavigator, SLOT( selectPreviousYear() ) );
345 connect( mNavigatorBar, SIGNAL( goNextYear() ), 346 connect( mNavigatorBar, SIGNAL( goNextYear() ),
346 mNavigator, SLOT( selectNextYear() ) ); 347 mNavigator, SLOT( selectNextYear() ) );
347 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 348 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
348 mNavigator, SLOT( selectPreviousMonth() ) ); 349 mNavigator, SLOT( selectPreviousMonth() ) );
349 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 350 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
350 mNavigator, SLOT( selectNextMonth() ) ); 351 mNavigator, SLOT( selectNextMonth() ) );
351 352
352 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 353 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
353 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 354 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
354 355
355 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 356 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
356 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 357 mNavigator, SLOT( selectWeek( const QDate & ) ) );
357 358
358 connect( mDateNavigator, SIGNAL( goPrevYear() ), 359 connect( mDateNavigator, SIGNAL( goPrevYear() ),
359 mNavigator, SLOT( selectPreviousYear() ) ); 360 mNavigator, SLOT( selectPreviousYear() ) );
360 connect( mDateNavigator, SIGNAL( goNextYear() ), 361 connect( mDateNavigator, SIGNAL( goNextYear() ),
361 mNavigator, SLOT( selectNextYear() ) ); 362 mNavigator, SLOT( selectNextYear() ) );
362 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 363 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
363 mNavigator, SLOT( selectPreviousMonth() ) ); 364 mNavigator, SLOT( selectPreviousMonth() ) );
364 connect( mDateNavigator, SIGNAL( goNextMonth() ), 365 connect( mDateNavigator, SIGNAL( goNextMonth() ),
365 mNavigator, SLOT( selectNextMonth() ) ); 366 mNavigator, SLOT( selectNextMonth() ) );
366 367
367 connect( mDateNavigator, SIGNAL( goPrevious() ), 368 connect( mDateNavigator, SIGNAL( goPrevious() ),
368 mNavigator, SLOT( selectPrevious() ) ); 369 mNavigator, SLOT( selectPrevious() ) );
369 connect( mDateNavigator, SIGNAL( goNext() ), 370 connect( mDateNavigator, SIGNAL( goNext() ),
370 mNavigator, SLOT( selectNext() ) ); 371 mNavigator, SLOT( selectNext() ) );
371 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 372 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
372 mNavigator, SLOT( slotMonthSelect( int ) ) ); 373 mNavigator, SLOT( slotMonthSelect( int ) ) );
373 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 374 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
374 mNavigator, SLOT( slotMonthSelect( int ) ) ); 375 mNavigator, SLOT( slotMonthSelect( int ) ) );
375 376
376 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 377 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
377 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 378 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
378 379
379 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 380 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
380 SLOT( eventAdded( Event *) ) ); 381 SLOT( eventAdded( Event *) ) );
381 382
382 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 383 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
383 384
384 connect( this, SIGNAL( configChanged() ), 385 connect( this, SIGNAL( configChanged() ),
385 mDateNavigator, SLOT( updateConfig() ) ); 386 mDateNavigator, SLOT( updateConfig() ) );
386 387
387 connect( mTodoList, SIGNAL( newTodoSignal() ), 388 connect( mTodoList, SIGNAL( newTodoSignal() ),
388 SLOT( newTodo() ) ); 389 SLOT( newTodo() ) );
389 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 390 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
390 SLOT( newSubTodo( Todo * ) ) ); 391 SLOT( newSubTodo( Todo * ) ) );
391 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 392 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
392 SLOT( editTodo( Todo * ) ) ); 393 SLOT( editTodo( Todo * ) ) );
393 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 394 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
394 SLOT( showTodo( Todo *) ) ); 395 SLOT( showTodo( Todo *) ) );
395 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 396 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
396 SLOT( deleteTodo( Todo *) ) ); 397 SLOT( deleteTodo( Todo *) ) );
397 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 398 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
398 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 399 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
399 SLOT( purgeCompleted() ) ); 400 SLOT( purgeCompleted() ) );
400 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 401 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
401 SIGNAL( todoModified( Todo *, int ) ) ); 402 SIGNAL( todoModified( Todo *, int ) ) );
402 403
403 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 404 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
404 this, SLOT ( cloneIncidence( Incidence * ) ) ); 405 this, SLOT ( cloneIncidence( Incidence * ) ) );
405 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 406 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
406 this, SLOT (cancelIncidence( Incidence * ) ) ); 407 this, SLOT (cancelIncidence( Incidence * ) ) );
407 408
408 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 409 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
409 this, SLOT ( moveIncidence( Incidence * ) ) ); 410 this, SLOT ( moveIncidence( Incidence * ) ) );
410 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 411 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
411 this, SLOT ( beamIncidence( Incidence * ) ) ); 412 this, SLOT ( beamIncidence( Incidence * ) ) );
412 413
413 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 414 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
414 this, SLOT ( todo_unsub( Todo * ) ) ); 415 this, SLOT ( todo_unsub( Todo * ) ) );
415 416
416 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 417 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
417 SLOT( updateTodo( Todo *, int ) ) ); 418 SLOT( updateTodo( Todo *, int ) ) );
418 connect( this, SIGNAL( todoModified( Todo *, int )), this, 419 connect( this, SIGNAL( todoModified( Todo *, int )), this,
419 SLOT( changeTodoDisplay( Todo *, int ) ) ); 420 SLOT( changeTodoDisplay( Todo *, int ) ) );
420 421
421 422
422 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 423 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
423 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 424 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
424 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 425 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
425 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 426 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
426 427
427 428
428 429
429 430
430 431
431 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 432 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
432 SLOT(checkClipboard())); 433 SLOT(checkClipboard()));
433 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 434 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
434 SLOT( processTodoListSelection( Incidence * ) ) ); 435 SLOT( processTodoListSelection( Incidence * ) ) );
435 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 436 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
436 437
437 // kdDebug() << "CalendarView::CalendarView() done" << endl; 438 // kdDebug() << "CalendarView::CalendarView() done" << endl;
438 439
439 mDateFrame = new QVBox(0,0,WType_Popup); 440 mDateFrame = new QVBox(0,0,WType_Popup);
440 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 441 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
441 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 442 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
442 mDateFrame->setLineWidth(3); 443 mDateFrame->setLineWidth(3);
443 mDateFrame->hide(); 444 mDateFrame->hide();
444 mDateFrame->setCaption( i18n( "Pick a date to display")); 445 mDateFrame->setCaption( i18n( "Pick a date to display"));
445 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 446 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
446 447
447 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 448 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
448 449
449 mEventEditor = mDialogManager->getEventEditor(); 450 mEventEditor = mDialogManager->getEventEditor();
450 mTodoEditor = mDialogManager->getTodoEditor(); 451 mTodoEditor = mDialogManager->getTodoEditor();
451 452
452 mFlagEditDescription = false; 453 mFlagEditDescription = false;
453 454
454 mSuspendTimer = new QTimer( this ); 455 mSuspendTimer = new QTimer( this );
455 mAlarmTimer = new QTimer( this ); 456 mAlarmTimer = new QTimer( this );
456 mRecheckAlarmTimer = new QTimer( this ); 457 mRecheckAlarmTimer = new QTimer( this );
457 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 458 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
458 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 459 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
459 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 460 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
460 mAlarmDialog = new AlarmDialog( this ); 461 mAlarmDialog = new AlarmDialog( this );
461 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 462 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
462 mAlarmDialog->setServerNotification( false ); 463 mAlarmDialog->setServerNotification( false );
463 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 464 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
464} 465}
465 466
466 467
467CalendarView::~CalendarView() 468CalendarView::~CalendarView()
468{ 469{
469 // kdDebug() << "~CalendarView()" << endl; 470 // kdDebug() << "~CalendarView()" << endl;
470 //qDebug("CalendarView::~CalendarView() "); 471 //qDebug("CalendarView::~CalendarView() ");
471 delete mDialogManager; 472 delete mDialogManager;
472 delete mViewManager; 473 delete mViewManager;
473 delete mStorage; 474 delete mStorage;
474 delete mDateFrame ; 475 delete mDateFrame ;
475 delete beamDialog; 476 delete beamDialog;
476 //kdDebug() << "~CalendarView() done" << endl; 477 //kdDebug() << "~CalendarView() done" << endl;
477} 478}
478void CalendarView::timerAlarm() 479void CalendarView::timerAlarm()
479{ 480{
480 //qDebug("CalendarView::timerAlarm() "); 481 //qDebug("CalendarView::timerAlarm() ");
481 computeAlarm(mAlarmNotification ); 482 computeAlarm(mAlarmNotification );
482} 483}
483 484
484void CalendarView::suspendAlarm() 485void CalendarView::suspendAlarm()
485{ 486{
486 //qDebug(" CalendarView::suspendAlarm() "); 487 //qDebug(" CalendarView::suspendAlarm() ");
487 computeAlarm(mSuspendAlarmNotification ); 488 computeAlarm(mSuspendAlarmNotification );
488 489
489} 490}
490 491
491void CalendarView::startAlarm( QString mess , QString filename) 492void CalendarView::startAlarm( QString mess , QString filename)
492{ 493{
493 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 494 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
494 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 495 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
495 496
496} 497}
497 498
498void CalendarView::checkNextTimerAlarm() 499void CalendarView::checkNextTimerAlarm()
499{ 500{
500 mCalendar->checkAlarmForIncidence( 0, true ); 501 mCalendar->checkAlarmForIncidence( 0, true );
501} 502}
502 503
503void CalendarView::computeAlarm( QString msg ) 504void CalendarView::computeAlarm( QString msg )
504{ 505{
505 506
506 QString mess = msg; 507 QString mess = msg;
507 QString mAlarmMessage = mess.mid( 9 ); 508 QString mAlarmMessage = mess.mid( 9 );
508 QString filename = MainWindow::resourcePath(); 509 QString filename = MainWindow::resourcePath();
509 filename += "koalarm.wav"; 510 filename += "koalarm.wav";
510 QString tempfilename; 511 QString tempfilename;
511 if ( mess.left( 13 ) == "suspend_alarm") { 512 if ( mess.left( 13 ) == "suspend_alarm") {
512 bool error = false; 513 bool error = false;
513 int len = mess.mid( 13 ).find("+++"); 514 int len = mess.mid( 13 ).find("+++");
514 if ( len < 2 ) 515 if ( len < 2 )
515 error = true; 516 error = true;
516 else { 517 else {
517 tempfilename = mess.mid( 13, len ); 518 tempfilename = mess.mid( 13, len );
518 if ( !QFile::exists( tempfilename ) ) 519 if ( !QFile::exists( tempfilename ) )
519 error = true; 520 error = true;
520 } 521 }
521 if ( ! error ) { 522 if ( ! error ) {
522 filename = tempfilename; 523 filename = tempfilename;
523 } 524 }
524 mAlarmMessage = mess.mid( 13+len+3 ); 525 mAlarmMessage = mess.mid( 13+len+3 );
525 //qDebug("suspend file %s ",tempfilename.latin1() ); 526 //qDebug("suspend file %s ",tempfilename.latin1() );
526 startAlarm( mAlarmMessage, filename); 527 startAlarm( mAlarmMessage, filename);
527 return; 528 return;
528 } 529 }
529 if ( mess.left( 11 ) == "timer_alarm") { 530 if ( mess.left( 11 ) == "timer_alarm") {
530 //mTimerTime = 0; 531 //mTimerTime = 0;
531 startAlarm( mess.mid( 11 ), filename ); 532 startAlarm( mess.mid( 11 ), filename );
532 return; 533 return;
533 } 534 }
534 if ( mess.left( 10 ) == "proc_alarm") { 535 if ( mess.left( 10 ) == "proc_alarm") {
535 bool error = false; 536 bool error = false;
536 int len = mess.mid( 10 ).find("+++"); 537 int len = mess.mid( 10 ).find("+++");
537 if ( len < 2 ) 538 if ( len < 2 )
538 error = true; 539 error = true;
539 else { 540 else {
540 tempfilename = mess.mid( 10, len ); 541 tempfilename = mess.mid( 10, len );
541 if ( !QFile::exists( tempfilename ) ) 542 if ( !QFile::exists( tempfilename ) )
542 error = true; 543 error = true;
543 } 544 }
544 if ( error ) { 545 if ( error ) {
545 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 546 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
546 mAlarmMessage += mess.mid( 10+len+3+9 ); 547 mAlarmMessage += mess.mid( 10+len+3+9 );
547 } else { 548 } else {
548 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 549 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
549 //qDebug("-----system command %s ",tempfilename.latin1() ); 550 //qDebug("-----system command %s ",tempfilename.latin1() );
550#ifndef _WIN32_ 551#ifndef _WIN32_
551 if ( vfork () == 0 ) { 552 if ( vfork () == 0 ) {
552 execl ( tempfilename.latin1(), 0 ); 553 execl ( tempfilename.latin1(), 0 );
553 return; 554 return;
554 } 555 }
555#else 556#else
556 QProcess* p = new QProcess(); 557 QProcess* p = new QProcess();
557 p->addArgument( tempfilename.latin1() ); 558 p->addArgument( tempfilename.latin1() );
558 p->start(); 559 p->start();
559 return; 560 return;
560#endif 561#endif
561 562
562 return; 563 return;
563 } 564 }
564 565
565 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 566 //qDebug("+++++++system command %s ",tempfilename.latin1() );
566 } 567 }
567 if ( mess.left( 11 ) == "audio_alarm") { 568 if ( mess.left( 11 ) == "audio_alarm") {
568 bool error = false; 569 bool error = false;
569 int len = mess.mid( 11 ).find("+++"); 570 int len = mess.mid( 11 ).find("+++");
570 if ( len < 2 ) 571 if ( len < 2 )
571 error = true; 572 error = true;
572 else { 573 else {
573 tempfilename = mess.mid( 11, len ); 574 tempfilename = mess.mid( 11, len );
574 if ( !QFile::exists( tempfilename ) ) 575 if ( !QFile::exists( tempfilename ) )
575 error = true; 576 error = true;
576 } 577 }
577 if ( ! error ) { 578 if ( ! error ) {
578 filename = tempfilename; 579 filename = tempfilename;
579 } 580 }
580 mAlarmMessage = mess.mid( 11+len+3+9 ); 581 mAlarmMessage = mess.mid( 11+len+3+9 );
581 //qDebug("audio file command %s ",tempfilename.latin1() ); 582 //qDebug("audio file command %s ",tempfilename.latin1() );
582 } 583 }
583 if ( mess.left( 9 ) == "cal_alarm") { 584 if ( mess.left( 9 ) == "cal_alarm") {
584 mAlarmMessage = mess.mid( 9 ) ; 585 mAlarmMessage = mess.mid( 9 ) ;
585 } 586 }
586 587
587 startAlarm( mAlarmMessage, filename ); 588 startAlarm( mAlarmMessage, filename );
588 589
589 590
590} 591}
591 592
592void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 593void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
593{ 594{
594 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 595 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
595 596
596 mSuspendAlarmNotification = noti; 597 mSuspendAlarmNotification = noti;
597 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 598 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
598 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 599 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
599 mSuspendTimer->start( ms , true ); 600 mSuspendTimer->start( ms , true );
600 601
601} 602}
602 603
603void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 604void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
604{ 605{
605 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 606 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
606 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 607 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
607#ifndef DESKTOP_VERSION 608#ifndef DESKTOP_VERSION
608 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 609 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
609#endif 610#endif
610 return; 611 return;
611 } 612 }
612 int maxSec; 613 int maxSec;
613 //maxSec = 5; //testing only 614 //maxSec = 5; //testing only
614 maxSec = 86400+3600; // one day+1hour 615 maxSec = 86400+3600; // one day+1hour
615 mAlarmNotification = noti; 616 mAlarmNotification = noti;
616 int sec = QDateTime::currentDateTime().secsTo( qdt ); 617 int sec = QDateTime::currentDateTime().secsTo( qdt );
617 if ( sec > maxSec ) { 618 if ( sec > maxSec ) {
618 mRecheckAlarmTimer->start( maxSec * 1000 ); 619 mRecheckAlarmTimer->start( maxSec * 1000 );
619 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 620 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
620 return; 621 return;
621 } else { 622 } else {
622 mRecheckAlarmTimer->stop(); 623 mRecheckAlarmTimer->stop();
623 } 624 }
624 //qDebug("Alarm timer started with secs: %d ", sec); 625 //qDebug("Alarm timer started with secs: %d ", sec);
625 mAlarmTimer->start( sec *1000 , true ); 626 mAlarmTimer->start( sec *1000 , true );
626 627
627} 628}
628// called by mRecheckAlarmTimer to get next alarm 629// called by mRecheckAlarmTimer to get next alarm
629// we need this, because a QTimer has only a max range of 25 days 630// we need this, because a QTimer has only a max range of 25 days
630void CalendarView::recheckTimerAlarm() 631void CalendarView::recheckTimerAlarm()
631{ 632{
632 mAlarmTimer->stop(); 633 mAlarmTimer->stop();
633 mRecheckAlarmTimer->stop(); 634 mRecheckAlarmTimer->stop();
634 mCalendar->checkAlarmForIncidence( 0, true ); 635 mCalendar->checkAlarmForIncidence( 0, true );
635} 636}
636void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 637void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
637{ 638{
638 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 639 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
639 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 640 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
640#ifndef DESKTOP_VERSION 641#ifndef DESKTOP_VERSION
641 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 642 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
642#endif 643#endif
643 return; 644 return;
644 } 645 }
645 mAlarmTimer->stop(); 646 mAlarmTimer->stop();
646} 647}
647void CalendarView::selectWeekNum ( int num ) 648void CalendarView::selectWeekNum ( int num )
648{ 649{
649 dateNavigator()->selectWeek( num ); 650 dateNavigator()->selectWeek( num );
650 mViewManager->showWeekView(); 651 mViewManager->showWeekView();
651} 652}
652KOViewManager *CalendarView::viewManager() 653KOViewManager *CalendarView::viewManager()
653{ 654{
654 return mViewManager; 655 return mViewManager;
655} 656}
656 657
657KODialogManager *CalendarView::dialogManager() 658KODialogManager *CalendarView::dialogManager()
658{ 659{
659 return mDialogManager; 660 return mDialogManager;
660} 661}
661 662
662QDate CalendarView::startDate() 663QDate CalendarView::startDate()
663{ 664{
664 DateList dates = mNavigator->selectedDates(); 665 DateList dates = mNavigator->selectedDates();
665 666
666 return dates.first(); 667 return dates.first();
667} 668}
668 669
669QDate CalendarView::endDate() 670QDate CalendarView::endDate()
670{ 671{
671 DateList dates = mNavigator->selectedDates(); 672 DateList dates = mNavigator->selectedDates();
672 673
673 return dates.last(); 674 return dates.last();
674} 675}
675 676
676 677
677void CalendarView::createPrinter() 678void CalendarView::createPrinter()
678{ 679{
679#ifndef KORG_NOPRINTER 680#ifndef KORG_NOPRINTER
680 if (!mCalPrinter) { 681 if (!mCalPrinter) {
681 mCalPrinter = new CalPrinter(this, mCalendar); 682 mCalPrinter = new CalPrinter(this, mCalendar);
682 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 683 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
683 } 684 }
684#endif 685#endif
685} 686}
686 687
687void CalendarView::confSync() 688void CalendarView::confSync()
688{ 689{
689 static KSyncPrefsDialog* sp = 0; 690 static KSyncPrefsDialog* sp = 0;
690 if ( ! sp ) { 691 if ( ! sp ) {
691 sp = new KSyncPrefsDialog( this, "syncprefs", true ); 692 sp = new KSyncPrefsDialog( this, "syncprefs", true );
692 } 693 }
693 sp->usrReadConfig(); 694 sp->usrReadConfig();
694#ifndef DESKTOP_VERSION 695#ifndef DESKTOP_VERSION
695 sp->showMaximized(); 696 sp->showMaximized();
696#else 697#else
697 sp->show(); 698 sp->show();
698#endif 699#endif
699 sp->exec(); 700 sp->exec();
700 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); 701 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
701 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); 702 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
702} 703}
703 704
704 705
705//KOPrefs::instance()->mWriteBackFile 706//KOPrefs::instance()->mWriteBackFile
706//KOPrefs::instance()->mWriteBackExistingOnly 707//KOPrefs::instance()->mWriteBackExistingOnly
707 708
708// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 709// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
709// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 710// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
710// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 711// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
711// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 712// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
712// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 713// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
713// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 714// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
714 715
715int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 716int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
716{ 717{
717 718
718 //void setZaurusId(int id); 719 //void setZaurusId(int id);
719 // int zaurusId() const; 720 // int zaurusId() const;
720 // void setZaurusUid(int id); 721 // void setZaurusUid(int id);
721 // int zaurusUid() const; 722 // int zaurusUid() const;
722 // void setZaurusStat(int id); 723 // void setZaurusStat(int id);
723 // int zaurusStat() const; 724 // int zaurusStat() const;
724 // 0 equal 725 // 0 equal
725 // 1 take local 726 // 1 take local
726 // 2 take remote 727 // 2 take remote
727 // 3 cancel 728 // 3 cancel
728 QDateTime lastSync = mLastCalendarSync; 729 QDateTime lastSync = mLastCalendarSync;
729 QDateTime localMod = local->lastModified(); 730 QDateTime localMod = local->lastModified();
730 QDateTime remoteMod = remote->lastModified(); 731 QDateTime remoteMod = remote->lastModified();
731 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 732 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
732 bool remCh, locCh; 733 bool remCh, locCh;
733 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 734 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
734 //if ( remCh ) 735 //if ( remCh )
735 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 736 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
736 locCh = ( localMod > mLastCalendarSync ); 737 locCh = ( localMod > mLastCalendarSync );
737 if ( !remCh && ! locCh ) { 738 if ( !remCh && ! locCh ) {
738 //qDebug("both not changed "); 739 //qDebug("both not changed ");
739 lastSync = localMod.addDays(1); 740 lastSync = localMod.addDays(1);
740 if ( mode <= SYNC_PREF_ASK ) 741 if ( mode <= SYNC_PREF_ASK )
741 return 0; 742 return 0;
742 } else { 743 } else {
743 if ( locCh ) { 744 if ( locCh ) {
744 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 745 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
745 lastSync = localMod.addDays( -1 ); 746 lastSync = localMod.addDays( -1 );
746 if ( !remCh ) 747 if ( !remCh )
747 remoteMod = ( lastSync.addDays( -1 ) ); 748 remoteMod = ( lastSync.addDays( -1 ) );
748 } else { 749 } else {
749 //qDebug(" not loc changed "); 750 //qDebug(" not loc changed ");
750 lastSync = localMod.addDays( 1 ); 751 lastSync = localMod.addDays( 1 );
751 if ( remCh ) 752 if ( remCh )
752 remoteMod =( lastSync.addDays( 1 ) ); 753 remoteMod =( lastSync.addDays( 1 ) );
753 754
754 } 755 }
755 } 756 }
756 full = true; 757 full = true;
757 if ( mode < SYNC_PREF_ASK ) 758 if ( mode < SYNC_PREF_ASK )
758 mode = SYNC_PREF_ASK; 759 mode = SYNC_PREF_ASK;
759 } else { 760 } else {
760 if ( localMod == remoteMod ) 761 if ( localMod == remoteMod )
761 if ( local->revision() == remote->revision() ) 762 if ( local->revision() == remote->revision() )
762 return 0; 763 return 0;
763 764
764 } 765 }
765 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 766 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
766 767
767 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 768 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
768 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 769 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
769 //full = true; //debug only 770 //full = true; //debug only
770 if ( full ) { 771 if ( full ) {
771 bool equ = false; 772 bool equ = false;
772 if ( local->type() == "Event" ) { 773 if ( local->type() == "Event" ) {
773 equ = (*((Event*) local) == *((Event*) remote)); 774 equ = (*((Event*) local) == *((Event*) remote));
774 } 775 }
775 else if ( local->type() =="Todo" ) 776 else if ( local->type() =="Todo" )
776 equ = (*((Todo*) local) == (*(Todo*) remote)); 777 equ = (*((Todo*) local) == (*(Todo*) remote));
777 else if ( local->type() =="Journal" ) 778 else if ( local->type() =="Journal" )
778 equ = (*((Journal*) local) == *((Journal*) remote)); 779 equ = (*((Journal*) local) == *((Journal*) remote));
779 if ( equ ) { 780 if ( equ ) {
780 //qDebug("equal "); 781 //qDebug("equal ");
781 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 782 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
782 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 783 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
783 } 784 }
784 if ( mode < SYNC_PREF_FORCE_LOCAL ) 785 if ( mode < SYNC_PREF_FORCE_LOCAL )
785 return 0; 786 return 0;
786 787
787 }//else //debug only 788 }//else //debug only
788 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 789 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
789 } 790 }
790 int result; 791 int result;
791 bool localIsNew; 792 bool localIsNew;
792 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 793 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
793 794
794 if ( full && mode < SYNC_PREF_NEWEST ) 795 if ( full && mode < SYNC_PREF_NEWEST )
795 mode = SYNC_PREF_ASK; 796 mode = SYNC_PREF_ASK;
796 797
797 switch( mode ) { 798 switch( mode ) {
798 case SYNC_PREF_LOCAL: 799 case SYNC_PREF_LOCAL:
799 if ( lastSync > remoteMod ) 800 if ( lastSync > remoteMod )
800 return 1; 801 return 1;
801 if ( lastSync > localMod ) 802 if ( lastSync > localMod )
802 return 2; 803 return 2;
803 return 1; 804 return 1;
804 break; 805 break;
805 case SYNC_PREF_REMOTE: 806 case SYNC_PREF_REMOTE:
806 if ( lastSync > remoteMod ) 807 if ( lastSync > remoteMod )
807 return 1; 808 return 1;
808 if ( lastSync > localMod ) 809 if ( lastSync > localMod )
809 return 2; 810 return 2;
810 return 2; 811 return 2;
811 break; 812 break;
812 case SYNC_PREF_NEWEST: 813 case SYNC_PREF_NEWEST:
813 if ( localMod > remoteMod ) 814 if ( localMod > remoteMod )
814 return 1; 815 return 1;
815 else 816 else
816 return 2; 817 return 2;
817 break; 818 break;
818 case SYNC_PREF_ASK: 819 case SYNC_PREF_ASK:
819 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 820 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
820 if ( lastSync > remoteMod ) 821 if ( lastSync > remoteMod )
821 return 1; 822 return 1;
822 if ( lastSync > localMod ) 823 if ( lastSync > localMod )
823 return 2; 824 return 2;
824 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 825 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
825 localIsNew = localMod >= remoteMod; 826 localIsNew = localMod >= remoteMod;
826 if ( localIsNew ) 827 if ( localIsNew )
827 getEventViewerDialog()->setColorMode( 1 ); 828 getEventViewerDialog()->setColorMode( 1 );
828 else 829 else
829 getEventViewerDialog()->setColorMode( 2 ); 830 getEventViewerDialog()->setColorMode( 2 );
830 getEventViewerDialog()->setIncidence(local); 831 getEventViewerDialog()->setIncidence(local);
831 if ( localIsNew ) 832 if ( localIsNew )
832 getEventViewerDialog()->setColorMode( 2 ); 833 getEventViewerDialog()->setColorMode( 2 );
833 else 834 else
834 getEventViewerDialog()->setColorMode( 1 ); 835 getEventViewerDialog()->setColorMode( 1 );
835 getEventViewerDialog()->addIncidence(remote); 836 getEventViewerDialog()->addIncidence(remote);
836 getEventViewerDialog()->setColorMode( 0 ); 837 getEventViewerDialog()->setColorMode( 0 );
837 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 838 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
838 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 839 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
839 getEventViewerDialog()->showMe(); 840 getEventViewerDialog()->showMe();
840 result = getEventViewerDialog()->executeS( localIsNew ); 841 result = getEventViewerDialog()->executeS( localIsNew );
841 return result; 842 return result;
842 843
843 break; 844 break;
844 case SYNC_PREF_FORCE_LOCAL: 845 case SYNC_PREF_FORCE_LOCAL:
845 return 1; 846 return 1;
846 break; 847 break;
847 case SYNC_PREF_FORCE_REMOTE: 848 case SYNC_PREF_FORCE_REMOTE:
848 return 2; 849 return 2;
849 break; 850 break;
850 851
851 default: 852 default:
852 // SYNC_PREF_TAKE_BOTH not implemented 853 // SYNC_PREF_TAKE_BOTH not implemented
853 break; 854 break;
854 } 855 }
855 return 0; 856 return 0;
856} 857}
857Event* CalendarView::getLastSyncEvent() 858Event* CalendarView::getLastSyncEvent()
858{ 859{
859 Event* lse; 860 Event* lse;
860 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 861 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
861 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 862 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
862 if (!lse) { 863 if (!lse) {
863 lse = new Event(); 864 lse = new Event();
864 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 865 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
865 QString sum = ""; 866 QString sum = "";
866 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 867 if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
867 sum = "E: "; 868 sum = "E: ";
868 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 869 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
869 lse->setDtStart( mLastCalendarSync ); 870 lse->setDtStart( mLastCalendarSync );
870 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 871 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
871 lse->setCategories( i18n("SyncEvent") ); 872 lse->setCategories( i18n("SyncEvent") );
872 lse->setReadOnly( true ); 873 lse->setReadOnly( true );
873 mCalendar->addEvent( lse ); 874 mCalendar->addEvent( lse );
874 } 875 }
875 876
876 return lse; 877 return lse;
877 878
878} 879}
879// probaly useless 880// probaly useless
880void CalendarView::setupExternSyncProfiles() 881void CalendarView::setupExternSyncProfiles()
881{ 882{
882 Event* lse; 883 Event* lse;
883 mExternLastSyncEvent.clear(); 884 mExternLastSyncEvent.clear();
884 int i; 885 int i;
885 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { 886 for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) {
886 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); 887 lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] );
887 if ( lse ) 888 if ( lse )
888 mExternLastSyncEvent.append( lse ); 889 mExternLastSyncEvent.append( lse );
889 else 890 else
890 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); 891 qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1());
891 } 892 }
892 893
893} 894}
894// we check, if the to delete event has a id for a profile 895// we check, if the to delete event has a id for a profile
895// if yes, we set this id in the profile to delete 896// if yes, we set this id in the profile to delete
896void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 897void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
897{ 898{
898 if ( lastSync.count() == 0 ) { 899 if ( lastSync.count() == 0 ) {
899 //qDebug(" lastSync.count() == 0"); 900 //qDebug(" lastSync.count() == 0");
900 return; 901 return;
901 } 902 }
902 if ( toDelete->type() == "Journal" ) 903 if ( toDelete->type() == "Journal" )
903 return; 904 return;
904 905
905 Event* eve = lastSync.first(); 906 Event* eve = lastSync.first();
906 907
907 while ( eve ) { 908 while ( eve ) {
908 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 909 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
909 if ( !id.isEmpty() ) { 910 if ( !id.isEmpty() ) {
910 QString des = eve->description(); 911 QString des = eve->description();
911 QString pref = "e"; 912 QString pref = "e";
912 if ( toDelete->type() == "Todo" ) 913 if ( toDelete->type() == "Todo" )
913 pref = "t"; 914 pref = "t";
914 des += pref+ id + ","; 915 des += pref+ id + ",";
915 eve->setReadOnly( false ); 916 eve->setReadOnly( false );
916 eve->setDescription( des ); 917 eve->setDescription( des );
917 //qDebug("setdes %s ", des.latin1()); 918 //qDebug("setdes %s ", des.latin1());
918 eve->setReadOnly( true ); 919 eve->setReadOnly( true );
919 } 920 }
920 eve = lastSync.next(); 921 eve = lastSync.next();
921 } 922 }
922 923
923} 924}
924void CalendarView::checkExternalId( Incidence * inc ) 925void CalendarView::checkExternalId( Incidence * inc )
925{ 926{
926 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 927 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
927 checkExternSyncEvent( lastSync, inc ); 928 checkExternSyncEvent( lastSync, inc );
928 929
929} 930}
930bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 931bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
931{ 932{
932 bool syncOK = true; 933 bool syncOK = true;
933 int addedEvent = 0; 934 int addedEvent = 0;
934 int addedEventR = 0; 935 int addedEventR = 0;
935 int deletedEventR = 0; 936 int deletedEventR = 0;
936 int deletedEventL = 0; 937 int deletedEventL = 0;
937 int changedLocal = 0; 938 int changedLocal = 0;
938 int changedRemote = 0; 939 int changedRemote = 0;
939 //QPtrList<Event> el = local->rawEvents(); 940 //QPtrList<Event> el = local->rawEvents();
940 Event* eventR; 941 Event* eventR;
941 QString uid; 942 QString uid;
942 int take; 943 int take;
943 Event* eventL; 944 Event* eventL;
944 Event* eventRSync; 945 Event* eventRSync;
945 Event* eventLSync; 946 Event* eventLSync;
946 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 947 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
947 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 948 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
948 bool fullDateRange = false; 949 bool fullDateRange = false;
949 local->resetTempSyncStat(); 950 local->resetTempSyncStat();
950 mLastCalendarSync = QDateTime::currentDateTime(); 951 mLastCalendarSync = QDateTime::currentDateTime();
951 QDateTime modifiedCalendar = mLastCalendarSync;; 952 QDateTime modifiedCalendar = mLastCalendarSync;;
952 eventLSync = getLastSyncEvent(); 953 eventLSync = getLastSyncEvent();
953 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 954 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
954 if ( eventR ) { 955 if ( eventR ) {
955 eventRSync = (Event*) eventR->clone(); 956 eventRSync = (Event*) eventR->clone();
956 remote->deleteEvent(eventR ); 957 remote->deleteEvent(eventR );
957 958
958 } else { 959 } else {
959 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 960 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
960 eventRSync = (Event*)eventLSync->clone(); 961 eventRSync = (Event*)eventLSync->clone();
961 } else { 962 } else {
962 fullDateRange = true; 963 fullDateRange = true;
963 eventRSync = new Event(); 964 eventRSync = new Event();
964 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 965 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
965 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 966 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
966 eventRSync->setDtStart( mLastCalendarSync ); 967 eventRSync->setDtStart( mLastCalendarSync );
967 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 968 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
968 eventRSync->setCategories( i18n("SyncEvent") ); 969 eventRSync->setCategories( i18n("SyncEvent") );
969 } 970 }
970 } 971 }
971 if ( eventLSync->dtStart() == mLastCalendarSync ) 972 if ( eventLSync->dtStart() == mLastCalendarSync )
972 fullDateRange = true; 973 fullDateRange = true;
973 974
974 if ( ! fullDateRange ) { 975 if ( ! fullDateRange ) {
975 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 976 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
976 977
977 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 978 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
978 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 979 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
979 fullDateRange = true; 980 fullDateRange = true;
980 } 981 }
981 } 982 }
982 if ( fullDateRange ) 983 if ( fullDateRange )
983 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 984 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
984 else 985 else
985 mLastCalendarSync = eventLSync->dtStart(); 986 mLastCalendarSync = eventLSync->dtStart();
986 // for resyncing if own file has changed 987 // for resyncing if own file has changed
987 if ( mCurrentSyncDevice == "deleteaftersync" ) { 988 if ( mCurrentSyncDevice == "deleteaftersync" ) {
988 mLastCalendarSync = loadedFileVersion; 989 mLastCalendarSync = loadedFileVersion;
989 qDebug("setting mLastCalendarSync "); 990 qDebug("setting mLastCalendarSync ");
990 } 991 }
991 //qDebug("*************************** "); 992 //qDebug("*************************** ");
992 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); 993 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() );
993 QPtrList<Incidence> er = remote->rawIncidences(); 994 QPtrList<Incidence> er = remote->rawIncidences();
994 Incidence* inR = er.first(); 995 Incidence* inR = er.first();
995 Incidence* inL; 996 Incidence* inL;
996 QProgressBar bar( er.count(),0 ); 997 QProgressBar bar( er.count(),0 );
997 bar.setCaption (i18n("Syncing - close to abort!") ); 998 bar.setCaption (i18n("Syncing - close to abort!") );
998 999
999 int w = 300; 1000 int w = 300;
1000 if ( QApplication::desktop()->width() < 320 ) 1001 if ( QApplication::desktop()->width() < 320 )
1001 w = 220; 1002 w = 220;
1002 int h = bar.sizeHint().height() ; 1003 int h = bar.sizeHint().height() ;
1003 int dw = QApplication::desktop()->width(); 1004 int dw = QApplication::desktop()->width();
1004 int dh = QApplication::desktop()->height(); 1005 int dh = QApplication::desktop()->height();
1005 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1006 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1006 bar.show(); 1007 bar.show();
1007 int modulo = (er.count()/10)+1; 1008 int modulo = (er.count()/10)+1;
1008 int incCounter = 0; 1009 int incCounter = 0;
1009 while ( inR ) { 1010 while ( inR ) {
1010 if ( ! bar.isVisible() ) 1011 if ( ! bar.isVisible() )
1011 return false; 1012 return false;
1012 if ( incCounter % modulo == 0 ) 1013 if ( incCounter % modulo == 0 )
1013 bar.setProgress( incCounter ); 1014 bar.setProgress( incCounter );
1014 ++incCounter; 1015 ++incCounter;
1015 uid = inR->uid(); 1016 uid = inR->uid();
1016 bool skipIncidence = false; 1017 bool skipIncidence = false;
1017 if ( uid.left(15) == QString("last-syncEvent-") ) 1018 if ( uid.left(15) == QString("last-syncEvent-") )
1018 skipIncidence = true; 1019 skipIncidence = true;
1019 QString idS; 1020 QString idS;
1020 qApp->processEvents(); 1021 qApp->processEvents();
1021 if ( !skipIncidence ) { 1022 if ( !skipIncidence ) {
1022 inL = local->incidence( uid ); 1023 inL = local->incidence( uid );
1023 if ( inL ) { // maybe conflict - same uid in both calendars 1024 if ( inL ) { // maybe conflict - same uid in both calendars
1024 int maxrev = inL->revision(); 1025 int maxrev = inL->revision();
1025 if ( maxrev < inR->revision() ) 1026 if ( maxrev < inR->revision() )
1026 maxrev = inR->revision(); 1027 maxrev = inR->revision();
1027 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1028 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1028 //qDebug("take %d %s ", take, inL->summary().latin1()); 1029 //qDebug("take %d %s ", take, inL->summary().latin1());
1029 if ( take == 3 ) 1030 if ( take == 3 )
1030 return false; 1031 return false;
1031 if ( take == 1 ) {// take local 1032 if ( take == 1 ) {// take local
1032 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1033 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1033 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1034 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1034 else 1035 else
1035 idS = inR->IDStr(); 1036 idS = inR->IDStr();
1036 remote->deleteIncidence( inR ); 1037 remote->deleteIncidence( inR );
1037 if ( inL->revision() < maxrev ) 1038 if ( inL->revision() < maxrev )
1038 inL->setRevision( maxrev ); 1039 inL->setRevision( maxrev );
1039 inR = inL->clone(); 1040 inR = inL->clone();
1040 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1041 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1041 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1042 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1042 inR->setIDStr( idS ); 1043 inR->setIDStr( idS );
1043 remote->addIncidence( inR ); 1044 remote->addIncidence( inR );
1044 ++changedRemote; 1045 ++changedRemote;
1045 } else { 1046 } else {
1046 if ( inR->revision() < maxrev ) 1047 if ( inR->revision() < maxrev )
1047 inR->setRevision( maxrev ); 1048 inR->setRevision( maxrev );
1048 idS = inL->IDStr(); 1049 idS = inL->IDStr();
1049 local->deleteIncidence( inL ); 1050 local->deleteIncidence( inL );
1050 inL = inR->clone(); 1051 inL = inR->clone();
1051 inL->setIDStr( idS ); 1052 inL->setIDStr( idS );
1052 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1053 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1053 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1054 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1054 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1055 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1055 } 1056 }
1056 local->addIncidence( inL ); 1057 local->addIncidence( inL );
1057 ++changedLocal; 1058 ++changedLocal;
1058 } 1059 }
1059 } 1060 }
1060 } else { // no conflict 1061 } else { // no conflict
1061 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1062 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1062 QString des = eventLSync->description(); 1063 QString des = eventLSync->description();
1063 QString pref = "e"; 1064 QString pref = "e";
1064 if ( inR->type() == "Todo" ) 1065 if ( inR->type() == "Todo" )
1065 pref = "t"; 1066 pref = "t";
1066 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1067 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1067 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1068 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1068 //remote->deleteIncidence( inR ); 1069 //remote->deleteIncidence( inR );
1069 ++deletedEventR; 1070 ++deletedEventR;
1070 } else { 1071 } else {
1071 inR->setLastModified( modifiedCalendar ); 1072 inR->setLastModified( modifiedCalendar );
1072 inL = inR->clone(); 1073 inL = inR->clone();
1073 local->addIncidence( inL ); 1074 local->addIncidence( inL );
1074 ++addedEvent; 1075 ++addedEvent;
1075 } 1076 }
1076 } else { 1077 } else {
1077 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1078 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1078 inR->setLastModified( modifiedCalendar ); 1079 inR->setLastModified( modifiedCalendar );
1079 local->addIncidence( inR->clone() ); 1080 local->addIncidence( inR->clone() );
1080 ++addedEvent; 1081 ++addedEvent;
1081 } else { 1082 } else {
1082 checkExternSyncEvent(eventRSyncSharp, inR); 1083 checkExternSyncEvent(eventRSyncSharp, inR);
1083 remote->deleteIncidence( inR ); 1084 remote->deleteIncidence( inR );
1084 ++deletedEventR; 1085 ++deletedEventR;
1085 } 1086 }
1086 } 1087 }
1087 } 1088 }
1088 } 1089 }
1089 inR = er.next(); 1090 inR = er.next();
1090 } 1091 }
1091 QPtrList<Incidence> el = local->rawIncidences(); 1092 QPtrList<Incidence> el = local->rawIncidences();
1092 inL = el.first(); 1093 inL = el.first();
1093 modulo = (el.count()/10)+1; 1094 modulo = (el.count()/10)+1;
1094 bar.setCaption (i18n("Add / remove events") ); 1095 bar.setCaption (i18n("Add / remove events") );
1095 bar.setTotalSteps ( el.count() ) ; 1096 bar.setTotalSteps ( el.count() ) ;
1096 bar.show(); 1097 bar.show();
1097 incCounter = 0; 1098 incCounter = 0;
1098 1099
1099 while ( inL ) { 1100 while ( inL ) {
1100 1101
1101 qApp->processEvents(); 1102 qApp->processEvents();
1102 if ( ! bar.isVisible() ) 1103 if ( ! bar.isVisible() )
1103 return false; 1104 return false;
1104 if ( incCounter % modulo == 0 ) 1105 if ( incCounter % modulo == 0 )
1105 bar.setProgress( incCounter ); 1106 bar.setProgress( incCounter );
1106 ++incCounter; 1107 ++incCounter;
1107 uid = inL->uid(); 1108 uid = inL->uid();
1108 bool skipIncidence = false; 1109 bool skipIncidence = false;
1109 if ( uid.left(15) == QString("last-syncEvent-") ) 1110 if ( uid.left(15) == QString("last-syncEvent-") )
1110 skipIncidence = true; 1111 skipIncidence = true;
1111 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1112 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1112 skipIncidence = true; 1113 skipIncidence = true;
1113 if ( !skipIncidence ) { 1114 if ( !skipIncidence ) {
1114 inR = remote->incidence( uid ); 1115 inR = remote->incidence( uid );
1115 if ( ! inR ) { 1116 if ( ! inR ) {
1116 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1117 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1117 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1118 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1118 checkExternSyncEvent(eventLSyncSharp, inL); 1119 checkExternSyncEvent(eventLSyncSharp, inL);
1119 local->deleteIncidence( inL ); 1120 local->deleteIncidence( inL );
1120 ++deletedEventL; 1121 ++deletedEventL;
1121 } else { 1122 } else {
1122 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1123 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1123 inL->removeID(mCurrentSyncDevice ); 1124 inL->removeID(mCurrentSyncDevice );
1124 ++addedEventR; 1125 ++addedEventR;
1125 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1126 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1126 inL->setLastModified( modifiedCalendar ); 1127 inL->setLastModified( modifiedCalendar );
1127 inR = inL->clone(); 1128 inR = inL->clone();
1128 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1129 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1129 remote->addIncidence( inR ); 1130 remote->addIncidence( inR );
1130 } 1131 }
1131 } 1132 }
1132 } else { 1133 } else {
1133 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1134 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1134 checkExternSyncEvent(eventLSyncSharp, inL); 1135 checkExternSyncEvent(eventLSyncSharp, inL);
1135 local->deleteIncidence( inL ); 1136 local->deleteIncidence( inL );
1136 ++deletedEventL; 1137 ++deletedEventL;
1137 } else { 1138 } else {
1138 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1139 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1139 ++addedEventR; 1140 ++addedEventR;
1140 inL->setLastModified( modifiedCalendar ); 1141 inL->setLastModified( modifiedCalendar );
1141 remote->addIncidence( inL->clone() ); 1142 remote->addIncidence( inL->clone() );
1142 } 1143 }
1143 } 1144 }
1144 } 1145 }
1145 } 1146 }
1146 } 1147 }
1147 inL = el.next(); 1148 inL = el.next();
1148 } 1149 }
1149 int delFut = 0; 1150 int delFut = 0;
1150 if ( KOPrefs::instance()->mWriteBackInFuture ) { 1151 if ( KOPrefs::instance()->mWriteBackInFuture ) {
1151 er = remote->rawIncidences(); 1152 er = remote->rawIncidences();
1152 inR = er.first(); 1153 inR = er.first();
1153 QDateTime dt; 1154 QDateTime dt;
1154 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1155 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1155 QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); 1156 QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 );
1156 while ( inR ) { 1157 while ( inR ) {
1157 if ( inR->type() == "Todo" ) { 1158 if ( inR->type() == "Todo" ) {
1158 Todo * t = (Todo*)inR; 1159 Todo * t = (Todo*)inR;
1159 if ( t->hasDueDate() ) 1160 if ( t->hasDueDate() )
1160 dt = t->dtDue(); 1161 dt = t->dtDue();
1161 else 1162 else
1162 dt = cur.addSecs( 62 ); 1163 dt = cur.addSecs( 62 );
1163 } 1164 }
1164 else if (inR->type() == "Event" ) { 1165 else if (inR->type() == "Event" ) {
1165 bool ok; 1166 bool ok;
1166 dt = inR->getNextOccurence( cur, &ok ); 1167 dt = inR->getNextOccurence( cur, &ok );
1167 if ( !ok ) 1168 if ( !ok )
1168 dt = cur.addSecs( -62 ); 1169 dt = cur.addSecs( -62 );
1169 } 1170 }
1170 else 1171 else
1171 dt = inR->dtStart(); 1172 dt = inR->dtStart();
1172 if ( dt < cur || dt > end ) { 1173 if ( dt < cur || dt > end ) {
1173 remote->deleteIncidence( inR ); 1174 remote->deleteIncidence( inR );
1174 ++delFut; 1175 ++delFut;
1175 } 1176 }
1176 inR = er.next(); 1177 inR = er.next();
1177 } 1178 }
1178 } 1179 }
1179 bar.hide(); 1180 bar.hide();
1180 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1181 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1181 eventLSync->setReadOnly( false ); 1182 eventLSync->setReadOnly( false );
1182 eventLSync->setDtStart( mLastCalendarSync ); 1183 eventLSync->setDtStart( mLastCalendarSync );
1183 eventRSync->setDtStart( mLastCalendarSync ); 1184 eventRSync->setDtStart( mLastCalendarSync );
1184 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1185 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1185 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1186 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1186 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1187 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1187 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1188 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1188 eventLSync->setReadOnly( true ); 1189 eventLSync->setReadOnly( true );
1189 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1190 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1190 remote->addEvent( eventRSync ); 1191 remote->addEvent( eventRSync );
1191 QString mes; 1192 QString mes;
1192 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 ); 1193 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 );
1193 QString delmess; 1194 QString delmess;
1194 if ( delFut ) { 1195 if ( delFut ) {
1195 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 ); 1196 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 );
1196 mes += delmess; 1197 mes += delmess;
1197 } 1198 }
1198 if ( KOPrefs::instance()->mShowSyncSummary ) { 1199 if ( KOPrefs::instance()->mShowSyncSummary ) {
1199 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1200 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1200 } 1201 }
1201 qDebug( mes ); 1202 qDebug( mes );
1202 mCalendar->checkAlarmForIncidence( 0, true ); 1203 mCalendar->checkAlarmForIncidence( 0, true );
1203 return syncOK; 1204 return syncOK;
1204} 1205}
1205 1206
1206void CalendarView::setSyncDevice( QString s ) 1207void CalendarView::setSyncDevice( QString s )
1207{ 1208{
1208 mCurrentSyncDevice= s; 1209 mCurrentSyncDevice= s;
1209} 1210}
1210void CalendarView::setSyncName( QString s ) 1211void CalendarView::setSyncName( QString s )
1211{ 1212{
1212 mCurrentSyncName= s; 1213 mCurrentSyncName= s;
1213} 1214}
1214bool CalendarView::syncCalendar(QString filename, int mode) 1215bool CalendarView::syncCalendar(QString filename, int mode)
1215{ 1216{
1216 mGlobalSyncMode = SYNC_MODE_NORMAL; 1217 mGlobalSyncMode = SYNC_MODE_NORMAL;
1217 CalendarLocal* calendar = new CalendarLocal(); 1218 CalendarLocal* calendar = new CalendarLocal();
1218 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1219 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1219 FileStorage* storage = new FileStorage( calendar ); 1220 FileStorage* storage = new FileStorage( calendar );
1220 bool syncOK = false; 1221 bool syncOK = false;
1221 storage->setFileName( filename ); 1222 storage->setFileName( filename );
1222 // qDebug("loading ... "); 1223 // qDebug("loading ... ");
1223 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 1224 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
1224 getEventViewerDialog()->setSyncMode( true ); 1225 getEventViewerDialog()->setSyncMode( true );
1225 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1226 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1226 getEventViewerDialog()->setSyncMode( false ); 1227 getEventViewerDialog()->setSyncMode( false );
1227 if ( syncOK ) { 1228 if ( syncOK ) {
1228 if ( KOPrefs::instance()->mWriteBackFile ) 1229 if ( KOPrefs::instance()->mWriteBackFile )
1229 { 1230 {
1230 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1231 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1231 storage->save(); 1232 storage->save();
1232 } 1233 }
1233 } 1234 }
1234 setModified( true ); 1235 setModified( true );
1235 } 1236 }
1236 delete storage; 1237 delete storage;
1237 delete calendar; 1238 delete calendar;
1238 if ( syncOK ) 1239 if ( syncOK )
1239 updateView(); 1240 updateView();
1240 return syncOK; 1241 return syncOK;
1241} 1242}
1242void CalendarView::syncPhone() 1243void CalendarView::syncPhone()
1243{ 1244{
1244 syncExternal( 1 ); 1245 syncExternal( 1 );
1245} 1246}
1246void CalendarView::syncExternal( int mode ) 1247void CalendarView::syncExternal( int mode )
1247{ 1248{
1248 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1249 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1249 //mCurrentSyncDevice = "sharp-DTM"; 1250 //mCurrentSyncDevice = "sharp-DTM";
1250 if ( KOPrefs::instance()->mAskForPreferences ) 1251 if ( KOPrefs::instance()->mAskForPreferences )
1251 edit_sync_options(); 1252 edit_sync_options();
1252 qApp->processEvents(); 1253 qApp->processEvents();
1253 CalendarLocal* calendar = new CalendarLocal(); 1254 CalendarLocal* calendar = new CalendarLocal();
1254 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1255 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1255 bool syncOK = false; 1256 bool syncOK = false;
1256 bool loadSuccess = false; 1257 bool loadSuccess = false;
1257 PhoneFormat* phoneFormat = 0; 1258 PhoneFormat* phoneFormat = 0;
1258#ifndef DESKTOP_VERSION 1259#ifndef DESKTOP_VERSION
1259 SharpFormat* sharpFormat = 0; 1260 SharpFormat* sharpFormat = 0;
1260 if ( mode == 0 ) { // sharp 1261 if ( mode == 0 ) { // sharp
1261 sharpFormat = new SharpFormat () ; 1262 sharpFormat = new SharpFormat () ;
1262 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1263 loadSuccess = sharpFormat->load( calendar, mCalendar );
1263 1264
1264 } else 1265 } else
1265#endif 1266#endif
1266 if ( mode == 1 ) { // phone 1267 if ( mode == 1 ) { // phone
1267 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1268 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1268 KOPrefs::instance()->mPhoneDevice, 1269 KOPrefs::instance()->mPhoneDevice,
1269 KOPrefs::instance()->mPhoneConnection, 1270 KOPrefs::instance()->mPhoneConnection,
1270 KOPrefs::instance()->mPhoneModel); 1271 KOPrefs::instance()->mPhoneModel);
1271 loadSuccess = phoneFormat->load( calendar,mCalendar); 1272 loadSuccess = phoneFormat->load( calendar,mCalendar);
1272 1273
1273 } else 1274 } else
1274 return; 1275 return;
1275 if ( loadSuccess ) { 1276 if ( loadSuccess ) {
1276 getEventViewerDialog()->setSyncMode( true ); 1277 getEventViewerDialog()->setSyncMode( true );
1277 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1278 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1278 getEventViewerDialog()->setSyncMode( false ); 1279 getEventViewerDialog()->setSyncMode( false );
1279 qApp->processEvents(); 1280 qApp->processEvents();
1280 if ( syncOK ) { 1281 if ( syncOK ) {
1281 if ( KOPrefs::instance()->mWriteBackFile ) 1282 if ( KOPrefs::instance()->mWriteBackFile )
1282 { 1283 {
1283 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1284 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1284 Incidence* inc = iL.first(); 1285 Incidence* inc = iL.first();
1285 if ( phoneFormat ) { 1286 if ( phoneFormat ) {
1286 while ( inc ) { 1287 while ( inc ) {
1287 inc->removeID(mCurrentSyncDevice); 1288 inc->removeID(mCurrentSyncDevice);
1288 inc = iL.next(); 1289 inc = iL.next();
1289 } 1290 }
1290 } 1291 }
1291#ifndef DESKTOP_VERSION 1292#ifndef DESKTOP_VERSION
1292 if ( sharpFormat ) 1293 if ( sharpFormat )
1293 sharpFormat->save(calendar); 1294 sharpFormat->save(calendar);
1294#endif 1295#endif
1295 if ( phoneFormat ) 1296 if ( phoneFormat )
1296 phoneFormat->save(calendar); 1297 phoneFormat->save(calendar);
1297 iL = calendar->rawIncidences(); 1298 iL = calendar->rawIncidences();
1298 inc = iL.first(); 1299 inc = iL.first();
1299 Incidence* loc; 1300 Incidence* loc;
1300 while ( inc ) { 1301 while ( inc ) {
1301 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1302 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1302 loc = mCalendar->incidence(inc->uid() ); 1303 loc = mCalendar->incidence(inc->uid() );
1303 if ( loc ) { 1304 if ( loc ) {
1304 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1305 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1305 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1306 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1306 } 1307 }
1307 } 1308 }
1308 inc = iL.next(); 1309 inc = iL.next();
1309 } 1310 }
1310 Incidence* lse = getLastSyncEvent(); 1311 Incidence* lse = getLastSyncEvent();
1311 if ( lse ) { 1312 if ( lse ) {
1312 lse->setReadOnly( false ); 1313 lse->setReadOnly( false );
1313 lse->setDescription( "" ); 1314 lse->setDescription( "" );
1314 lse->setReadOnly( true ); 1315 lse->setReadOnly( true );
1315 } 1316 }
1316 } 1317 }
1317 } 1318 }
1318 setModified( true ); 1319 setModified( true );
1319 } else { 1320 } else {
1320 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1321 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1321 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1322 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1322 question, i18n("Ok")) ; 1323 question, i18n("Ok")) ;
1323 1324
1324 } 1325 }
1325 delete calendar; 1326 delete calendar;
1326 updateView(); 1327 updateView();
1327 return ;//syncOK; 1328 return ;//syncOK;
1328 1329
1329} 1330}
1330void CalendarView::syncSharp() 1331void CalendarView::syncSharp()
1331{ 1332{
1332 syncExternal( 0 ); 1333 syncExternal( 0 );
1333 1334
1334} 1335}
1335 1336
1336 1337
1337//#include <kabc/stdaddressbook.h> 1338//#include <kabc/stdaddressbook.h>
1338bool CalendarView::importBday() 1339bool CalendarView::importBday()
1339{ 1340{
1340#if 0 1341#if 0
1341 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1342 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1342 KABC::AddressBook::Iterator it; 1343 KABC::AddressBook::Iterator it;
1343 int count = 0; 1344 int count = 0;
1344 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1345 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1345 ++count; 1346 ++count;
1346 } 1347 }
1347 QProgressBar bar(count,0 ); 1348 QProgressBar bar(count,0 );
1348 int w = 300; 1349 int w = 300;
1349 if ( QApplication::desktop()->width() < 320 ) 1350 if ( QApplication::desktop()->width() < 320 )
1350 w = 220; 1351 w = 220;
1351 int h = bar.sizeHint().height() ; 1352 int h = bar.sizeHint().height() ;
1352 int dw = QApplication::desktop()->width(); 1353 int dw = QApplication::desktop()->width();
1353 int dh = QApplication::desktop()->height(); 1354 int dh = QApplication::desktop()->height();
1354 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1355 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1355 bar.show(); 1356 bar.show();
1356 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1357 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1357 qApp->processEvents(); 1358 qApp->processEvents();
1358 count = 0; 1359 count = 0;
1359 int addCount = 0; 1360 int addCount = 0;
1360 KCal::Attendee* a = 0; 1361 KCal::Attendee* a = 0;
1361 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1362 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1362 if ( ! bar.isVisible() ) 1363 if ( ! bar.isVisible() )
1363 return false; 1364 return false;
1364 bar.setProgress( count++ ); 1365 bar.setProgress( count++ );
1365 qApp->processEvents(); 1366 qApp->processEvents();
1366 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1367 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1367 if ( (*it).birthday().date().isValid() ){ 1368 if ( (*it).birthday().date().isValid() ){
1368 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1369 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1369 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1370 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1370 ++addCount; 1371 ++addCount;
1371 } 1372 }
1372 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1373 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1373 if ( anni.isValid() ){ 1374 if ( anni.isValid() ){
1374 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1375 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1375 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1376 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1376 ++addCount; 1377 ++addCount;
1377 } 1378 }
1378 } 1379 }
1379 updateView(); 1380 updateView();
1380 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1381 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1381#endif 1382#endif
1382 return true; 1383 return true;
1383} 1384}
1384 1385
1385bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1386bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1386{ 1387{
1387 //qDebug("addAnni "); 1388 //qDebug("addAnni ");
1388 Event * ev = new Event(); 1389 Event * ev = new Event();
1389 if ( a ) { 1390 if ( a ) {
1390 ev->addAttendee( a ); 1391 ev->addAttendee( a );
1391 } 1392 }
1392 QString kind; 1393 QString kind;
1393 if ( birthday ) 1394 if ( birthday )
1394 kind = i18n( "Birthday" ); 1395 kind = i18n( "Birthday" );
1395 else 1396 else
1396 kind = i18n( "Anniversary" ); 1397 kind = i18n( "Anniversary" );
1397 ev->setSummary( name + " - " + kind ); 1398 ev->setSummary( name + " - " + kind );
1398 ev->setOrganizer( "nobody@nowhere" ); 1399 ev->setOrganizer( "nobody@nowhere" );
1399 ev->setCategories( kind ); 1400 ev->setCategories( kind );
1400 ev->setDtStart( QDateTime(date) ); 1401 ev->setDtStart( QDateTime(date) );
1401 ev->setDtEnd( QDateTime(date) ); 1402 ev->setDtEnd( QDateTime(date) );
1402 ev->setFloats( true ); 1403 ev->setFloats( true );
1403 Recurrence * rec = ev->recurrence(); 1404 Recurrence * rec = ev->recurrence();
1404 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1405 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1405 rec->addYearlyNum( date.month() ); 1406 rec->addYearlyNum( date.month() );
1406 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1407 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1407 delete ev; 1408 delete ev;
1408 return false; 1409 return false;
1409 } 1410 }
1410 return true; 1411 return true;
1411 1412
1412} 1413}
1413bool CalendarView::importQtopia( const QString &categories, 1414bool CalendarView::importQtopia( const QString &categories,
1414 const QString &datebook, 1415 const QString &datebook,
1415 const QString &todolist ) 1416 const QString &todolist )
1416{ 1417{
1417 1418
1418 QtopiaFormat qtopiaFormat; 1419 QtopiaFormat qtopiaFormat;
1419 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1420 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1420 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1421 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1421 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1422 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1422 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1423 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1423 1424
1424 updateView(); 1425 updateView();
1425 return true; 1426 return true;
1426 1427
1427#if 0 1428#if 0
1428 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1429 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1429 mCurrentSyncDevice = "qtopia-XML"; 1430 mCurrentSyncDevice = "qtopia-XML";
1430 if ( KOPrefs::instance()->mAskForPreferences ) 1431 if ( KOPrefs::instance()->mAskForPreferences )
1431 edit_sync_options(); 1432 edit_sync_options();
1432 qApp->processEvents(); 1433 qApp->processEvents();
1433 CalendarLocal* calendar = new CalendarLocal(); 1434 CalendarLocal* calendar = new CalendarLocal();
1434 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1435 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1435 bool syncOK = false; 1436 bool syncOK = false;
1436 QtopiaFormat qtopiaFormat; 1437 QtopiaFormat qtopiaFormat;
1437 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1438 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1438 bool loadOk = true; 1439 bool loadOk = true;
1439 if ( !categories.isEmpty() ) 1440 if ( !categories.isEmpty() )
1440 loadOk = qtopiaFormat.load( calendar, categories ); 1441 loadOk = qtopiaFormat.load( calendar, categories );
1441 if ( loadOk && !datebook.isEmpty() ) 1442 if ( loadOk && !datebook.isEmpty() )
1442 loadOk = qtopiaFormat.load( calendar, datebook ); 1443 loadOk = qtopiaFormat.load( calendar, datebook );
1443 if ( loadOk && !todolist.isEmpty() ) 1444 if ( loadOk && !todolist.isEmpty() )
1444 loadOk = qtopiaFormat.load( calendar, todolist ); 1445 loadOk = qtopiaFormat.load( calendar, todolist );
1445 1446
1446 if ( loadOk ) { 1447 if ( loadOk ) {
1447 getEventViewerDialog()->setSyncMode( true ); 1448 getEventViewerDialog()->setSyncMode( true );
1448 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1449 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1449 getEventViewerDialog()->setSyncMode( false ); 1450 getEventViewerDialog()->setSyncMode( false );
1450 qApp->processEvents(); 1451 qApp->processEvents();
1451 if ( syncOK ) { 1452 if ( syncOK ) {
1452 if ( KOPrefs::instance()->mWriteBackFile ) 1453 if ( KOPrefs::instance()->mWriteBackFile )
1453 { 1454 {
1454 // write back XML file 1455 // write back XML file
1455 1456
1456 } 1457 }
1457 setModified( true ); 1458 setModified( true );
1458 } 1459 }
1459 } else { 1460 } else {
1460 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1461 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1461 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1462 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1462 question, i18n("Ok")) ; 1463 question, i18n("Ok")) ;
1463 } 1464 }
1464 delete calendar; 1465 delete calendar;
1465 updateView(); 1466 updateView();
1466 return syncOK; 1467 return syncOK;
1467 1468
1468 1469
1469#endif 1470#endif
1470 1471
1471} 1472}
1472 1473
1473void CalendarView::setSyncEventsReadOnly() 1474void CalendarView::setSyncEventsReadOnly()
1474{ 1475{
1475 Event * ev; 1476 Event * ev;
1476 QPtrList<Event> eL = mCalendar->rawEvents(); 1477 QPtrList<Event> eL = mCalendar->rawEvents();
1477 ev = eL.first(); 1478 ev = eL.first();
1478 while ( ev ) { 1479 while ( ev ) {
1479 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1480 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1480 ev->setReadOnly( true ); 1481 ev->setReadOnly( true );
1481 ev = eL.next(); 1482 ev = eL.next();
1482 } 1483 }
1483} 1484}
1484bool CalendarView::openCalendar(QString filename, bool merge) 1485bool CalendarView::openCalendar(QString filename, bool merge)
1485{ 1486{
1486 1487
1487 if (filename.isEmpty()) { 1488 if (filename.isEmpty()) {
1488 return false; 1489 return false;
1489 } 1490 }
1490 1491
1491 if (!QFile::exists(filename)) { 1492 if (!QFile::exists(filename)) {
1492 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1493 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1493 return false; 1494 return false;
1494 } 1495 }
1495 1496
1496 globalFlagBlockAgenda = 1; 1497 globalFlagBlockAgenda = 1;
1497 if (!merge) mCalendar->close(); 1498 if (!merge) mCalendar->close();
1498 1499
1499 mStorage->setFileName( filename ); 1500 mStorage->setFileName( filename );
1500 1501
1501 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { 1502 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) {
1502 if ( merge ) ;//setModified( true ); 1503 if ( merge ) ;//setModified( true );
1503 else { 1504 else {
1504 //setModified( true ); 1505 //setModified( true );
1505 mViewManager->setDocumentId( filename ); 1506 mViewManager->setDocumentId( filename );
1506 mDialogManager->setDocumentId( filename ); 1507 mDialogManager->setDocumentId( filename );
1507 mTodoList->setDocumentId( filename ); 1508 mTodoList->setDocumentId( filename );
1508 } 1509 }
1509 globalFlagBlockAgenda = 2; 1510 globalFlagBlockAgenda = 2;
1510 // if ( getLastSyncEvent() ) 1511 // if ( getLastSyncEvent() )
1511 // getLastSyncEvent()->setReadOnly( true ); 1512 // getLastSyncEvent()->setReadOnly( true );
1512 mCalendar->reInitAlarmSettings(); 1513 mCalendar->reInitAlarmSettings();
1513 setSyncEventsReadOnly(); 1514 setSyncEventsReadOnly();
1514 updateUnmanagedViews(); 1515 updateUnmanagedViews();
1515 updateView(); 1516 updateView();
1516 if ( filename != MainWindow::defaultFileName() ) 1517 if ( filename != MainWindow::defaultFileName() )
1517 saveCalendar( MainWindow::defaultFileName() ); 1518 saveCalendar( MainWindow::defaultFileName() );
1518 loadedFileVersion = QDateTime::currentDateTime(); 1519 loadedFileVersion = QDateTime::currentDateTime();
1519 return true; 1520 return true;
1520 } else { 1521 } else {
1521 // while failing to load, the calendar object could 1522 // while failing to load, the calendar object could
1522 // have become partially populated. Clear it out. 1523 // have become partially populated. Clear it out.
1523 if ( !merge ) mCalendar->close(); 1524 if ( !merge ) mCalendar->close();
1524 1525
1525 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1526 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1526 1527
1527 globalFlagBlockAgenda = 2; 1528 globalFlagBlockAgenda = 2;
1528 updateView(); 1529 updateView();
1529 } 1530 }
1530 return false; 1531 return false;
1531} 1532}
1532void CalendarView::setLoadedFileVersion(QDateTime dt) 1533void CalendarView::setLoadedFileVersion(QDateTime dt)
1533{ 1534{
1534 loadedFileVersion = dt; 1535 loadedFileVersion = dt;
1535} 1536}
1536bool CalendarView::checkFileChanged(QString fn) 1537bool CalendarView::checkFileChanged(QString fn)
1537{ 1538{
1538 QFileInfo finf ( fn ); 1539 QFileInfo finf ( fn );
1539 if ( !finf.exists() ) 1540 if ( !finf.exists() )
1540 return true; 1541 return true;
1541 QDateTime dt = finf.lastModified (); 1542 QDateTime dt = finf.lastModified ();
1542 if ( dt <= loadedFileVersion ) 1543 if ( dt <= loadedFileVersion )
1543 return false; 1544 return false;
1544 return true; 1545 return true;
1545 1546
1546} 1547}
1547bool CalendarView::checkFileVersion(QString fn) 1548bool CalendarView::checkFileVersion(QString fn)
1548{ 1549{
1549 QFileInfo finf ( fn ); 1550 QFileInfo finf ( fn );
1550 if ( !finf.exists() ) 1551 if ( !finf.exists() )
1551 return true; 1552 return true;
1552 QDateTime dt = finf.lastModified (); 1553 QDateTime dt = finf.lastModified ();
1553 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1554 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1554 //qDebug("file on disk version %s",dt.toString().latin1()); 1555 //qDebug("file on disk version %s",dt.toString().latin1());
1555 if ( dt <= loadedFileVersion ) 1556 if ( dt <= loadedFileVersion )
1556 return true; 1557 return true;
1557 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , 1558 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) ,
1558 i18n("KO/Pi Warning"),i18n("Overwrite"), 1559 i18n("KO/Pi Warning"),i18n("Overwrite"),
1559 i18n("Sync+save")); 1560 i18n("Sync+save"));
1560 1561
1561 if ( km == KMessageBox::Cancel ) 1562 if ( km == KMessageBox::Cancel )
1562 return false; 1563 return false;
1563 if ( km == KMessageBox::Yes ) 1564 if ( km == KMessageBox::Yes )
1564 return true; 1565 return true;
1565 1566
1566 setSyncDevice("deleteaftersync" ); 1567 setSyncDevice("deleteaftersync" );
1567 KOPrefs::instance()->mAskForPreferences = true; 1568 KOPrefs::instance()->mAskForPreferences = true;
1568 KOPrefs::instance()->mSyncAlgoPrefs = 3; 1569 KOPrefs::instance()->mSyncAlgoPrefs = 3;
1569 KOPrefs::instance()->mWriteBackFile = false; 1570 KOPrefs::instance()->mWriteBackFile = false;
1570 KOPrefs::instance()->mWriteBackExistingOnly = false; 1571 KOPrefs::instance()->mWriteBackExistingOnly = false;
1571 KOPrefs::instance()->mShowSyncSummary = false; 1572 KOPrefs::instance()->mShowSyncSummary = false;
1572 syncCalendar( fn, 3 ); 1573 syncCalendar( fn, 3 );
1573 Event * e = getLastSyncEvent(); 1574 Event * e = getLastSyncEvent();
1574 mCalendar->deleteEvent ( e ); 1575 mCalendar->deleteEvent ( e );
1575 updateView(); 1576 updateView();
1576 return true; 1577 return true;
1577} 1578}
1578 1579
1579bool CalendarView::saveCalendar( QString filename ) 1580bool CalendarView::saveCalendar( QString filename )
1580{ 1581{
1581 1582
1582 // Store back all unsaved data into calendar object 1583 // Store back all unsaved data into calendar object
1583 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1584 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1584 if ( mViewManager->currentView() ) 1585 if ( mViewManager->currentView() )
1585 mViewManager->currentView()->flushView(); 1586 mViewManager->currentView()->flushView();
1586 1587
1587 //mStorage->setFileName( filename ); 1588 //mStorage->setFileName( filename );
1588 1589
1589 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1590 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1590 mStorage->setFileName( filename ); 1591 mStorage->setFileName( filename );
1591 bool success; 1592 bool success;
1592 success = mStorage->save(); 1593 success = mStorage->save();
1593 if ( !success ) { 1594 if ( !success ) {
1594 return false; 1595 return false;
1595 } 1596 }
1596 1597
1597 return true; 1598 return true;
1598} 1599}
1599 1600
1600void CalendarView::closeCalendar() 1601void CalendarView::closeCalendar()
1601{ 1602{
1602 1603
1603 // child windows no longer valid 1604 // child windows no longer valid
1604 emit closingDown(); 1605 emit closingDown();
1605 1606
1606 mCalendar->close(); 1607 mCalendar->close();
1607 setModified(false); 1608 setModified(false);
1608 updateView(); 1609 updateView();
1609} 1610}
1610 1611
1611void CalendarView::archiveCalendar() 1612void CalendarView::archiveCalendar()
1612{ 1613{
1613 mDialogManager->showArchiveDialog(); 1614 mDialogManager->showArchiveDialog();
1614} 1615}
1615 1616
1616 1617
1617void CalendarView::readSettings() 1618void CalendarView::readSettings()
1618{ 1619{
1619 1620
1620 1621
1621 // mViewManager->showAgendaView(); 1622 // mViewManager->showAgendaView();
1622 QString str; 1623 QString str;
1623 //qDebug("CalendarView::readSettings() "); 1624 //qDebug("CalendarView::readSettings() ");
1624 // read settings from the KConfig, supplying reasonable 1625 // read settings from the KConfig, supplying reasonable
1625 // defaults where none are to be found 1626 // defaults where none are to be found
1626 KConfig *config = KOGlobals::config(); 1627 KConfig *config = KOGlobals::config();
1627#ifndef KORG_NOSPLITTER 1628#ifndef KORG_NOSPLITTER
1628 config->setGroup("KOrganizer Geometry"); 1629 config->setGroup("KOrganizer Geometry");
1629 1630
1630 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1631 QValueList<int> sizes = config->readIntListEntry("Separator1");
1631 if (sizes.count() != 2) { 1632 if (sizes.count() != 2) {
1632 sizes << mDateNavigator->minimumSizeHint().width(); 1633 sizes << mDateNavigator->minimumSizeHint().width();
1633 sizes << 300; 1634 sizes << 300;
1634 } 1635 }
1635 mPanner->setSizes(sizes); 1636 mPanner->setSizes(sizes);
1636 1637
1637 sizes = config->readIntListEntry("Separator2"); 1638 sizes = config->readIntListEntry("Separator2");
1638 if ( ( mResourceView && sizes.count() == 4 ) || 1639 if ( ( mResourceView && sizes.count() == 4 ) ||
1639 ( !mResourceView && sizes.count() == 3 ) ) { 1640 ( !mResourceView && sizes.count() == 3 ) ) {
1640 mLeftSplitter->setSizes(sizes); 1641 mLeftSplitter->setSizes(sizes);
1641 } 1642 }
1642#endif 1643#endif
1643 globalFlagBlockAgenda = 1; 1644 globalFlagBlockAgenda = 1;
1644 mViewManager->showAgendaView(); 1645 mViewManager->showAgendaView();
1645 //mViewManager->readSettings( config ); 1646 //mViewManager->readSettings( config );
1646 mTodoList->restoreLayout(config,QString("Todo Layout")); 1647 mTodoList->restoreLayout(config,QString("Todo Layout"));
1647 readFilterSettings(config); 1648 readFilterSettings(config);
1648 config->setGroup( "Views" ); 1649 config->setGroup( "Views" );
1649 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1650 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1650 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1651 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1651 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1652 else if ( dateCount == 7 ) mNavigator->selectWeek();
1652 else mNavigator->selectDates( dateCount ); 1653 else mNavigator->selectDates( dateCount );
1653 // mViewManager->readSettings( config ); 1654 // mViewManager->readSettings( config );
1654 updateConfig(); 1655 updateConfig();
1655 globalFlagBlockAgenda = 2; 1656 globalFlagBlockAgenda = 2;
1656 mViewManager->readSettings( config ); 1657 mViewManager->readSettings( config );
1657#ifdef DESKTOP_VERSION 1658#ifdef DESKTOP_VERSION
1658 config->setGroup("WidgetLayout"); 1659 config->setGroup("WidgetLayout");
1659 QStringList list; 1660 QStringList list;
1660 list = config->readListEntry("MainLayout"); 1661 list = config->readListEntry("MainLayout");
1661 int x,y,w,h; 1662 int x,y,w,h;
1662 if ( ! list.isEmpty() ) { 1663 if ( ! list.isEmpty() ) {
1663 x = list[0].toInt(); 1664 x = list[0].toInt();
1664 y = list[1].toInt(); 1665 y = list[1].toInt();
1665 w = list[2].toInt(); 1666 w = list[2].toInt();
1666 h = list[3].toInt(); 1667 h = list[3].toInt();
1667 topLevelWidget()->setGeometry(x,y,w,h); 1668 topLevelWidget()->setGeometry(x,y,w,h);
1668 1669
1669 } else { 1670 } else {
1670 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1671 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1671 } 1672 }
1672 list = config->readListEntry("EditEventLayout"); 1673 list = config->readListEntry("EditEventLayout");
1673 if ( ! list.isEmpty() ) { 1674 if ( ! list.isEmpty() ) {
1674 x = list[0].toInt(); 1675 x = list[0].toInt();
1675 y = list[1].toInt(); 1676 y = list[1].toInt();
1676 w = list[2].toInt(); 1677 w = list[2].toInt();
1677 h = list[3].toInt(); 1678 h = list[3].toInt();
1678 mEventEditor->setGeometry(x,y,w,h); 1679 mEventEditor->setGeometry(x,y,w,h);
1679 1680
1680 } 1681 }
1681 list = config->readListEntry("EditTodoLayout"); 1682 list = config->readListEntry("EditTodoLayout");
1682 if ( ! list.isEmpty() ) { 1683 if ( ! list.isEmpty() ) {
1683 x = list[0].toInt(); 1684 x = list[0].toInt();
1684 y = list[1].toInt(); 1685 y = list[1].toInt();
1685 w = list[2].toInt(); 1686 w = list[2].toInt();
1686 h = list[3].toInt(); 1687 h = list[3].toInt();
1687 mTodoEditor->setGeometry(x,y,w,h); 1688 mTodoEditor->setGeometry(x,y,w,h);
1688 1689
1689 } 1690 }
1690 list = config->readListEntry("ViewerLayout"); 1691 list = config->readListEntry("ViewerLayout");
1691 if ( ! list.isEmpty() ) { 1692 if ( ! list.isEmpty() ) {
1692 x = list[0].toInt(); 1693 x = list[0].toInt();
1693 y = list[1].toInt(); 1694 y = list[1].toInt();
1694 w = list[2].toInt(); 1695 w = list[2].toInt();
1695 h = list[3].toInt(); 1696 h = list[3].toInt();
1696 getEventViewerDialog()->setGeometry(x,y,w,h); 1697 getEventViewerDialog()->setGeometry(x,y,w,h);
1697 } 1698 }
1698#endif 1699#endif
1699 1700
1700} 1701}
1701 1702
1702 1703
1703void CalendarView::writeSettings() 1704void CalendarView::writeSettings()
1704{ 1705{
1705 // kdDebug() << "CalendarView::writeSettings" << endl; 1706 // kdDebug() << "CalendarView::writeSettings" << endl;
1706 1707
1707 KConfig *config = KOGlobals::config(); 1708 KConfig *config = KOGlobals::config();
1708 1709
1709#ifndef KORG_NOSPLITTER 1710#ifndef KORG_NOSPLITTER
1710 config->setGroup("KOrganizer Geometry"); 1711 config->setGroup("KOrganizer Geometry");
1711 1712
1712 QValueList<int> list = mPanner->sizes(); 1713 QValueList<int> list = mPanner->sizes();
1713 config->writeEntry("Separator1",list); 1714 config->writeEntry("Separator1",list);
1714 1715
1715 list = mLeftSplitter->sizes(); 1716 list = mLeftSplitter->sizes();
1716 config->writeEntry("Separator2",list); 1717 config->writeEntry("Separator2",list);
1717#endif 1718#endif
1718 1719
1719 mViewManager->writeSettings( config ); 1720 mViewManager->writeSettings( config );
1720 mTodoList->saveLayout(config,QString("Todo Layout")); 1721 mTodoList->saveLayout(config,QString("Todo Layout"));
1721 mDialogManager->writeSettings( config ); 1722 mDialogManager->writeSettings( config );
1722 //KOPrefs::instance()->usrWriteConfig(); 1723 //KOPrefs::instance()->usrWriteConfig();
1723 KOPrefs::instance()->writeConfig(); 1724 KOPrefs::instance()->writeConfig();
1724 1725
1725 writeFilterSettings(config); 1726 writeFilterSettings(config);
1726 1727
1727 config->setGroup( "Views" ); 1728 config->setGroup( "Views" );
1728 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1729 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1729 1730
1730#ifdef DESKTOP_VERSION 1731#ifdef DESKTOP_VERSION
1731 config->setGroup("WidgetLayout"); 1732 config->setGroup("WidgetLayout");
1732 QStringList list ;//= config->readListEntry("MainLayout"); 1733 QStringList list ;//= config->readListEntry("MainLayout");
1733 int x,y,w,h; 1734 int x,y,w,h;
1734 QWidget* wid; 1735 QWidget* wid;
1735 wid = topLevelWidget(); 1736 wid = topLevelWidget();
1736 x = wid->geometry().x(); 1737 x = wid->geometry().x();
1737 y = wid->geometry().y(); 1738 y = wid->geometry().y();
1738 w = wid->width(); 1739 w = wid->width();
1739 h = wid->height(); 1740 h = wid->height();
1740 list.clear(); 1741 list.clear();
1741 list << QString::number( x ); 1742 list << QString::number( x );
1742 list << QString::number( y ); 1743 list << QString::number( y );
1743 list << QString::number( w ); 1744 list << QString::number( w );
1744 list << QString::number( h ); 1745 list << QString::number( h );
1745 config->writeEntry("MainLayout",list ); 1746 config->writeEntry("MainLayout",list );
1746 1747
1747 wid = mEventEditor; 1748 wid = mEventEditor;
1748 x = wid->geometry().x(); 1749 x = wid->geometry().x();
1749 y = wid->geometry().y(); 1750 y = wid->geometry().y();
1750 w = wid->width(); 1751 w = wid->width();
1751 h = wid->height(); 1752 h = wid->height();
1752 list.clear(); 1753 list.clear();
1753 list << QString::number( x ); 1754 list << QString::number( x );
1754 list << QString::number( y ); 1755 list << QString::number( y );
1755 list << QString::number( w ); 1756 list << QString::number( w );
1756 list << QString::number( h ); 1757 list << QString::number( h );
1757 config->writeEntry("EditEventLayout",list ); 1758 config->writeEntry("EditEventLayout",list );
1758 1759
1759 wid = mTodoEditor; 1760 wid = mTodoEditor;
1760 x = wid->geometry().x(); 1761 x = wid->geometry().x();
1761 y = wid->geometry().y(); 1762 y = wid->geometry().y();
1762 w = wid->width(); 1763 w = wid->width();
1763 h = wid->height(); 1764 h = wid->height();
1764 list.clear(); 1765 list.clear();
1765 list << QString::number( x ); 1766 list << QString::number( x );
1766 list << QString::number( y ); 1767 list << QString::number( y );
1767 list << QString::number( w ); 1768 list << QString::number( w );
1768 list << QString::number( h ); 1769 list << QString::number( h );
1769 config->writeEntry("EditTodoLayout",list ); 1770 config->writeEntry("EditTodoLayout",list );
1770 wid = getEventViewerDialog(); 1771 wid = getEventViewerDialog();
1771 x = wid->geometry().x(); 1772 x = wid->geometry().x();
1772 y = wid->geometry().y(); 1773 y = wid->geometry().y();
1773 w = wid->width(); 1774 w = wid->width();
1774 h = wid->height(); 1775 h = wid->height();
1775 list.clear(); 1776 list.clear();
1776 list << QString::number( x ); 1777 list << QString::number( x );
1777 list << QString::number( y ); 1778 list << QString::number( y );
1778 list << QString::number( w ); 1779 list << QString::number( w );
1779 list << QString::number( h ); 1780 list << QString::number( h );
1780 config->writeEntry("ViewerLayout",list ); 1781 config->writeEntry("ViewerLayout",list );
1781 wid = mDialogManager->getSearchDialog(); 1782 wid = mDialogManager->getSearchDialog();
1782 if ( wid ) { 1783 if ( wid ) {
1783 x = wid->geometry().x(); 1784 x = wid->geometry().x();
1784 y = wid->geometry().y(); 1785 y = wid->geometry().y();
1785 w = wid->width(); 1786 w = wid->width();
1786 h = wid->height(); 1787 h = wid->height();
1787 list.clear(); 1788 list.clear();
1788 list << QString::number( x ); 1789 list << QString::number( x );
1789 list << QString::number( y ); 1790 list << QString::number( y );
1790 list << QString::number( w ); 1791 list << QString::number( w );
1791 list << QString::number( h ); 1792 list << QString::number( h );
1792 config->writeEntry("SearchLayout",list ); 1793 config->writeEntry("SearchLayout",list );
1793 } 1794 }
1794#endif 1795#endif
1795 1796
1796 1797
1797 config->sync(); 1798 config->sync();
1798} 1799}
1799 1800
1800void CalendarView::readFilterSettings(KConfig *config) 1801void CalendarView::readFilterSettings(KConfig *config)
1801{ 1802{
1802 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1803 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1803 1804
1804 mFilters.clear(); 1805 mFilters.clear();
1805 1806
1806 config->setGroup("General"); 1807 config->setGroup("General");
1807 QStringList filterList = config->readListEntry("CalendarFilters"); 1808 QStringList filterList = config->readListEntry("CalendarFilters");
1808 1809
1809 QStringList::ConstIterator it = filterList.begin(); 1810 QStringList::ConstIterator it = filterList.begin();
1810 QStringList::ConstIterator end = filterList.end(); 1811 QStringList::ConstIterator end = filterList.end();
1811 while(it != end) { 1812 while(it != end) {
1812 // kdDebug() << " filter: " << (*it) << endl; 1813 // kdDebug() << " filter: " << (*it) << endl;
1813 1814
1814 CalFilter *filter; 1815 CalFilter *filter;
1815 filter = new CalFilter(*it); 1816 filter = new CalFilter(*it);
1816 config->setGroup("Filter_" + (*it)); 1817 config->setGroup("Filter_" + (*it));
1817 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1818 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1818 filter->setCriteria(config->readNumEntry("Criteria",0)); 1819 filter->setCriteria(config->readNumEntry("Criteria",0));
1819 filter->setCategoryList(config->readListEntry("CategoryList")); 1820 filter->setCategoryList(config->readListEntry("CategoryList"));
1820 mFilters.append(filter); 1821 mFilters.append(filter);
1821 1822
1822 ++it; 1823 ++it;
1823 } 1824 }
1824 1825
1825 if (mFilters.count() == 0) { 1826 if (mFilters.count() == 0) {
1826 CalFilter *filter = new CalFilter(i18n("Default")); 1827 CalFilter *filter = new CalFilter(i18n("Default"));
1827 mFilters.append(filter); 1828 mFilters.append(filter);
1828 } 1829 }
1829 mFilterView->updateFilters(); 1830 mFilterView->updateFilters();
1830 config->setGroup("FilterView"); 1831 config->setGroup("FilterView");
1831 1832
1832 mFilterView->blockSignals(true); 1833 mFilterView->blockSignals(true);
1833 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1834 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1834 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1835 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1835 mFilterView->blockSignals(false); 1836 mFilterView->blockSignals(false);
1836 // We do it manually to avoid it being done twice by the above calls 1837 // We do it manually to avoid it being done twice by the above calls
1837 updateFilter(); 1838 updateFilter();
1838} 1839}
1839 1840
1840void CalendarView::writeFilterSettings(KConfig *config) 1841void CalendarView::writeFilterSettings(KConfig *config)
1841{ 1842{
1842 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1843 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1843 1844
1844 QStringList filterList; 1845 QStringList filterList;
1845 1846
1846 CalFilter *filter = mFilters.first(); 1847 CalFilter *filter = mFilters.first();
1847 while(filter) { 1848 while(filter) {
1848 // kdDebug() << " fn: " << filter->name() << endl; 1849 // kdDebug() << " fn: " << filter->name() << endl;
1849 filterList << filter->name(); 1850 filterList << filter->name();
1850 config->setGroup("Filter_" + filter->name()); 1851 config->setGroup("Filter_" + filter->name());
1851 config->writeEntry("Criteria",filter->criteria()); 1852 config->writeEntry("Criteria",filter->criteria());
1852 config->writeEntry("CategoryList",filter->categoryList()); 1853 config->writeEntry("CategoryList",filter->categoryList());
1853 filter = mFilters.next(); 1854 filter = mFilters.next();
1854 } 1855 }
1855 config->setGroup("General"); 1856 config->setGroup("General");
1856 config->writeEntry("CalendarFilters",filterList); 1857 config->writeEntry("CalendarFilters",filterList);
1857 1858
1858 config->setGroup("FilterView"); 1859 config->setGroup("FilterView");
1859 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1860 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1860 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1861 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1861} 1862}
1862 1863
1863 1864
1864void CalendarView::goToday() 1865void CalendarView::goToday()
1865{ 1866{
1866 mNavigator->selectToday(); 1867 mNavigator->selectToday();
1867} 1868}
1868 1869
1869void CalendarView::goNext() 1870void CalendarView::goNext()
1870{ 1871{
1871 mNavigator->selectNext(); 1872 mNavigator->selectNext();
1872} 1873}
1873 1874
1874void CalendarView::goPrevious() 1875void CalendarView::goPrevious()
1875{ 1876{
1876 mNavigator->selectPrevious(); 1877 mNavigator->selectPrevious();
1877} 1878}
1878void CalendarView::goNextMonth() 1879void CalendarView::goNextMonth()
1879{ 1880{
1880 mNavigator->selectNextMonth(); 1881 mNavigator->selectNextMonth();
1881} 1882}
1882 1883
1883void CalendarView::goPreviousMonth() 1884void CalendarView::goPreviousMonth()
1884{ 1885{
1885 mNavigator->selectPreviousMonth(); 1886 mNavigator->selectPreviousMonth();
1886} 1887}
1887void CalendarView::writeLocale() 1888void CalendarView::writeLocale()
1888{ 1889{
1890 //KPimGlobalPrefs::instance()->setGlobalConfig();
1891#if 0
1889 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1892 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1890 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1893 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1891 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1894 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1892 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1895 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1893 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1896 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1894 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1897 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1895 dummy = KOPrefs::instance()->mUserDateFormatShort; 1898 dummy = KOPrefs::instance()->mUserDateFormatShort;
1896 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1899 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1897 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1900 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1898 KOPrefs::instance()->mDaylightsavingStart, 1901 KOPrefs::instance()->mDaylightsavingStart,
1899 KOPrefs::instance()->mDaylightsavingEnd ); 1902 KOPrefs::instance()->mDaylightsavingEnd );
1900 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1903 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1904#endif
1901} 1905}
1902void CalendarView::updateConfig() 1906void CalendarView::updateConfig()
1903{ 1907{
1904 writeLocale(); 1908 writeLocale();
1905 if ( KOPrefs::instance()->mUseAppColors ) 1909 if ( KOPrefs::instance()->mUseAppColors )
1906 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1910 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1907 emit configChanged(); 1911 emit configChanged();
1908 mTodoList->updateConfig(); 1912 mTodoList->updateConfig();
1909 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 1913 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
1910 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1914 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1911 // To make the "fill window" configurations work 1915 // To make the "fill window" configurations work
1912 //mViewManager->raiseCurrentView(); 1916 //mViewManager->raiseCurrentView();
1913} 1917}
1914 1918
1915 1919
1916void CalendarView::eventChanged(Event *event) 1920void CalendarView::eventChanged(Event *event)
1917{ 1921{
1918 changeEventDisplay(event,KOGlobals::EVENTEDITED); 1922 changeEventDisplay(event,KOGlobals::EVENTEDITED);
1919 //updateUnmanagedViews(); 1923 //updateUnmanagedViews();
1920} 1924}
1921 1925
1922void CalendarView::eventAdded(Event *event) 1926void CalendarView::eventAdded(Event *event)
1923{ 1927{
1924 changeEventDisplay(event,KOGlobals::EVENTADDED); 1928 changeEventDisplay(event,KOGlobals::EVENTADDED);
1925} 1929}
1926 1930
1927void CalendarView::eventToBeDeleted(Event *) 1931void CalendarView::eventToBeDeleted(Event *)
1928{ 1932{
1929 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 1933 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
1930} 1934}
1931 1935
1932void CalendarView::eventDeleted() 1936void CalendarView::eventDeleted()
1933{ 1937{
1934 changeEventDisplay(0,KOGlobals::EVENTDELETED); 1938 changeEventDisplay(0,KOGlobals::EVENTDELETED);
1935} 1939}
1936void CalendarView::changeTodoDisplay(Todo *which, int action) 1940void CalendarView::changeTodoDisplay(Todo *which, int action)
1937{ 1941{
1938 changeIncidenceDisplay((Incidence *)which, action); 1942 changeIncidenceDisplay((Incidence *)which, action);
1939 mDateNavigator->updateView(); //LR 1943 mDateNavigator->updateView(); //LR
1940 //mDialogManager->updateSearchDialog(); 1944 //mDialogManager->updateSearchDialog();
1941 1945
1942 if (which) { 1946 if (which) {
1943 mViewManager->updateWNview(); 1947 mViewManager->updateWNview();
1944 //mTodoList->updateView(); 1948 //mTodoList->updateView();
1945 } 1949 }
1946 1950
1947} 1951}
1948 1952
1949void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 1953void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
1950{ 1954{
1951 updateUnmanagedViews(); 1955 updateUnmanagedViews();
1952 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 1956 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
1953 if ( action == KOGlobals::EVENTDELETED ) { //delete 1957 if ( action == KOGlobals::EVENTDELETED ) { //delete
1954 mCalendar->checkAlarmForIncidence( 0, true ); 1958 mCalendar->checkAlarmForIncidence( 0, true );
1955 if ( mEventViewerDialog ) 1959 if ( mEventViewerDialog )
1956 mEventViewerDialog->hide(); 1960 mEventViewerDialog->hide();
1957 } 1961 }
1958 else 1962 else
1959 mCalendar->checkAlarmForIncidence( which , false ); 1963 mCalendar->checkAlarmForIncidence( which , false );
1960} 1964}
1961 1965
1962// most of the changeEventDisplays() right now just call the view's 1966// most of the changeEventDisplays() right now just call the view's
1963// total update mode, but they SHOULD be recoded to be more refresh-efficient. 1967// total update mode, but they SHOULD be recoded to be more refresh-efficient.
1964void CalendarView::changeEventDisplay(Event *which, int action) 1968void CalendarView::changeEventDisplay(Event *which, int action)
1965{ 1969{
1966 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 1970 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
1967 changeIncidenceDisplay((Incidence *)which, action); 1971 changeIncidenceDisplay((Incidence *)which, action);
1968 mDateNavigator->updateView(); 1972 mDateNavigator->updateView();
1969 //mDialogManager->updateSearchDialog(); 1973 //mDialogManager->updateSearchDialog();
1970 1974
1971 if (which) { 1975 if (which) {
1972 // If there is an event view visible update the display 1976 // If there is an event view visible update the display
1973 mViewManager->currentView()->changeEventDisplay(which,action); 1977 mViewManager->currentView()->changeEventDisplay(which,action);
1974 // TODO: check, if update needed 1978 // TODO: check, if update needed
1975 // if (which->getTodoStatus()) { 1979 // if (which->getTodoStatus()) {
1976 mTodoList->updateView(); 1980 mTodoList->updateView();
1977 // } 1981 // }
1978 } else { 1982 } else {
1979 mViewManager->currentView()->updateView(); 1983 mViewManager->currentView()->updateView();
1980 } 1984 }
1981} 1985}
1982 1986
1983 1987
1984void CalendarView::updateTodoViews() 1988void CalendarView::updateTodoViews()
1985{ 1989{
1986 1990
1987 mTodoList->updateView(); 1991 mTodoList->updateView();
1988 mViewManager->currentView()->updateView(); 1992 mViewManager->currentView()->updateView();
1989 1993
1990} 1994}
1991 1995
1992 1996
1993void CalendarView::updateView(const QDate &start, const QDate &end) 1997void CalendarView::updateView(const QDate &start, const QDate &end)
1994{ 1998{
1995 mTodoList->updateView(); 1999 mTodoList->updateView();
1996 mViewManager->updateView(start, end); 2000 mViewManager->updateView(start, end);
1997 //mDateNavigator->updateView(); 2001 //mDateNavigator->updateView();
1998} 2002}
1999 2003
2000void CalendarView::updateView() 2004void CalendarView::updateView()
2001{ 2005{
2002 DateList tmpList = mNavigator->selectedDates(); 2006 DateList tmpList = mNavigator->selectedDates();
2003 2007
2004 // We assume that the navigator only selects consecutive days. 2008 // We assume that the navigator only selects consecutive days.
2005 updateView( tmpList.first(), tmpList.last() ); 2009 updateView( tmpList.first(), tmpList.last() );
2006} 2010}
2007 2011
2008void CalendarView::updateUnmanagedViews() 2012void CalendarView::updateUnmanagedViews()
2009{ 2013{
2010 mDateNavigator->updateDayMatrix(); 2014 mDateNavigator->updateDayMatrix();
2011} 2015}
2012 2016
2013int CalendarView::msgItemDelete() 2017int CalendarView::msgItemDelete()
2014{ 2018{
2015 return KMessageBox::warningContinueCancel(this, 2019 return KMessageBox::warningContinueCancel(this,
2016 i18n("This item will be\npermanently deleted."), 2020 i18n("This item will be\npermanently deleted."),
2017 i18n("KO/Pi Confirmation"),i18n("Delete")); 2021 i18n("KO/Pi Confirmation"),i18n("Delete"));
2018} 2022}
2019 2023
2020 2024
2021void CalendarView::edit_cut() 2025void CalendarView::edit_cut()
2022{ 2026{
2023 Event *anEvent=0; 2027 Event *anEvent=0;
2024 2028
2025 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2029 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2026 2030
2027 if (mViewManager->currentView()->isEventView()) { 2031 if (mViewManager->currentView()->isEventView()) {
2028 if ( incidence && incidence->type() == "Event" ) { 2032 if ( incidence && incidence->type() == "Event" ) {
2029 anEvent = static_cast<Event *>(incidence); 2033 anEvent = static_cast<Event *>(incidence);
2030 } 2034 }
2031 } 2035 }
2032 2036
2033 if (!anEvent) { 2037 if (!anEvent) {
2034 KNotifyClient::beep(); 2038 KNotifyClient::beep();
2035 return; 2039 return;
2036 } 2040 }
2037 DndFactory factory( mCalendar ); 2041 DndFactory factory( mCalendar );
2038 factory.cutEvent(anEvent); 2042 factory.cutEvent(anEvent);
2039 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2043 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2040} 2044}
2041 2045
2042void CalendarView::edit_copy() 2046void CalendarView::edit_copy()
2043{ 2047{
2044 Event *anEvent=0; 2048 Event *anEvent=0;
2045 2049
2046 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2050 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2047 2051
2048 if (mViewManager->currentView()->isEventView()) { 2052 if (mViewManager->currentView()->isEventView()) {
2049 if ( incidence && incidence->type() == "Event" ) { 2053 if ( incidence && incidence->type() == "Event" ) {
2050 anEvent = static_cast<Event *>(incidence); 2054 anEvent = static_cast<Event *>(incidence);
2051 } 2055 }
2052 } 2056 }
2053 2057
2054 if (!anEvent) { 2058 if (!anEvent) {
2055 KNotifyClient::beep(); 2059 KNotifyClient::beep();
2056 return; 2060 return;
2057 } 2061 }
2058 DndFactory factory( mCalendar ); 2062 DndFactory factory( mCalendar );
2059 factory.copyEvent(anEvent); 2063 factory.copyEvent(anEvent);
2060} 2064}
2061 2065
2062void CalendarView::edit_paste() 2066void CalendarView::edit_paste()
2063{ 2067{
2064 QDate date = mNavigator->selectedDates().first(); 2068 QDate date = mNavigator->selectedDates().first();
2065 2069
2066 DndFactory factory( mCalendar ); 2070 DndFactory factory( mCalendar );
2067 Event *pastedEvent = factory.pasteEvent( date ); 2071 Event *pastedEvent = factory.pasteEvent( date );
2068 2072
2069 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2073 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2070} 2074}
2071 2075
2072void CalendarView::edit_options() 2076void CalendarView::edit_options()
2073{ 2077{
2074 mDialogManager->showOptionsDialog(); 2078 mDialogManager->showOptionsDialog();
2075 //writeSettings(); 2079 //writeSettings();
2076} 2080}
2077void CalendarView::edit_sync_options() 2081void CalendarView::edit_sync_options()
2078{ 2082{
2079 //mDialogManager->showSyncOptions(); 2083 //mDialogManager->showSyncOptions();
2080 //KOPrefs::instance()->mSyncAlgoPrefs 2084 //KOPrefs::instance()->mSyncAlgoPrefs
2081 QDialog dia( this, "dia", true ); 2085 QDialog dia( this, "dia", true );
2082 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 2086 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
2083 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); 2087 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
2084 QVBoxLayout lay ( &dia ); 2088 QVBoxLayout lay ( &dia );
2085 lay.setSpacing( 2 ); 2089 lay.setSpacing( 2 );
2086 lay.setMargin( 3 ); 2090 lay.setMargin( 3 );
2087 lay.addWidget(&gr); 2091 lay.addWidget(&gr);
2088 QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); 2092 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
2089 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); 2093 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
2090 QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); 2094 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
2091 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); 2095 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
2092 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); 2096 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
2093 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); 2097 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
2094 //QRadioButton both( i18n("Take both on conflict"), &gr ); 2098 //QRadioButton both( i18n("Take both on conflict"), &gr );
2095 QPushButton pb ( "OK", &dia); 2099 QPushButton pb ( "OK", &dia);
2096 lay.addWidget( &pb ); 2100 lay.addWidget( &pb );
2097 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 2101 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
2098 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { 2102 switch ( KOPrefs::instance()->mSyncAlgoPrefs ) {
2099 case 0: 2103 case 0:
2100 loc.setChecked( true); 2104 loc.setChecked( true);
2101 break; 2105 break;
2102 case 1: 2106 case 1:
2103 rem.setChecked( true ); 2107 rem.setChecked( true );
2104 break; 2108 break;
2105 case 2: 2109 case 2:
2106 newest.setChecked( true); 2110 newest.setChecked( true);
2107 break; 2111 break;
2108 case 3: 2112 case 3:
2109 ask.setChecked( true); 2113 ask.setChecked( true);
2110 break; 2114 break;
2111 case 4: 2115 case 4:
2112 f_loc.setChecked( true); 2116 f_loc.setChecked( true);
2113 break; 2117 break;
2114 case 5: 2118 case 5:
2115 f_rem.setChecked( true); 2119 f_rem.setChecked( true);
2116 break; 2120 break;
2117 case 6: 2121 case 6:
2118 // both.setChecked( true); 2122 // both.setChecked( true);
2119 break; 2123 break;
2120 default: 2124 default:
2121 break; 2125 break;
2122 } 2126 }
2123 if ( dia.exec() ) { 2127 if ( dia.exec() ) {
2124 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; 2128 KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
2125 } 2129 }
2126 2130
2127} 2131}
2128 2132
2129void CalendarView::slotSelectPickerDate( QDate d) 2133void CalendarView::slotSelectPickerDate( QDate d)
2130{ 2134{
2131 mDateFrame->hide(); 2135 mDateFrame->hide();
2132 if ( mDatePickerMode == 1 ) { 2136 if ( mDatePickerMode == 1 ) {
2133 mNavigator->slotDaySelect( d ); 2137 mNavigator->slotDaySelect( d );
2134 } else if ( mDatePickerMode == 2 ) { 2138 } else if ( mDatePickerMode == 2 ) {
2135 if ( mMoveIncidence->type() == "Todo" ) { 2139 if ( mMoveIncidence->type() == "Todo" ) {
2136 Todo * to = (Todo *) mMoveIncidence; 2140 Todo * to = (Todo *) mMoveIncidence;
2137 QTime tim; 2141 QTime tim;
2138 if ( to->hasDueDate() ) 2142 if ( to->hasDueDate() )
2139 tim = to->dtDue().time(); 2143 tim = to->dtDue().time();
2140 else { 2144 else {
2141 tim = QTime ( 0,0,0 ); 2145 tim = QTime ( 0,0,0 );
2142 to->setFloats( true ); 2146 to->setFloats( true );
2143 to->setHasDueDate( true ); 2147 to->setHasDueDate( true );
2144 } 2148 }
2145 QDateTime dt ( d,tim ); 2149 QDateTime dt ( d,tim );
2146 to->setDtDue( dt ); 2150 to->setDtDue( dt );
2147 todoChanged( to ); 2151 todoChanged( to );
2148 } else { 2152 } else {
2149 QTime tim = mMoveIncidence->dtStart().time(); 2153 QTime tim = mMoveIncidence->dtStart().time();
2150 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2154 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2151 QDateTime dt ( d,tim ); 2155 QDateTime dt ( d,tim );
2152 mMoveIncidence->setDtStart( dt ); 2156 mMoveIncidence->setDtStart( dt );
2153 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2157 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2154 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2158 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2155 } 2159 }
2156 2160
2157 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2161 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2158 } 2162 }
2159} 2163}
2160 2164
2161void CalendarView::removeCategories() 2165void CalendarView::removeCategories()
2162{ 2166{
2163 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2167 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2164 QStringList catList = KOPrefs::instance()->mCustomCategories; 2168 QStringList catList = KOPrefs::instance()->mCustomCategories;
2165 QStringList catIncList; 2169 QStringList catIncList;
2166 QStringList newCatList; 2170 QStringList newCatList;
2167 Incidence* inc = incList.first(); 2171 Incidence* inc = incList.first();
2168 int i; 2172 int i;
2169 int count = 0; 2173 int count = 0;
2170 while ( inc ) { 2174 while ( inc ) {
2171 newCatList.clear(); 2175 newCatList.clear();
2172 catIncList = inc->categories() ; 2176 catIncList = inc->categories() ;
2173 for( i = 0; i< catIncList.count(); ++i ) { 2177 for( i = 0; i< catIncList.count(); ++i ) {
2174 if ( catList.contains (catIncList[i])) 2178 if ( catList.contains (catIncList[i]))
2175 newCatList.append( catIncList[i] ); 2179 newCatList.append( catIncList[i] );
2176 } 2180 }
2177 newCatList.sort(); 2181 newCatList.sort();
2178 inc->setCategories( newCatList.join(",") ); 2182 inc->setCategories( newCatList.join(",") );
2179 inc = incList.next(); 2183 inc = incList.next();
2180 } 2184 }
2181} 2185}
2182 2186
2183int CalendarView::addCategories() 2187int CalendarView::addCategories()
2184{ 2188{
2185 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2189 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2186 QStringList catList = KOPrefs::instance()->mCustomCategories; 2190 QStringList catList = KOPrefs::instance()->mCustomCategories;
2187 QStringList catIncList; 2191 QStringList catIncList;
2188 Incidence* inc = incList.first(); 2192 Incidence* inc = incList.first();
2189 int i; 2193 int i;
2190 int count = 0; 2194 int count = 0;
2191 while ( inc ) { 2195 while ( inc ) {
2192 catIncList = inc->categories() ; 2196 catIncList = inc->categories() ;
2193 for( i = 0; i< catIncList.count(); ++i ) { 2197 for( i = 0; i< catIncList.count(); ++i ) {
2194 if ( !catList.contains (catIncList[i])) { 2198 if ( !catList.contains (catIncList[i])) {
2195 catList.append( catIncList[i] ); 2199 catList.append( catIncList[i] );
2196 //qDebug("add cat %s ", catIncList[i].latin1()); 2200 //qDebug("add cat %s ", catIncList[i].latin1());
2197 ++count; 2201 ++count;
2198 } 2202 }
2199 } 2203 }
2200 inc = incList.next(); 2204 inc = incList.next();
2201 } 2205 }
2202 catList.sort(); 2206 catList.sort();
2203 KOPrefs::instance()->mCustomCategories = catList; 2207 KOPrefs::instance()->mCustomCategories = catList;
2204 return count; 2208 return count;
2205} 2209}
2206 2210
2207void CalendarView::manageCategories() 2211void CalendarView::manageCategories()
2208{ 2212{
2209 KOCatPrefs* cp = new KOCatPrefs(); 2213 KOCatPrefs* cp = new KOCatPrefs();
2210 cp->show(); 2214 cp->show();
2211 int w =cp->sizeHint().width() ; 2215 int w =cp->sizeHint().width() ;
2212 int h = cp->sizeHint().height() ; 2216 int h = cp->sizeHint().height() ;
2213 int dw = QApplication::desktop()->width(); 2217 int dw = QApplication::desktop()->width();
2214 int dh = QApplication::desktop()->height(); 2218 int dh = QApplication::desktop()->height();
2215 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2219 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2216 if ( !cp->exec() ) { 2220 if ( !cp->exec() ) {
2217 delete cp; 2221 delete cp;
2218 return; 2222 return;
2219 } 2223 }
2220 int count = 0; 2224 int count = 0;
2221 if ( cp->addCat() ) { 2225 if ( cp->addCat() ) {
2222 count = addCategories(); 2226 count = addCategories();
2223 if ( count ) { 2227 if ( count ) {
2224 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2228 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2225 writeSettings(); 2229 writeSettings();
2226 } 2230 }
2227 } else { 2231 } else {
2228 removeCategories(); 2232 removeCategories();
2229 updateView(); 2233 updateView();
2230 } 2234 }
2231 delete cp; 2235 delete cp;
2232} 2236}
2233 2237
2234void CalendarView::beamIncidence(Incidence * Inc) 2238void CalendarView::beamIncidence(Incidence * Inc)
2235{ 2239{
2236 QPtrList<Incidence> delSel ; 2240 QPtrList<Incidence> delSel ;
2237 delSel.append(Inc); 2241 delSel.append(Inc);
2238 beamIncidenceList( delSel ); 2242 beamIncidenceList( delSel );
2239} 2243}
2240void CalendarView::beamCalendar() 2244void CalendarView::beamCalendar()
2241{ 2245{
2242 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2246 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2243 //qDebug("beamCalendar() "); 2247 //qDebug("beamCalendar() ");
2244 beamIncidenceList( delSel ); 2248 beamIncidenceList( delSel );
2245} 2249}
2246void CalendarView::beamFilteredCalendar() 2250void CalendarView::beamFilteredCalendar()
2247{ 2251{
2248 QPtrList<Incidence> delSel = mCalendar->incidences(); 2252 QPtrList<Incidence> delSel = mCalendar->incidences();
2249 //qDebug("beamFilteredCalendar() "); 2253 //qDebug("beamFilteredCalendar() ");
2250 beamIncidenceList( delSel ); 2254 beamIncidenceList( delSel );
2251} 2255}
2252void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2256void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2253{ 2257{
2254 if ( beamDialog->exec () == QDialog::Rejected ) 2258 if ( beamDialog->exec () == QDialog::Rejected )
2255 return; 2259 return;
2256 2260
2257 QString fn = "/tmp/kopibeamfile"; 2261 QString fn = "/tmp/kopibeamfile";
2258 QString mes; 2262 QString mes;
2259 bool createbup = true; 2263 bool createbup = true;
2260 if ( createbup ) { 2264 if ( createbup ) {
2261 QString description = "\n"; 2265 QString description = "\n";
2262 CalendarLocal* cal = new CalendarLocal(); 2266 CalendarLocal* cal = new CalendarLocal();
2263 if ( beamDialog->beamLocal() ) 2267 if ( beamDialog->beamLocal() )
2264 cal->setLocalTime(); 2268 cal->setLocalTime();
2265 else 2269 else
2266 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2270 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2267 Incidence *incidence = delSel.first(); 2271 Incidence *incidence = delSel.first();
2268 bool addText = false; 2272 bool addText = false;
2269 if ( delSel.count() < 10 ) 2273 if ( delSel.count() < 10 )
2270 addText = true; 2274 addText = true;
2271 else { 2275 else {
2272 description.sprintf(i18n(" %d items?"),delSel.count() ); 2276 description.sprintf(i18n(" %d items?"),delSel.count() );
2273 } 2277 }
2274 while ( incidence ) { 2278 while ( incidence ) {
2275 Incidence *in = incidence->clone(); 2279 Incidence *in = incidence->clone();
2276 if ( addText ) 2280 if ( addText )
2277 description += in->summary() + "\n"; 2281 description += in->summary() + "\n";
2278 cal->addIncidence( in ); 2282 cal->addIncidence( in );
2279 incidence = delSel.next(); 2283 incidence = delSel.next();
2280 } 2284 }
2281 if ( beamDialog->beamVcal() ) { 2285 if ( beamDialog->beamVcal() ) {
2282 fn += ".vcs"; 2286 fn += ".vcs";
2283 FileStorage storage( cal, fn, new VCalFormat ); 2287 FileStorage storage( cal, fn, new VCalFormat );
2284 storage.save(); 2288 storage.save();
2285 } else { 2289 } else {
2286 fn += ".ics"; 2290 fn += ".ics";
2287 FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 2291 FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
2288 storage.save(); 2292 storage.save();
2289 } 2293 }
2290 delete cal; 2294 delete cal;
2291 mes = i18n("KO/Pi: Ready for beaming"); 2295 mes = i18n("KO/Pi: Ready for beaming");
2292 setCaption(mes); 2296 setCaption(mes);
2293 2297
2294#ifndef DESKTOP_VERSION 2298#ifndef DESKTOP_VERSION
2295 Ir *ir = new Ir( this ); 2299 Ir *ir = new Ir( this );
2296 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2300 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2297 ir->send( fn, description, "text/x-vCalendar" ); 2301 ir->send( fn, description, "text/x-vCalendar" );
2298#endif 2302#endif
2299 } 2303 }
2300} 2304}
2301void CalendarView::beamDone( Ir *ir ) 2305void CalendarView::beamDone( Ir *ir )
2302{ 2306{
2303#ifndef DESKTOP_VERSION 2307#ifndef DESKTOP_VERSION
2304 delete ir; 2308 delete ir;
2305#endif 2309#endif
2306} 2310}
2307 2311
2308void CalendarView::moveIncidence(Incidence * inc ) 2312void CalendarView::moveIncidence(Incidence * inc )
2309{ 2313{
2310 if ( !inc ) return; 2314 if ( !inc ) return;
2311 // qDebug("showDatePickerForIncidence( ) "); 2315 // qDebug("showDatePickerForIncidence( ) ");
2312 if ( mDateFrame->isVisible() ) 2316 if ( mDateFrame->isVisible() )
2313 mDateFrame->hide(); 2317 mDateFrame->hide();
2314 else { 2318 else {
2315 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2319 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2316 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2320 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2317 int dw = QApplication::desktop()->width(); 2321 int dw = QApplication::desktop()->width();
2318 int dh = QApplication::desktop()->height(); 2322 int dh = QApplication::desktop()->height();
2319 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2323 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2320 mDateFrame->show(); 2324 mDateFrame->show();
2321 } 2325 }
2322 mDatePickerMode = 2; 2326 mDatePickerMode = 2;
2323 mMoveIncidence = inc ; 2327 mMoveIncidence = inc ;
2324 QDate da; 2328 QDate da;
2325 if ( mMoveIncidence->type() == "Todo" ) { 2329 if ( mMoveIncidence->type() == "Todo" ) {
2326 Todo * to = (Todo *) mMoveIncidence; 2330 Todo * to = (Todo *) mMoveIncidence;
2327 if ( to->hasDueDate() ) 2331 if ( to->hasDueDate() )
2328 da = to->dtDue().date(); 2332 da = to->dtDue().date();
2329 else 2333 else
2330 da = QDate::currentDate(); 2334 da = QDate::currentDate();
2331 } else { 2335 } else {
2332 da = mMoveIncidence->dtStart().date(); 2336 da = mMoveIncidence->dtStart().date();
2333 } 2337 }
2334 mDatePicker->setDate( da ); 2338 mDatePicker->setDate( da );
2335} 2339}
2336void CalendarView::showDatePicker( ) 2340void CalendarView::showDatePicker( )
2337{ 2341{
2338 //qDebug("CalendarView::showDatePicker( ) "); 2342 //qDebug("CalendarView::showDatePicker( ) ");
2339 if ( mDateFrame->isVisible() ) 2343 if ( mDateFrame->isVisible() )
2340 mDateFrame->hide(); 2344 mDateFrame->hide();
2341 else { 2345 else {
2342 int w =mDatePicker->sizeHint().width() ; 2346 int w =mDatePicker->sizeHint().width() ;
2343 int h = mDatePicker->sizeHint().height() ; 2347 int h = mDatePicker->sizeHint().height() ;
2344 int dw = QApplication::desktop()->width(); 2348 int dw = QApplication::desktop()->width();
2345 int dh = QApplication::desktop()->height(); 2349 int dh = QApplication::desktop()->height();
2346 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2350 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2347 mDateFrame->show(); 2351 mDateFrame->show();
2348 } 2352 }
2349 mDatePickerMode = 1; 2353 mDatePickerMode = 1;
2350 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2354 mDatePicker->setDate( mNavigator->selectedDates().first() );
2351} 2355}
2352 2356
2353void CalendarView::showEventEditor() 2357void CalendarView::showEventEditor()
2354{ 2358{
2355#ifdef DESKTOP_VERSION 2359#ifdef DESKTOP_VERSION
2356 mEventEditor->show(); 2360 mEventEditor->show();
2357#else 2361#else
2358 mEventEditor->showMaximized(); 2362 mEventEditor->showMaximized();
2359#endif 2363#endif
2360} 2364}
2361void CalendarView::showTodoEditor() 2365void CalendarView::showTodoEditor()
2362{ 2366{
2363#ifdef DESKTOP_VERSION 2367#ifdef DESKTOP_VERSION
2364 mTodoEditor->show(); 2368 mTodoEditor->show();
2365#else 2369#else
2366 mTodoEditor->showMaximized(); 2370 mTodoEditor->showMaximized();
2367#endif 2371#endif
2368} 2372}
2369void CalendarView::cancelIncidence(Incidence * inc ) 2373void CalendarView::cancelIncidence(Incidence * inc )
2370{ 2374{
2371 inc->setCancelled( ! inc->cancelled() ); 2375 inc->setCancelled( ! inc->cancelled() );
2372 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2376 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2373 updateView(); 2377 updateView();
2374} 2378}
2375void CalendarView::cloneIncidence(Incidence * orgInc ) 2379void CalendarView::cloneIncidence(Incidence * orgInc )
2376{ 2380{
2377 Incidence * newInc = orgInc->clone(); 2381 Incidence * newInc = orgInc->clone();
2378 newInc->recreate(); 2382 newInc->recreate();
2379 2383
2380 if ( newInc->type() == "Todo" ) { 2384 if ( newInc->type() == "Todo" ) {
2381 Todo* t = (Todo*) newInc; 2385 Todo* t = (Todo*) newInc;
2382 mTodoEditor->editTodo( t ); 2386 mTodoEditor->editTodo( t );
2383 showTodoEditor(); 2387 showTodoEditor();
2384 if ( mTodoEditor->exec() ) { 2388 if ( mTodoEditor->exec() ) {
2385 mCalendar->addTodo( t ); 2389 mCalendar->addTodo( t );
2386 updateView(); 2390 updateView();
2387 } else { 2391 } else {
2388 delete t; 2392 delete t;
2389 } 2393 }
2390 } 2394 }
2391 else { 2395 else {
2392 Event* e = (Event*) newInc; 2396 Event* e = (Event*) newInc;
2393 mEventEditor->editEvent( e ); 2397 mEventEditor->editEvent( e );
2394 showEventEditor(); 2398 showEventEditor();
2395 if ( mEventEditor->exec() ) { 2399 if ( mEventEditor->exec() ) {
2396 mCalendar->addEvent( e ); 2400 mCalendar->addEvent( e );
2397 updateView(); 2401 updateView();
2398 } else { 2402 } else {
2399 delete e; 2403 delete e;
2400 } 2404 }
2401 } 2405 }
2402} 2406}
2403 2407
2404void CalendarView::newEvent() 2408void CalendarView::newEvent()
2405{ 2409{
2406 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2410 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2407 KOAgendaView *aView = mViewManager->agendaView(); 2411 KOAgendaView *aView = mViewManager->agendaView();
2408 if (aView) { 2412 if (aView) {
2409 if (aView->selectionStart().isValid()) { 2413 if (aView->selectionStart().isValid()) {
2410 if (aView->selectedIsAllDay()) { 2414 if (aView->selectedIsAllDay()) {
2411 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2415 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2412 } else { 2416 } else {
2413 newEvent(aView->selectionStart(),aView->selectionEnd()); 2417 newEvent(aView->selectionStart(),aView->selectionEnd());
2414 } 2418 }
2415 return; 2419 return;
2416 } 2420 }
2417 } 2421 }
2418 2422
2419 QDate date = mNavigator->selectedDates().first(); 2423 QDate date = mNavigator->selectedDates().first();
2420 QDateTime current = QDateTime::currentDateTime(); 2424 QDateTime current = QDateTime::currentDateTime();
2421 if ( date <= current.date() ) { 2425 if ( date <= current.date() ) {
2422 int hour = current.time().hour() +1; 2426 int hour = current.time().hour() +1;
2423 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2427 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2424 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2428 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2425 } else 2429 } else
2426 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2430 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2427 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2431 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2428 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2432 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2429} 2433}
2430 2434
2431void CalendarView::newEvent(QDateTime fh) 2435void CalendarView::newEvent(QDateTime fh)
2432{ 2436{
2433 newEvent(fh, 2437 newEvent(fh,
2434 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2438 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2435} 2439}
2436 2440
2437void CalendarView::newEvent(QDate dt) 2441void CalendarView::newEvent(QDate dt)
2438{ 2442{
2439 newEvent(QDateTime(dt, QTime(0,0,0)), 2443 newEvent(QDateTime(dt, QTime(0,0,0)),
2440 QDateTime(dt, QTime(0,0,0)), true); 2444 QDateTime(dt, QTime(0,0,0)), true);
2441} 2445}
2442 2446
2443void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2447void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2444{ 2448{
2445 2449
2446 mEventEditor->newEvent(fromHint,toHint,allDay); 2450 mEventEditor->newEvent(fromHint,toHint,allDay);
2447 if ( mFilterView->filtersEnabled() ) { 2451 if ( mFilterView->filtersEnabled() ) {
2448 CalFilter *filter = mFilterView->selectedFilter(); 2452 CalFilter *filter = mFilterView->selectedFilter();
2449 if (filter && filter->showCategories()) { 2453 if (filter && filter->showCategories()) {
2450 mEventEditor->setCategories(filter->categoryList().join(",") ); 2454 mEventEditor->setCategories(filter->categoryList().join(",") );
2451 } 2455 }
2452 if ( filter ) 2456 if ( filter )
2453 mEventEditor->setSecrecy( filter->getSecrecy() ); 2457 mEventEditor->setSecrecy( filter->getSecrecy() );
2454 } 2458 }
2455 showEventEditor(); 2459 showEventEditor();
2456} 2460}
2457void CalendarView::todoAdded(Todo * t) 2461void CalendarView::todoAdded(Todo * t)
2458{ 2462{
2459 2463
2460 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2464 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2461 updateTodoViews(); 2465 updateTodoViews();
2462} 2466}
2463void CalendarView::todoChanged(Todo * t) 2467void CalendarView::todoChanged(Todo * t)
2464{ 2468{
2465 emit todoModified( t, 4 ); 2469 emit todoModified( t, 4 );
2466 // updateTodoViews(); 2470 // updateTodoViews();
2467} 2471}
2468void CalendarView::todoToBeDeleted(Todo *) 2472void CalendarView::todoToBeDeleted(Todo *)
2469{ 2473{
2470 //qDebug("todoToBeDeleted(Todo *) "); 2474 //qDebug("todoToBeDeleted(Todo *) ");
2471 updateTodoViews(); 2475 updateTodoViews();
2472} 2476}
2473void CalendarView::todoDeleted() 2477void CalendarView::todoDeleted()
2474{ 2478{
2475 //qDebug(" todoDeleted()"); 2479 //qDebug(" todoDeleted()");
2476 updateTodoViews(); 2480 updateTodoViews();
2477} 2481}
2478 2482
2479 2483
2480 2484
2481void CalendarView::newTodo() 2485void CalendarView::newTodo()
2482{ 2486{
2483 2487
2484 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2488 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2485 if ( mFilterView->filtersEnabled() ) { 2489 if ( mFilterView->filtersEnabled() ) {
2486 CalFilter *filter = mFilterView->selectedFilter(); 2490 CalFilter *filter = mFilterView->selectedFilter();
2487 if (filter && filter->showCategories()) { 2491 if (filter && filter->showCategories()) {
2488 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2492 mTodoEditor->setCategories(filter->categoryList().join(",") );
2489 } 2493 }
2490 if ( filter ) 2494 if ( filter )
2491 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2495 mTodoEditor->setSecrecy( filter->getSecrecy() );
2492 } 2496 }
2493 showTodoEditor(); 2497 showTodoEditor();
2494} 2498}
2495 2499
2496void CalendarView::newSubTodo() 2500void CalendarView::newSubTodo()
2497{ 2501{
2498 Todo *todo = selectedTodo(); 2502 Todo *todo = selectedTodo();
2499 if ( todo ) newSubTodo( todo ); 2503 if ( todo ) newSubTodo( todo );
2500} 2504}
2501 2505
2502void CalendarView::newSubTodo(Todo *parentEvent) 2506void CalendarView::newSubTodo(Todo *parentEvent)
2503{ 2507{
2504 2508
2505 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2509 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2506 showTodoEditor(); 2510 showTodoEditor();
2507} 2511}
2508 2512
2509void CalendarView::newFloatingEvent() 2513void CalendarView::newFloatingEvent()
2510{ 2514{
2511 DateList tmpList = mNavigator->selectedDates(); 2515 DateList tmpList = mNavigator->selectedDates();
2512 QDate date = tmpList.first(); 2516 QDate date = tmpList.first();
2513 2517
2514 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2518 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2515 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2519 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2516} 2520}
2517 2521
2518 2522
2519void CalendarView::editEvent( Event *event ) 2523void CalendarView::editEvent( Event *event )
2520{ 2524{
2521 2525
2522 if ( !event ) return; 2526 if ( !event ) return;
2523 if ( event->isReadOnly() ) { 2527 if ( event->isReadOnly() ) {
2524 showEvent( event ); 2528 showEvent( event );
2525 return; 2529 return;
2526 } 2530 }
2527 mEventEditor->editEvent( event , mFlagEditDescription); 2531 mEventEditor->editEvent( event , mFlagEditDescription);
2528 showEventEditor(); 2532 showEventEditor();
2529} 2533}
2530void CalendarView::editJournal( Journal *jour ) 2534void CalendarView::editJournal( Journal *jour )
2531{ 2535{
2532 if ( !jour ) return; 2536 if ( !jour ) return;
2533 mDialogManager->hideSearchDialog(); 2537 mDialogManager->hideSearchDialog();
2534 mViewManager->showJournalView(); 2538 mViewManager->showJournalView();
2535 mNavigator->slotDaySelect( jour->dtStart().date() ); 2539 mNavigator->slotDaySelect( jour->dtStart().date() );
2536} 2540}
2537void CalendarView::editTodo( Todo *todo ) 2541void CalendarView::editTodo( Todo *todo )
2538{ 2542{
2539 if ( !todo ) return; 2543 if ( !todo ) return;
2540 2544
2541 if ( todo->isReadOnly() ) { 2545 if ( todo->isReadOnly() ) {
2542 showTodo( todo ); 2546 showTodo( todo );
2543 return; 2547 return;
2544 } 2548 }
2545 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2549 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2546 showTodoEditor(); 2550 showTodoEditor();
2547 2551
2548} 2552}
2549 2553
2550KOEventViewerDialog* CalendarView::getEventViewerDialog() 2554KOEventViewerDialog* CalendarView::getEventViewerDialog()
2551{ 2555{
2552 if ( !mEventViewerDialog ) { 2556 if ( !mEventViewerDialog ) {
2553 mEventViewerDialog = new KOEventViewerDialog(this); 2557 mEventViewerDialog = new KOEventViewerDialog(this);
2554 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2558 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2555 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2559 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2556 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2560 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2557 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2561 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2558 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2562 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2559 viewManager(), SLOT( showAgendaView( bool ) ) ); 2563 viewManager(), SLOT( showAgendaView( bool ) ) );
2560 mEventViewerDialog->resize( 640, 480 ); 2564 mEventViewerDialog->resize( 640, 480 );
2561 2565
2562 } 2566 }
2563 return mEventViewerDialog; 2567 return mEventViewerDialog;
2564} 2568}
2565void CalendarView::showEvent(Event *event) 2569void CalendarView::showEvent(Event *event)
2566{ 2570{
2567 getEventViewerDialog()->setEvent(event); 2571 getEventViewerDialog()->setEvent(event);
2568 getEventViewerDialog()->showMe(); 2572 getEventViewerDialog()->showMe();
2569} 2573}
2570 2574
2571void CalendarView::showTodo(Todo *event) 2575void CalendarView::showTodo(Todo *event)
2572{ 2576{
2573 getEventViewerDialog()->setTodo(event); 2577 getEventViewerDialog()->setTodo(event);
2574 getEventViewerDialog()->showMe(); 2578 getEventViewerDialog()->showMe();
2575} 2579}
2576void CalendarView::showJournal( Journal *jour ) 2580void CalendarView::showJournal( Journal *jour )
2577{ 2581{
2578 getEventViewerDialog()->setJournal(jour); 2582 getEventViewerDialog()->setJournal(jour);
2579 getEventViewerDialog()->showMe(); 2583 getEventViewerDialog()->showMe();
2580 2584
2581} 2585}
2582// void CalendarView::todoModified (Todo *event, int changed) 2586// void CalendarView::todoModified (Todo *event, int changed)
2583// { 2587// {
2584// // if (mDialogList.find (event) != mDialogList.end ()) { 2588// // if (mDialogList.find (event) != mDialogList.end ()) {
2585// // kdDebug() << "Todo modified and open" << endl; 2589// // kdDebug() << "Todo modified and open" << endl;
2586// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2590// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2587// // temp->modified (changed); 2591// // temp->modified (changed);
2588 2592
2589// // } 2593// // }
2590 2594
2591// mViewManager->updateView(); 2595// mViewManager->updateView();
2592// } 2596// }
2593 2597
2594void CalendarView::appointment_show() 2598void CalendarView::appointment_show()
2595{ 2599{
2596 Event *anEvent = 0; 2600 Event *anEvent = 0;
2597 2601
2598 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2602 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2599 2603
2600 if (mViewManager->currentView()->isEventView()) { 2604 if (mViewManager->currentView()->isEventView()) {
2601 if ( incidence && incidence->type() == "Event" ) { 2605 if ( incidence && incidence->type() == "Event" ) {
2602 anEvent = static_cast<Event *>(incidence); 2606 anEvent = static_cast<Event *>(incidence);
2603 } 2607 }
2604 } 2608 }
2605 2609
2606 if (!anEvent) { 2610 if (!anEvent) {
2607 KNotifyClient::beep(); 2611 KNotifyClient::beep();
2608 return; 2612 return;
2609 } 2613 }
2610 2614
2611 showEvent(anEvent); 2615 showEvent(anEvent);
2612} 2616}
2613 2617
2614void CalendarView::appointment_edit() 2618void CalendarView::appointment_edit()
2615{ 2619{
2616 Event *anEvent = 0; 2620 Event *anEvent = 0;
2617 2621
2618 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2622 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2619 2623
2620 if (mViewManager->currentView()->isEventView()) { 2624 if (mViewManager->currentView()->isEventView()) {
2621 if ( incidence && incidence->type() == "Event" ) { 2625 if ( incidence && incidence->type() == "Event" ) {
2622 anEvent = static_cast<Event *>(incidence); 2626 anEvent = static_cast<Event *>(incidence);
2623 } 2627 }
2624 } 2628 }
2625 2629
2626 if (!anEvent) { 2630 if (!anEvent) {
2627 KNotifyClient::beep(); 2631 KNotifyClient::beep();
2628 return; 2632 return;
2629 } 2633 }
2630 2634
2631 editEvent(anEvent); 2635 editEvent(anEvent);
2632} 2636}
2633 2637
2634void CalendarView::appointment_delete() 2638void CalendarView::appointment_delete()
2635{ 2639{
2636 Event *anEvent = 0; 2640 Event *anEvent = 0;
2637 2641
2638 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2642 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2639 2643
2640 if (mViewManager->currentView()->isEventView()) { 2644 if (mViewManager->currentView()->isEventView()) {
2641 if ( incidence && incidence->type() == "Event" ) { 2645 if ( incidence && incidence->type() == "Event" ) {
2642 anEvent = static_cast<Event *>(incidence); 2646 anEvent = static_cast<Event *>(incidence);
2643 } 2647 }
2644 } 2648 }
2645 2649
2646 if (!anEvent) { 2650 if (!anEvent) {
2647 KNotifyClient::beep(); 2651 KNotifyClient::beep();
2648 return; 2652 return;
2649 } 2653 }
2650 2654
2651 deleteEvent(anEvent); 2655 deleteEvent(anEvent);
2652} 2656}
2653 2657
2654void CalendarView::todo_unsub(Todo *anTodo ) 2658void CalendarView::todo_unsub(Todo *anTodo )
2655{ 2659{
2656 // Todo *anTodo = selectedTodo(); 2660 // Todo *anTodo = selectedTodo();
2657 if (!anTodo) return; 2661 if (!anTodo) return;
2658 if (!anTodo->relatedTo()) return; 2662 if (!anTodo->relatedTo()) return;
2659 anTodo->relatedTo()->removeRelation(anTodo); 2663 anTodo->relatedTo()->removeRelation(anTodo);
2660 anTodo->setRelatedTo(0); 2664 anTodo->setRelatedTo(0);
2661 anTodo->updated(); 2665 anTodo->updated();
2662 anTodo->setRelatedToUid(""); 2666 anTodo->setRelatedToUid("");
2663 setModified(true); 2667 setModified(true);
2664 updateView(); 2668 updateView();
2665} 2669}
2666 2670
2667void CalendarView::deleteTodo(Todo *todo) 2671void CalendarView::deleteTodo(Todo *todo)
2668{ 2672{
2669 if (!todo) { 2673 if (!todo) {
2670 KNotifyClient::beep(); 2674 KNotifyClient::beep();
2671 return; 2675 return;
2672 } 2676 }
2673 if (KOPrefs::instance()->mConfirm) { 2677 if (KOPrefs::instance()->mConfirm) {
2674 switch (msgItemDelete()) { 2678 switch (msgItemDelete()) {
2675 case KMessageBox::Continue: // OK 2679 case KMessageBox::Continue: // OK
2676 if (!todo->relations().isEmpty()) { 2680 if (!todo->relations().isEmpty()) {
2677 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2681 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2678 i18n("Delete To-Do")); 2682 i18n("Delete To-Do"));
2679 } else { 2683 } else {
2680 checkExternalId( todo ); 2684 checkExternalId( todo );
2681 calendar()->deleteTodo(todo); 2685 calendar()->deleteTodo(todo);
2682 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2686 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2683 updateView(); 2687 updateView();
2684 } 2688 }
2685 break; 2689 break;
2686 } // switch 2690 } // switch
2687 } else { 2691 } else {
2688 if (!todo->relations().isEmpty()) { 2692 if (!todo->relations().isEmpty()) {
2689 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2693 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2690 i18n("Delete To-Do")); 2694 i18n("Delete To-Do"));
2691 } else { 2695 } else {
2692 checkExternalId( todo ); 2696 checkExternalId( todo );
2693 mCalendar->deleteTodo(todo); 2697 mCalendar->deleteTodo(todo);
2694 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2698 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2695 updateView(); 2699 updateView();
2696 } 2700 }
2697 } 2701 }
2698 emit updateSearchDialog(); 2702 emit updateSearchDialog();
2699} 2703}
2700void CalendarView::deleteJournal(Journal *jour) 2704void CalendarView::deleteJournal(Journal *jour)
2701{ 2705{
2702 if (!jour) { 2706 if (!jour) {
2703 KNotifyClient::beep(); 2707 KNotifyClient::beep();
2704 return; 2708 return;
2705 } 2709 }
2706 if (KOPrefs::instance()->mConfirm) { 2710 if (KOPrefs::instance()->mConfirm) {
2707 switch (msgItemDelete()) { 2711 switch (msgItemDelete()) {
2708 case KMessageBox::Continue: // OK 2712 case KMessageBox::Continue: // OK
2709 calendar()->deleteJournal(jour); 2713 calendar()->deleteJournal(jour);
2710 updateView(); 2714 updateView();
2711 break; 2715 break;
2712 } // switch 2716 } // switch
2713 } else { 2717 } else {
2714 calendar()->deleteJournal(jour);; 2718 calendar()->deleteJournal(jour);;
2715 updateView(); 2719 updateView();
2716 } 2720 }
2717 emit updateSearchDialog(); 2721 emit updateSearchDialog();
2718} 2722}
2719 2723
2720void CalendarView::deleteEvent(Event *anEvent) 2724void CalendarView::deleteEvent(Event *anEvent)
2721{ 2725{
2722 if (!anEvent) { 2726 if (!anEvent) {
2723 KNotifyClient::beep(); 2727 KNotifyClient::beep();
2724 return; 2728 return;
2725 } 2729 }
2726 2730
2727 if (anEvent->recurrence()->doesRecur()) { 2731 if (anEvent->recurrence()->doesRecur()) {
2728 QDate itemDate = mViewManager->currentSelectionDate(); 2732 QDate itemDate = mViewManager->currentSelectionDate();
2729 int km; 2733 int km;
2730 if (!itemDate.isValid()) { 2734 if (!itemDate.isValid()) {
2731 //kdDebug() << "Date Not Valid" << endl; 2735 //kdDebug() << "Date Not Valid" << endl;
2732 if (KOPrefs::instance()->mConfirm) { 2736 if (KOPrefs::instance()->mConfirm) {
2733 km = KMessageBox::warningContinueCancel(this,anEvent->summary() + 2737 km = KMessageBox::warningContinueCancel(this,anEvent->summary() +
2734 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 2738 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
2735 i18n("KO/Pi Confirmation"),i18n("Delete All")); 2739 i18n("KO/Pi Confirmation"),i18n("Delete All"));
2736 if ( km == KMessageBox::Continue ) 2740 if ( km == KMessageBox::Continue )
2737 km = KMessageBox::No; // No = all below 2741 km = KMessageBox::No; // No = all below
2738 } else 2742 } else
2739 km = KMessageBox::No; 2743 km = KMessageBox::No;
2740 } else { 2744 } else {
2741 km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + 2745 km = KMessageBox::warningYesNoCancel(this,anEvent->summary() +
2742 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 2746 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
2743 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 2747 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
2744 i18n("KO/Pi Confirmation"),i18n("Current"), 2748 i18n("KO/Pi Confirmation"),i18n("Current"),
2745 i18n("All")); 2749 i18n("All"));
2746 } 2750 }
2747 switch(km) { 2751 switch(km) {
2748 2752
2749 case KMessageBox::No: // Continue // all 2753 case KMessageBox::No: // Continue // all
2750 //qDebug("KMessageBox::No "); 2754 //qDebug("KMessageBox::No ");
2751 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2755 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2752 schedule(Scheduler::Cancel,anEvent); 2756 schedule(Scheduler::Cancel,anEvent);
2753 2757
2754 checkExternalId( anEvent); 2758 checkExternalId( anEvent);
2755 mCalendar->deleteEvent(anEvent); 2759 mCalendar->deleteEvent(anEvent);
2756 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 2760 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
2757 break; 2761 break;
2758 2762
2759 // Disabled because it does not work 2763 // Disabled because it does not work
2760 //#if 0 2764 //#if 0
2761 case KMessageBox::Yes: // just this one 2765 case KMessageBox::Yes: // just this one
2762 //QDate qd = mNavigator->selectedDates().first(); 2766 //QDate qd = mNavigator->selectedDates().first();
2763 //if (!qd.isValid()) { 2767 //if (!qd.isValid()) {
2764 // kdDebug() << "no date selected, or invalid date" << endl; 2768 // kdDebug() << "no date selected, or invalid date" << endl;
2765 // KNotifyClient::beep(); 2769 // KNotifyClient::beep();
2766 // return; 2770 // return;
2767 //} 2771 //}
2768 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 2772 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
2769 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 2773 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
2770 anEvent->addExDate(itemDate); 2774 anEvent->addExDate(itemDate);
2771 int duration = anEvent->recurrence()->duration(); 2775 int duration = anEvent->recurrence()->duration();
2772 if ( duration > 0 ) { 2776 if ( duration > 0 ) {
2773 anEvent->recurrence()->setDuration( duration - 1 ); 2777 anEvent->recurrence()->setDuration( duration - 1 );
2774 } 2778 }
2775 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 2779 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
2776 } 2780 }
2777 break; 2781 break;
2778 //#endif 2782 //#endif
2779 } // switch 2783 } // switch
2780 } else { 2784 } else {
2781 if (KOPrefs::instance()->mConfirm) { 2785 if (KOPrefs::instance()->mConfirm) {
2782 switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + 2786 switch (KMessageBox::warningContinueCancel(this,anEvent->summary() +
2783 i18n("\nAre you sure you want\nto delete this event?"), 2787 i18n("\nAre you sure you want\nto delete this event?"),
2784 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 2788 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
2785 case KMessageBox::Continue: // OK 2789 case KMessageBox::Continue: // OK
2786 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2790 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2787 schedule(Scheduler::Cancel,anEvent); 2791 schedule(Scheduler::Cancel,anEvent);
2788 checkExternalId( anEvent); 2792 checkExternalId( anEvent);
2789 mCalendar->deleteEvent(anEvent); 2793 mCalendar->deleteEvent(anEvent);
2790 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2794 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2791 break; 2795 break;
2792 } // switch 2796 } // switch
2793 } else { 2797 } else {
2794 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2798 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2795 schedule(Scheduler::Cancel,anEvent); 2799 schedule(Scheduler::Cancel,anEvent);
2796 checkExternalId( anEvent); 2800 checkExternalId( anEvent);
2797 mCalendar->deleteEvent(anEvent); 2801 mCalendar->deleteEvent(anEvent);
2798 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2802 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2799 } 2803 }
2800 } // if-else 2804 } // if-else
2801 emit updateSearchDialog(); 2805 emit updateSearchDialog();
2802} 2806}
2803 2807
2804bool CalendarView::deleteEvent(const QString &uid) 2808bool CalendarView::deleteEvent(const QString &uid)
2805{ 2809{
2806 Event *ev = mCalendar->event(uid); 2810 Event *ev = mCalendar->event(uid);
2807 if (ev) { 2811 if (ev) {
2808 deleteEvent(ev); 2812 deleteEvent(ev);
2809 return true; 2813 return true;
2810 } else { 2814 } else {
2811 return false; 2815 return false;
2812 } 2816 }
2813} 2817}
2814 2818
2815/*****************************************************************************/ 2819/*****************************************************************************/
2816 2820
2817void CalendarView::action_mail() 2821void CalendarView::action_mail()
2818{ 2822{
2819#ifndef KORG_NOMAIL 2823#ifndef KORG_NOMAIL
2820 KOMailClient mailClient; 2824 KOMailClient mailClient;
2821 2825
2822 Incidence *incidence = currentSelection(); 2826 Incidence *incidence = currentSelection();
2823 2827
2824 if (!incidence) { 2828 if (!incidence) {
2825 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 2829 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
2826 return; 2830 return;
2827 } 2831 }
2828 if(incidence->attendeeCount() == 0 ) { 2832 if(incidence->attendeeCount() == 0 ) {
2829 KMessageBox::sorry(this, 2833 KMessageBox::sorry(this,
2830 i18n("Can't generate mail:\nNo attendees defined.\n")); 2834 i18n("Can't generate mail:\nNo attendees defined.\n"));
2831 return; 2835 return;
2832 } 2836 }
2833 2837
2834 CalendarLocal cal_tmp; 2838 CalendarLocal cal_tmp;
2835 Event *event = 0; 2839 Event *event = 0;
2836 Event *ev = 0; 2840 Event *ev = 0;
2837 if ( incidence && incidence->type() == "Event" ) { 2841 if ( incidence && incidence->type() == "Event" ) {
2838 event = static_cast<Event *>(incidence); 2842 event = static_cast<Event *>(incidence);
2839 ev = new Event(*event); 2843 ev = new Event(*event);
2840 cal_tmp.addEvent(ev); 2844 cal_tmp.addEvent(ev);
2841 } 2845 }
2842 ICalFormat mForm( KOPrefs::instance()->mUseQuicksave); 2846 ICalFormat mForm( KOPrefs::instance()->mUseQuicksave);
2843 QString attachment = mForm.toString( &cal_tmp ); 2847 QString attachment = mForm.toString( &cal_tmp );
2844 if (ev) delete(ev); 2848 if (ev) delete(ev);
2845 2849
2846 mailClient.mailAttendees(currentSelection(), attachment); 2850 mailClient.mailAttendees(currentSelection(), attachment);
2847 2851
2848#endif 2852#endif
2849 2853
2850#if 0 2854#if 0
2851 Event *anEvent = 0; 2855 Event *anEvent = 0;
2852 if (mViewManager->currentView()->isEventView()) { 2856 if (mViewManager->currentView()->isEventView()) {
2853 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 2857 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
2854 } 2858 }
2855 2859
2856 if (!anEvent) { 2860 if (!anEvent) {
2857 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 2861 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
2858 return; 2862 return;
2859 } 2863 }
2860 if(anEvent->attendeeCount() == 0 ) { 2864 if(anEvent->attendeeCount() == 0 ) {
2861 KMessageBox::sorry(this, 2865 KMessageBox::sorry(this,
2862 i18n("Can't generate mail:\nNo attendees defined.\n")); 2866 i18n("Can't generate mail:\nNo attendees defined.\n"));
2863 return; 2867 return;
2864 } 2868 }
2865 2869
2866 mailobject.emailEvent(anEvent); 2870 mailobject.emailEvent(anEvent);
2867#endif 2871#endif
2868} 2872}
2869 2873
2870 2874
2871void CalendarView::schedule_publish(Incidence *incidence) 2875void CalendarView::schedule_publish(Incidence *incidence)
2872{ 2876{
2873 Event *event = 0; 2877 Event *event = 0;
2874 Todo *todo = 0; 2878 Todo *todo = 0;
2875 2879
2876 if (incidence == 0) { 2880 if (incidence == 0) {
2877 incidence = mViewManager->currentView()->selectedIncidences().first(); 2881 incidence = mViewManager->currentView()->selectedIncidences().first();
2878 if (incidence == 0) { 2882 if (incidence == 0) {
2879 incidence = mTodoList->selectedIncidences().first(); 2883 incidence = mTodoList->selectedIncidences().first();
2880 } 2884 }
2881 } 2885 }
2882 if ( incidence && incidence->type() == "Event" ) { 2886 if ( incidence && incidence->type() == "Event" ) {
2883 event = static_cast<Event *>(incidence); 2887 event = static_cast<Event *>(incidence);
2884 } else { 2888 } else {
2885 if ( incidence && incidence->type() == "Todo" ) { 2889 if ( incidence && incidence->type() == "Todo" ) {
2886 todo = static_cast<Todo *>(incidence); 2890 todo = static_cast<Todo *>(incidence);
2887 } 2891 }
2888 } 2892 }
2889 2893
2890 if (!event && !todo) { 2894 if (!event && !todo) {
2891 KMessageBox::sorry(this,i18n("No event selected.")); 2895 KMessageBox::sorry(this,i18n("No event selected."));
2892 return; 2896 return;
2893 } 2897 }
2894 2898
2895 PublishDialog *publishdlg = new PublishDialog(); 2899 PublishDialog *publishdlg = new PublishDialog();
2896 if (incidence->attendeeCount()>0) { 2900 if (incidence->attendeeCount()>0) {
2897 QPtrList<Attendee> attendees = incidence->attendees(); 2901 QPtrList<Attendee> attendees = incidence->attendees();
2898 attendees.first(); 2902 attendees.first();
2899 while ( attendees.current()!=0 ) { 2903 while ( attendees.current()!=0 ) {
2900 publishdlg->addAttendee(attendees.current()); 2904 publishdlg->addAttendee(attendees.current());
2901 attendees.next(); 2905 attendees.next();
2902 } 2906 }
2903 } 2907 }
2904 bool send = true; 2908 bool send = true;
2905 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 2909 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
2906 if ( publishdlg->exec() != QDialog::Accepted ) 2910 if ( publishdlg->exec() != QDialog::Accepted )
2907 send = false; 2911 send = false;
2908 } 2912 }
2909 if ( send ) { 2913 if ( send ) {
2910 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 2914 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
2911 if ( event ) { 2915 if ( event ) {
2912 Event *ev = new Event(*event); 2916 Event *ev = new Event(*event);
2913 ev->registerObserver(0); 2917 ev->registerObserver(0);
2914 ev->clearAttendees(); 2918 ev->clearAttendees();
2915 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 2919 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
2916 delete(ev); 2920 delete(ev);
2917 } 2921 }
2918 } else { 2922 } else {
2919 if ( todo ) { 2923 if ( todo ) {
2920 Todo *ev = new Todo(*todo); 2924 Todo *ev = new Todo(*todo);
2921 ev->registerObserver(0); 2925 ev->registerObserver(0);
2922 ev->clearAttendees(); 2926 ev->clearAttendees();
2923 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 2927 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
2924 delete(ev); 2928 delete(ev);
2925 } 2929 }
2926 } 2930 }
2927 } 2931 }
2928 } 2932 }
2929 delete publishdlg; 2933 delete publishdlg;
2930} 2934}
2931 2935
2932void CalendarView::schedule_request(Incidence *incidence) 2936void CalendarView::schedule_request(Incidence *incidence)
2933{ 2937{
2934 schedule(Scheduler::Request,incidence); 2938 schedule(Scheduler::Request,incidence);
2935} 2939}
2936 2940
2937void CalendarView::schedule_refresh(Incidence *incidence) 2941void CalendarView::schedule_refresh(Incidence *incidence)
2938{ 2942{
2939 schedule(Scheduler::Refresh,incidence); 2943 schedule(Scheduler::Refresh,incidence);
2940} 2944}
2941 2945
2942void CalendarView::schedule_cancel(Incidence *incidence) 2946void CalendarView::schedule_cancel(Incidence *incidence)
2943{ 2947{
2944 schedule(Scheduler::Cancel,incidence); 2948 schedule(Scheduler::Cancel,incidence);
2945} 2949}
2946 2950
2947void CalendarView::schedule_add(Incidence *incidence) 2951void CalendarView::schedule_add(Incidence *incidence)
2948{ 2952{
2949 schedule(Scheduler::Add,incidence); 2953 schedule(Scheduler::Add,incidence);
2950} 2954}
2951 2955
2952void CalendarView::schedule_reply(Incidence *incidence) 2956void CalendarView::schedule_reply(Incidence *incidence)
2953{ 2957{
2954 schedule(Scheduler::Reply,incidence); 2958 schedule(Scheduler::Reply,incidence);
2955} 2959}
2956 2960
2957void CalendarView::schedule_counter(Incidence *incidence) 2961void CalendarView::schedule_counter(Incidence *incidence)
2958{ 2962{
2959 schedule(Scheduler::Counter,incidence); 2963 schedule(Scheduler::Counter,incidence);
2960} 2964}
2961 2965
2962void CalendarView::schedule_declinecounter(Incidence *incidence) 2966void CalendarView::schedule_declinecounter(Incidence *incidence)
2963{ 2967{
2964 schedule(Scheduler::Declinecounter,incidence); 2968 schedule(Scheduler::Declinecounter,incidence);
2965} 2969}
2966 2970
2967void CalendarView::schedule_publish_freebusy(int daysToPublish) 2971void CalendarView::schedule_publish_freebusy(int daysToPublish)
2968{ 2972{
2969 QDateTime start = QDateTime::currentDateTime(); 2973 QDateTime start = QDateTime::currentDateTime();
2970 QDateTime end = start.addDays(daysToPublish); 2974 QDateTime end = start.addDays(daysToPublish);
2971 2975
2972 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 2976 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
2973 freebusy->setOrganizer(KOPrefs::instance()->email()); 2977 freebusy->setOrganizer(KOPrefs::instance()->email());
2974 2978
2975 2979
2976 PublishDialog *publishdlg = new PublishDialog(); 2980 PublishDialog *publishdlg = new PublishDialog();
2977 if ( publishdlg->exec() == QDialog::Accepted ) { 2981 if ( publishdlg->exec() == QDialog::Accepted ) {
2978 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 2982 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
2979 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 2983 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
2980 delete(freebusy); 2984 delete(freebusy);
2981 } 2985 }
2982 } 2986 }
2983 delete publishdlg; 2987 delete publishdlg;
2984} 2988}
2985 2989
2986void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 2990void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
2987{ 2991{
2988 Event *event = 0; 2992 Event *event = 0;
2989 Todo *todo = 0; 2993 Todo *todo = 0;
2990 2994
2991 if (incidence == 0) { 2995 if (incidence == 0) {
2992 incidence = mViewManager->currentView()->selectedIncidences().first(); 2996 incidence = mViewManager->currentView()->selectedIncidences().first();
2993 if (incidence == 0) { 2997 if (incidence == 0) {
2994 incidence = mTodoList->selectedIncidences().first(); 2998 incidence = mTodoList->selectedIncidences().first();
2995 } 2999 }
2996 } 3000 }
2997 if ( incidence && incidence->type() == "Event" ) { 3001 if ( incidence && incidence->type() == "Event" ) {
2998 event = static_cast<Event *>(incidence); 3002 event = static_cast<Event *>(incidence);
2999 } 3003 }
3000 if ( incidence && incidence->type() == "Todo" ) { 3004 if ( incidence && incidence->type() == "Todo" ) {
3001 todo = static_cast<Todo *>(incidence); 3005 todo = static_cast<Todo *>(incidence);
3002 } 3006 }
3003 3007
3004 if (!event && !todo) { 3008 if (!event && !todo) {
3005 KMessageBox::sorry(this,i18n("No event selected.")); 3009 KMessageBox::sorry(this,i18n("No event selected."));
3006 return; 3010 return;
3007 } 3011 }
3008 3012
3009 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3013 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3010 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3014 KMessageBox::sorry(this,i18n("The event has no attendees."));
3011 return; 3015 return;
3012 } 3016 }
3013 3017
3014 Event *ev = 0; 3018 Event *ev = 0;
3015 if (event) ev = new Event(*event); 3019 if (event) ev = new Event(*event);
3016 Todo *to = 0; 3020 Todo *to = 0;
3017 if (todo) to = new Todo(*todo); 3021 if (todo) to = new Todo(*todo);
3018 3022
3019 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3023 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3020 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3024 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3021 if (!me) { 3025 if (!me) {
3022 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3026 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3023 return; 3027 return;
3024 } 3028 }
3025 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3029 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3026 StatusDialog *statdlg = new StatusDialog(this); 3030 StatusDialog *statdlg = new StatusDialog(this);
3027 if (!statdlg->exec()==QDialog::Accepted) return; 3031 if (!statdlg->exec()==QDialog::Accepted) return;
3028 me->setStatus( statdlg->status() ); 3032 me->setStatus( statdlg->status() );
3029 delete(statdlg); 3033 delete(statdlg);
3030 } 3034 }
3031 Attendee *menew = new Attendee(*me); 3035 Attendee *menew = new Attendee(*me);
3032 if (ev) { 3036 if (ev) {
3033 ev->clearAttendees(); 3037 ev->clearAttendees();
3034 ev->addAttendee(menew,false); 3038 ev->addAttendee(menew,false);
3035 } else { 3039 } else {
3036 if (to) { 3040 if (to) {
3037 todo->clearAttendees(); 3041 todo->clearAttendees();
3038 todo->addAttendee(menew,false); 3042 todo->addAttendee(menew,false);
3039 } 3043 }
3040 } 3044 }
3041 } 3045 }
3042 3046
3043 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3047 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3044 if (ev) { 3048 if (ev) {
3045 if ( !dlg->addMessage(ev,method) ) delete(ev); 3049 if ( !dlg->addMessage(ev,method) ) delete(ev);
3046 } else { 3050 } else {
3047 if (to) { 3051 if (to) {
3048 if ( !dlg->addMessage(to,method) ) delete(to); 3052 if ( !dlg->addMessage(to,method) ) delete(to);
3049 } 3053 }
3050 } 3054 }
3051} 3055}
3052 3056
3053void CalendarView::openAddressbook() 3057void CalendarView::openAddressbook()
3054{ 3058{
3055 KRun::runCommand("kaddressbook"); 3059 KRun::runCommand("kaddressbook");
3056} 3060}
3057 3061
3058void CalendarView::setModified(bool modified) 3062void CalendarView::setModified(bool modified)
3059{ 3063{
3060 if ( modified ) 3064 if ( modified )
3061 emit signalmodified(); 3065 emit signalmodified();
3062 if (mModified != modified) { 3066 if (mModified != modified) {
3063 mModified = modified; 3067 mModified = modified;
3064 emit modifiedChanged(mModified); 3068 emit modifiedChanged(mModified);
3065 } 3069 }
3066} 3070}
3067 3071
3068bool CalendarView::isReadOnly() 3072bool CalendarView::isReadOnly()
3069{ 3073{
3070 return mReadOnly; 3074 return mReadOnly;
3071} 3075}
3072 3076
3073void CalendarView::setReadOnly(bool readOnly) 3077void CalendarView::setReadOnly(bool readOnly)
3074{ 3078{
3075 if (mReadOnly != readOnly) { 3079 if (mReadOnly != readOnly) {
3076 mReadOnly = readOnly; 3080 mReadOnly = readOnly;
3077 emit readOnlyChanged(mReadOnly); 3081 emit readOnlyChanged(mReadOnly);
3078 } 3082 }
3079} 3083}
3080 3084
3081bool CalendarView::isModified() 3085bool CalendarView::isModified()
3082{ 3086{
3083 return mModified; 3087 return mModified;
3084} 3088}
3085 3089
3086void CalendarView::printSetup() 3090void CalendarView::printSetup()
3087{ 3091{
3088#ifndef KORG_NOPRINTER 3092#ifndef KORG_NOPRINTER
3089 createPrinter(); 3093 createPrinter();
3090 3094
3091 mCalPrinter->setupPrinter(); 3095 mCalPrinter->setupPrinter();
3092#endif 3096#endif
3093} 3097}
3094 3098
3095void CalendarView::print() 3099void CalendarView::print()
3096{ 3100{
3097#ifndef KORG_NOPRINTER 3101#ifndef KORG_NOPRINTER
3098 createPrinter(); 3102 createPrinter();
3099 3103
3100 DateList tmpDateList = mNavigator->selectedDates(); 3104 DateList tmpDateList = mNavigator->selectedDates();
3101 mCalPrinter->print(CalPrinter::Month, 3105 mCalPrinter->print(CalPrinter::Month,
3102 tmpDateList.first(), tmpDateList.last()); 3106 tmpDateList.first(), tmpDateList.last());
3103#endif 3107#endif
3104} 3108}
3105 3109
3106void CalendarView::printPreview() 3110void CalendarView::printPreview()
3107{ 3111{
3108#ifndef KORG_NOPRINTER 3112#ifndef KORG_NOPRINTER
3109 kdDebug() << "CalendarView::printPreview()" << endl; 3113 kdDebug() << "CalendarView::printPreview()" << endl;
3110 3114
3111 createPrinter(); 3115 createPrinter();
3112 3116
3113 DateList tmpDateList = mNavigator->selectedDates(); 3117 DateList tmpDateList = mNavigator->selectedDates();
3114 3118
3115 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3119 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3116 tmpDateList.last()); 3120 tmpDateList.last());
3117#endif 3121#endif
3118} 3122}
3119 3123
3120void CalendarView::exportICalendar() 3124void CalendarView::exportICalendar()
3121{ 3125{
3122 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3126 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3123 3127
3124 // Force correct extension 3128 // Force correct extension
3125 if (filename.right(4) != ".ics") filename += ".ics"; 3129 if (filename.right(4) != ".ics") filename += ".ics";
3126 3130
3127 FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 3131 FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
3128 storage.save(); 3132 storage.save();
3129} 3133}
3130 3134
3131bool CalendarView::exportVCalendar( QString filename ) 3135bool CalendarView::exportVCalendar( QString filename )
3132{ 3136{
3133 if (mCalendar->journals().count() > 0) { 3137 if (mCalendar->journals().count() > 0) {
3134 int result = KMessageBox::warningContinueCancel(this, 3138 int result = KMessageBox::warningContinueCancel(this,
3135 i18n("The journal entries can not be\nexported to a vCalendar file."), 3139 i18n("The journal entries can not be\nexported to a vCalendar file."),
3136 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3140 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3137 true); 3141 true);
3138 if (result != KMessageBox::Continue) return false; 3142 if (result != KMessageBox::Continue) return false;
3139 } 3143 }
3140 3144
3141 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3145 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3142 3146
3143 // Force correct extension 3147 // Force correct extension
3144 if (filename.right(4) != ".vcs") filename += ".vcs"; 3148 if (filename.right(4) != ".vcs") filename += ".vcs";
3145 3149
3146 FileStorage storage( mCalendar, filename, new VCalFormat ); 3150 FileStorage storage( mCalendar, filename, new VCalFormat );
3147 return storage.save(); 3151 return storage.save();
3148 3152
3149} 3153}
3150 3154
3151void CalendarView::eventUpdated(Incidence *) 3155void CalendarView::eventUpdated(Incidence *)
3152{ 3156{
3153 setModified(); 3157 setModified();
3154 // Don't call updateView here. The code, which has caused the update of the 3158 // Don't call updateView here. The code, which has caused the update of the
3155 // event is responsible for updating the view. 3159 // event is responsible for updating the view.
3156 // updateView(); 3160 // updateView();
3157} 3161}
3158 3162
3159void CalendarView::adaptNavigationUnits() 3163void CalendarView::adaptNavigationUnits()
3160{ 3164{
3161 if (mViewManager->currentView()->isEventView()) { 3165 if (mViewManager->currentView()->isEventView()) {
3162 int days = mViewManager->currentView()->currentDateCount(); 3166 int days = mViewManager->currentView()->currentDateCount();
3163 if (days == 1) { 3167 if (days == 1) {
3164 emit changeNavStringPrev(i18n("&Previous Day")); 3168 emit changeNavStringPrev(i18n("&Previous Day"));
3165 emit changeNavStringNext(i18n("&Next Day")); 3169 emit changeNavStringNext(i18n("&Next Day"));
3166 } else { 3170 } else {
3167 emit changeNavStringPrev(i18n("&Previous Week")); 3171 emit changeNavStringPrev(i18n("&Previous Week"));
3168 emit changeNavStringNext(i18n("&Next Week")); 3172 emit changeNavStringNext(i18n("&Next Week"));
3169 } 3173 }
3170 } 3174 }
3171} 3175}
3172 3176
3173void CalendarView::processMainViewSelection( Incidence *incidence ) 3177void CalendarView::processMainViewSelection( Incidence *incidence )
3174{ 3178{
3175 if ( incidence ) mTodoList->clearSelection(); 3179 if ( incidence ) mTodoList->clearSelection();
3176 processIncidenceSelection( incidence ); 3180 processIncidenceSelection( incidence );
3177} 3181}
3178 3182
3179void CalendarView::processTodoListSelection( Incidence *incidence ) 3183void CalendarView::processTodoListSelection( Incidence *incidence )
3180{ 3184{
3181 if ( incidence && mViewManager->currentView() ) { 3185 if ( incidence && mViewManager->currentView() ) {
3182 mViewManager->currentView()->clearSelection(); 3186 mViewManager->currentView()->clearSelection();
3183 } 3187 }
3184 processIncidenceSelection( incidence ); 3188 processIncidenceSelection( incidence );
3185} 3189}
3186 3190
3187void CalendarView::processIncidenceSelection( Incidence *incidence ) 3191void CalendarView::processIncidenceSelection( Incidence *incidence )
3188{ 3192{
3189 if ( incidence == mSelectedIncidence ) return; 3193 if ( incidence == mSelectedIncidence ) return;
3190 3194
3191 mSelectedIncidence = incidence; 3195 mSelectedIncidence = incidence;
3192 3196
3193 emit incidenceSelected( mSelectedIncidence ); 3197 emit incidenceSelected( mSelectedIncidence );
3194 3198
3195 if ( incidence && incidence->type() == "Event" ) { 3199 if ( incidence && incidence->type() == "Event" ) {
3196 Event *event = static_cast<Event *>( incidence ); 3200 Event *event = static_cast<Event *>( incidence );
3197 if ( event->organizer() == KOPrefs::instance()->email() ) { 3201 if ( event->organizer() == KOPrefs::instance()->email() ) {
3198 emit organizerEventsSelected( true ); 3202 emit organizerEventsSelected( true );
3199 } else { 3203 } else {
3200 emit organizerEventsSelected(false); 3204 emit organizerEventsSelected(false);
3201 } 3205 }
3202 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3206 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3203 KOPrefs::instance()->email() ) ) { 3207 KOPrefs::instance()->email() ) ) {
3204 emit groupEventsSelected( true ); 3208 emit groupEventsSelected( true );
3205 } else { 3209 } else {
3206 emit groupEventsSelected(false); 3210 emit groupEventsSelected(false);
3207 } 3211 }
3208 return; 3212 return;
3209 } else { 3213 } else {
3210 if ( incidence && incidence->type() == "Todo" ) { 3214 if ( incidence && incidence->type() == "Todo" ) {
3211 emit todoSelected( true ); 3215 emit todoSelected( true );
3212 Todo *event = static_cast<Todo *>( incidence ); 3216 Todo *event = static_cast<Todo *>( incidence );
3213 if ( event->organizer() == KOPrefs::instance()->email() ) { 3217 if ( event->organizer() == KOPrefs::instance()->email() ) {
3214 emit organizerEventsSelected( true ); 3218 emit organizerEventsSelected( true );
3215 } else { 3219 } else {
3216 emit organizerEventsSelected(false); 3220 emit organizerEventsSelected(false);
3217 } 3221 }
3218 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3222 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3219 KOPrefs::instance()->email() ) ) { 3223 KOPrefs::instance()->email() ) ) {
3220 emit groupEventsSelected( true ); 3224 emit groupEventsSelected( true );
3221 } else { 3225 } else {
3222 emit groupEventsSelected(false); 3226 emit groupEventsSelected(false);
3223 } 3227 }
3224 return; 3228 return;
3225 } else { 3229 } else {
3226 emit todoSelected( false ); 3230 emit todoSelected( false );
3227 emit organizerEventsSelected(false); 3231 emit organizerEventsSelected(false);
3228 emit groupEventsSelected(false); 3232 emit groupEventsSelected(false);
3229 } 3233 }
3230 return; 3234 return;
3231 } 3235 }
3232 3236
3233 /* if ( incidence && incidence->type() == "Todo" ) { 3237 /* if ( incidence && incidence->type() == "Todo" ) {
3234 emit todoSelected( true ); 3238 emit todoSelected( true );
3235 } else { 3239 } else {
3236 emit todoSelected( false ); 3240 emit todoSelected( false );
3237 }*/ 3241 }*/
3238} 3242}
3239 3243
3240 3244
3241void CalendarView::checkClipboard() 3245void CalendarView::checkClipboard()
3242{ 3246{
3243#ifndef KORG_NODND 3247#ifndef KORG_NODND
3244 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3248 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3245 emit pasteEnabled(true); 3249 emit pasteEnabled(true);
3246 } else { 3250 } else {
3247 emit pasteEnabled(false); 3251 emit pasteEnabled(false);
3248 } 3252 }
3249#endif 3253#endif
3250} 3254}
3251 3255
3252void CalendarView::showDates(const DateList &selectedDates) 3256void CalendarView::showDates(const DateList &selectedDates)
3253{ 3257{
3254 // kdDebug() << "CalendarView::selectDates()" << endl; 3258 // kdDebug() << "CalendarView::selectDates()" << endl;
3255 3259
3256 if ( mViewManager->currentView() ) { 3260 if ( mViewManager->currentView() ) {
3257 updateView( selectedDates.first(), selectedDates.last() ); 3261 updateView( selectedDates.first(), selectedDates.last() );
3258 } else { 3262 } else {
3259 mViewManager->showAgendaView(); 3263 mViewManager->showAgendaView();
3260 } 3264 }
3261 3265
3262 QString selDates; 3266 QString selDates;
3263 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3267 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3264 if (selectedDates.first() < selectedDates.last() ) 3268 if (selectedDates.first() < selectedDates.last() )
3265 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3269 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3266 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3270 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3267 3271
3268} 3272}
3269 3273
3270QPtrList<CalFilter> CalendarView::filters() 3274QPtrList<CalFilter> CalendarView::filters()
3271{ 3275{
3272 return mFilters; 3276 return mFilters;
3273 3277
3274} 3278}
3275void CalendarView::editFilters() 3279void CalendarView::editFilters()
3276{ 3280{
3277 // kdDebug() << "CalendarView::editFilters()" << endl; 3281 // kdDebug() << "CalendarView::editFilters()" << endl;
3278 3282
3279 CalFilter *filter = mFilters.first(); 3283 CalFilter *filter = mFilters.first();
3280 while(filter) { 3284 while(filter) {
3281 kdDebug() << " Filter: " << filter->name() << endl; 3285 kdDebug() << " Filter: " << filter->name() << endl;
3282 filter = mFilters.next(); 3286 filter = mFilters.next();
3283 } 3287 }
3284 3288
3285 mDialogManager->showFilterEditDialog(&mFilters); 3289 mDialogManager->showFilterEditDialog(&mFilters);
3286} 3290}
3287void CalendarView::toggleFilter() 3291void CalendarView::toggleFilter()
3288{ 3292{
3289 showFilter(! mFilterView->isVisible()); 3293 showFilter(! mFilterView->isVisible());
3290} 3294}
3291 3295
3292KOFilterView *CalendarView::filterView() 3296KOFilterView *CalendarView::filterView()
3293{ 3297{
3294 return mFilterView; 3298 return mFilterView;
3295} 3299}
3296void CalendarView::selectFilter( int fil ) 3300void CalendarView::selectFilter( int fil )
3297{ 3301{
3298 mFilterView->setSelectedFilter( fil ); 3302 mFilterView->setSelectedFilter( fil );
3299} 3303}
3300void CalendarView::showFilter(bool visible) 3304void CalendarView::showFilter(bool visible)
3301{ 3305{
3302 if (visible) mFilterView->show(); 3306 if (visible) mFilterView->show();
3303 else mFilterView->hide(); 3307 else mFilterView->hide();
3304} 3308}
3305void CalendarView::toggleFilerEnabled( ) 3309void CalendarView::toggleFilerEnabled( )
3306{ 3310{
3307 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3311 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3308 if ( !mFilterView->filtersEnabled() ) 3312 if ( !mFilterView->filtersEnabled() )
3309 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3313 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3310 3314
3311} 3315}
3312void CalendarView::updateFilter() 3316void CalendarView::updateFilter()
3313{ 3317{
3314 CalFilter *filter = mFilterView->selectedFilter(); 3318 CalFilter *filter = mFilterView->selectedFilter();
3315 if (filter) { 3319 if (filter) {
3316 if (mFilterView->filtersEnabled()) { 3320 if (mFilterView->filtersEnabled()) {
3317 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3321 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3318 filter->setEnabled(true); 3322 filter->setEnabled(true);
3319 } 3323 }
3320 else filter->setEnabled(false); 3324 else filter->setEnabled(false);
3321 mCalendar->setFilter(filter); 3325 mCalendar->setFilter(filter);
3322 updateView(); 3326 updateView();
3323 } 3327 }
3324} 3328}
3325 3329
3326void CalendarView::filterEdited() 3330void CalendarView::filterEdited()
3327{ 3331{
3328 mFilterView->updateFilters(); 3332 mFilterView->updateFilters();
3329 updateFilter(); 3333 updateFilter();
3330 writeSettings(); 3334 writeSettings();
3331} 3335}
3332 3336
3333 3337
3334void CalendarView::takeOverEvent() 3338void CalendarView::takeOverEvent()
3335{ 3339{
3336 Incidence *incidence = currentSelection(); 3340 Incidence *incidence = currentSelection();
3337 3341
3338 if (!incidence) return; 3342 if (!incidence) return;
3339 3343
3340 incidence->setOrganizer(KOPrefs::instance()->email()); 3344 incidence->setOrganizer(KOPrefs::instance()->email());
3341 incidence->recreate(); 3345 incidence->recreate();
3342 incidence->setReadOnly(false); 3346 incidence->setReadOnly(false);
3343 3347
3344 updateView(); 3348 updateView();
3345} 3349}
3346 3350
3347void CalendarView::takeOverCalendar() 3351void CalendarView::takeOverCalendar()
3348{ 3352{
3349 // TODO: Create Calendar::allIncidences() function and use it here 3353 // TODO: Create Calendar::allIncidences() function and use it here
3350 3354
3351 QPtrList<Event> events = mCalendar->events(); 3355 QPtrList<Event> events = mCalendar->events();
3352 for(uint i=0; i<events.count(); ++i) { 3356 for(uint i=0; i<events.count(); ++i) {
3353 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3357 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3354 events.at(i)->recreate(); 3358 events.at(i)->recreate();
3355 events.at(i)->setReadOnly(false); 3359 events.at(i)->setReadOnly(false);
3356 } 3360 }
3357 3361
3358 QPtrList<Todo> todos = mCalendar->todos(); 3362 QPtrList<Todo> todos = mCalendar->todos();
3359 for(uint i=0; i<todos.count(); ++i) { 3363 for(uint i=0; i<todos.count(); ++i) {
3360 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3364 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3361 todos.at(i)->recreate(); 3365 todos.at(i)->recreate();
3362 todos.at(i)->setReadOnly(false); 3366 todos.at(i)->setReadOnly(false);
3363 } 3367 }
3364 3368
3365 QPtrList<Journal> journals = mCalendar->journals(); 3369 QPtrList<Journal> journals = mCalendar->journals();
3366 for(uint i=0; i<journals.count(); ++i) { 3370 for(uint i=0; i<journals.count(); ++i) {
3367 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3371 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3368 journals.at(i)->recreate(); 3372 journals.at(i)->recreate();
3369 journals.at(i)->setReadOnly(false); 3373 journals.at(i)->setReadOnly(false);
3370 } 3374 }
3371 3375
3372 updateView(); 3376 updateView();
3373} 3377}
3374 3378
3375void CalendarView::showIntro() 3379void CalendarView::showIntro()
3376{ 3380{
3377 kdDebug() << "To be implemented." << endl; 3381 kdDebug() << "To be implemented." << endl;
3378} 3382}
3379 3383
3380QWidgetStack *CalendarView::viewStack() 3384QWidgetStack *CalendarView::viewStack()
3381{ 3385{
3382 return mRightFrame; 3386 return mRightFrame;
3383} 3387}
3384 3388
3385QWidget *CalendarView::leftFrame() 3389QWidget *CalendarView::leftFrame()
3386{ 3390{
3387 return mLeftFrame; 3391 return mLeftFrame;
3388} 3392}
3389 3393
3390DateNavigator *CalendarView::dateNavigator() 3394DateNavigator *CalendarView::dateNavigator()
3391{ 3395{
3392 return mNavigator; 3396 return mNavigator;
3393} 3397}
3394 3398
3395KDateNavigator* CalendarView::dateNavigatorWidget() 3399KDateNavigator* CalendarView::dateNavigatorWidget()
3396{ 3400{
3397 return mDateNavigator; 3401 return mDateNavigator;
3398} 3402}
3399void CalendarView::toggleDateNavigatorWidget() 3403void CalendarView::toggleDateNavigatorWidget()
3400{ 3404{
3401 if (mDateNavigator->isVisible()) 3405 if (mDateNavigator->isVisible())
3402 mDateNavigator->hide(); 3406 mDateNavigator->hide();
3403 else 3407 else
3404 mDateNavigator->show(); 3408 mDateNavigator->show();
3405} 3409}
3406void CalendarView::addView(KOrg::BaseView *view) 3410void CalendarView::addView(KOrg::BaseView *view)
3407{ 3411{
3408 mViewManager->addView(view); 3412 mViewManager->addView(view);
3409} 3413}
3410 3414
3411void CalendarView::showView(KOrg::BaseView *view) 3415void CalendarView::showView(KOrg::BaseView *view)
3412{ 3416{
3413 mViewManager->showView(view, mLeftFrame->isVisible()); 3417 mViewManager->showView(view, mLeftFrame->isVisible());
3414} 3418}
3415 3419
3416Incidence *CalendarView::currentSelection() 3420Incidence *CalendarView::currentSelection()
3417{ 3421{
3418 return mViewManager->currentSelection(); 3422 return mViewManager->currentSelection();
3419} 3423}
3420void CalendarView::toggleAllDaySize() 3424void CalendarView::toggleAllDaySize()
3421{ 3425{
3422 /* 3426 /*
3423 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3427 if ( KOPrefs::instance()->mAllDaySize > 47 )
3424 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3428 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3425 else 3429 else
3426 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3430 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3427 */ 3431 */
3428 viewManager()->agendaView()->toggleAllDay(); 3432 viewManager()->agendaView()->toggleAllDay();
3429} 3433}
3430void CalendarView::toggleExpand() 3434void CalendarView::toggleExpand()
3431{ 3435{
3432 // if ( mLeftFrame->isHidden() ) { 3436 // if ( mLeftFrame->isHidden() ) {
3433 // mLeftFrame->show(); 3437 // mLeftFrame->show();
3434 // emit calendarViewExpanded( false ); 3438 // emit calendarViewExpanded( false );
3435 // } else { 3439 // } else {
3436 // mLeftFrame->hide(); 3440 // mLeftFrame->hide();
3437 // emit calendarViewExpanded( true ); 3441 // emit calendarViewExpanded( true );
3438 // } 3442 // }
3439 3443
3440 globalFlagBlockAgenda = 1; 3444 globalFlagBlockAgenda = 1;
3441 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3445 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3442 globalFlagBlockAgenda = 5; 3446 globalFlagBlockAgenda = 5;
3443 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3447 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3444 //mViewManager->showView( 0, true ); 3448 //mViewManager->showView( 0, true );
3445} 3449}
3446 3450
3447void CalendarView::calendarModified( bool modified, Calendar * ) 3451void CalendarView::calendarModified( bool modified, Calendar * )
3448{ 3452{
3449 setModified( modified ); 3453 setModified( modified );
3450} 3454}
3451 3455
3452Todo *CalendarView::selectedTodo() 3456Todo *CalendarView::selectedTodo()
3453{ 3457{
3454 Incidence *incidence = currentSelection(); 3458 Incidence *incidence = currentSelection();
3455 if ( incidence && incidence->type() == "Todo" ) { 3459 if ( incidence && incidence->type() == "Todo" ) {
3456 return static_cast<Todo *>( incidence ); 3460 return static_cast<Todo *>( incidence );
3457 } 3461 }
3458 3462
3459 incidence = mTodoList->selectedIncidences().first(); 3463 incidence = mTodoList->selectedIncidences().first();
3460 if ( incidence && incidence->type() == "Todo" ) { 3464 if ( incidence && incidence->type() == "Todo" ) {
3461 return static_cast<Todo *>( incidence ); 3465 return static_cast<Todo *>( incidence );
3462 } 3466 }
3463 3467
3464 return 0; 3468 return 0;
3465} 3469}
3466 3470
3467void CalendarView::dialogClosing(Incidence *in) 3471void CalendarView::dialogClosing(Incidence *in)
3468{ 3472{
3469 // mDialogList.remove(in); 3473 // mDialogList.remove(in);
3470} 3474}
3471 3475
3472void CalendarView::showIncidence() 3476void CalendarView::showIncidence()
3473{ 3477{
3474 Incidence *incidence = currentSelection(); 3478 Incidence *incidence = currentSelection();
3475 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3479 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3476 if ( incidence ) { 3480 if ( incidence ) {
3477 ShowIncidenceVisitor v; 3481 ShowIncidenceVisitor v;
3478 v.act( incidence, this ); 3482 v.act( incidence, this );
3479 } 3483 }
3480} 3484}
3481void CalendarView::editIncidenceDescription() 3485void CalendarView::editIncidenceDescription()
3482{ 3486{
3483 mFlagEditDescription = true; 3487 mFlagEditDescription = true;
3484 editIncidence(); 3488 editIncidence();
3485 mFlagEditDescription = false; 3489 mFlagEditDescription = false;
3486} 3490}
3487void CalendarView::editIncidence() 3491void CalendarView::editIncidence()
3488{ 3492{
3489 // qDebug("editIncidence() "); 3493 // qDebug("editIncidence() ");
3490 Incidence *incidence = currentSelection(); 3494 Incidence *incidence = currentSelection();
3491 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3495 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3492 if ( incidence ) { 3496 if ( incidence ) {
3493 EditIncidenceVisitor v; 3497 EditIncidenceVisitor v;
3494 v.act( incidence, this ); 3498 v.act( incidence, this );
3495 } 3499 }
3496} 3500}
3497 3501
3498void CalendarView::deleteIncidence() 3502void CalendarView::deleteIncidence()
3499{ 3503{
3500 Incidence *incidence = currentSelection(); 3504 Incidence *incidence = currentSelection();
3501 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3505 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3502 if ( incidence ) { 3506 if ( incidence ) {
3503 deleteIncidence(incidence); 3507 deleteIncidence(incidence);
3504 } 3508 }
3505} 3509}
3506 3510
3507void CalendarView::showIncidence(Incidence *incidence) 3511void CalendarView::showIncidence(Incidence *incidence)
3508{ 3512{
3509 if ( incidence ) { 3513 if ( incidence ) {
3510 ShowIncidenceVisitor v; 3514 ShowIncidenceVisitor v;
3511 v.act( incidence, this ); 3515 v.act( incidence, this );
3512 } 3516 }
3513} 3517}
3514 3518
3515void CalendarView::editIncidence(Incidence *incidence) 3519void CalendarView::editIncidence(Incidence *incidence)
3516{ 3520{
3517 if ( incidence ) { 3521 if ( incidence ) {
3518 3522
3519 EditIncidenceVisitor v; 3523 EditIncidenceVisitor v;
3520 v.act( incidence, this ); 3524 v.act( incidence, this );
3521 3525
3522 } 3526 }
3523} 3527}
3524 3528
3525void CalendarView::deleteIncidence(Incidence *incidence) 3529void CalendarView::deleteIncidence(Incidence *incidence)
3526{ 3530{
3527 //qDebug(" CalendarView::deleteIncidence "); 3531 //qDebug(" CalendarView::deleteIncidence ");
3528 if ( incidence ) { 3532 if ( incidence ) {
3529 DeleteIncidenceVisitor v; 3533 DeleteIncidenceVisitor v;
3530 v.act( incidence, this ); 3534 v.act( incidence, this );
3531 } 3535 }
3532} 3536}
3533 3537
3534 3538
3535void CalendarView::lookForOutgoingMessages() 3539void CalendarView::lookForOutgoingMessages()
3536{ 3540{
3537 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3541 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3538 ogd->loadMessages(); 3542 ogd->loadMessages();
3539} 3543}
3540 3544
3541void CalendarView::lookForIncomingMessages() 3545void CalendarView::lookForIncomingMessages()
3542{ 3546{
3543 IncomingDialog *icd = mDialogManager->incomingDialog(); 3547 IncomingDialog *icd = mDialogManager->incomingDialog();
3544 icd->retrieve(); 3548 icd->retrieve();
3545} 3549}
3546 3550
3547bool CalendarView::removeCompletedSubTodos( Todo* t ) 3551bool CalendarView::removeCompletedSubTodos( Todo* t )
3548{ 3552{
3549 bool deleteTodo = true; 3553 bool deleteTodo = true;
3550 QPtrList<Incidence> subTodos; 3554 QPtrList<Incidence> subTodos;
3551 Incidence *aTodo; 3555 Incidence *aTodo;
3552 subTodos = t->relations(); 3556 subTodos = t->relations();
3553 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3557 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3554 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3558 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3555 deleteTodo = false; 3559 deleteTodo = false;
3556 } 3560 }
3557 if ( deleteTodo ) { 3561 if ( deleteTodo ) {
3558 if ( t->isCompleted() ) { 3562 if ( t->isCompleted() ) {
3559 checkExternalId( t ); 3563 checkExternalId( t );
3560 mCalendar->deleteTodo( t ); 3564 mCalendar->deleteTodo( t );
3561 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3565 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3562 } 3566 }
3563 else 3567 else
3564 deleteTodo = false; 3568 deleteTodo = false;
3565 } 3569 }
3566 return deleteTodo; 3570 return deleteTodo;
3567 3571
3568} 3572}
3569void CalendarView::purgeCompleted() 3573void CalendarView::purgeCompleted()
3570{ 3574{
3571 int result = KMessageBox::warningContinueCancel(this, 3575 int result = KMessageBox::warningContinueCancel(this,
3572 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3576 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3573 3577
3574 if (result == KMessageBox::Continue) { 3578 if (result == KMessageBox::Continue) {
3575 3579
3576 QPtrList<Todo> todoCal; 3580 QPtrList<Todo> todoCal;
3577 QPtrList<Todo> rootTodos; 3581 QPtrList<Todo> rootTodos;
3578 //QPtrList<Incidence> rel; 3582 //QPtrList<Incidence> rel;
3579 Todo *aTodo;//, *rTodo; 3583 Todo *aTodo;//, *rTodo;
3580 Incidence *rIncidence; 3584 Incidence *rIncidence;
3581 bool childDelete = false; 3585 bool childDelete = false;
3582 bool deletedOne = true; 3586 bool deletedOne = true;
3583 todoCal = calendar()->todos(); 3587 todoCal = calendar()->todos();
3584 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3588 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3585 if ( !aTodo->relatedTo() ) 3589 if ( !aTodo->relatedTo() )
3586 rootTodos.append( aTodo ); 3590 rootTodos.append( aTodo );
3587 } 3591 }
3588 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3592 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3589 removeCompletedSubTodos( aTodo ); 3593 removeCompletedSubTodos( aTodo );
3590 } 3594 }
3591 3595
3592 updateView(); 3596 updateView();
3593 } 3597 }
3594} 3598}
3595 3599
3596void CalendarView::slotCalendarChanged() 3600void CalendarView::slotCalendarChanged()
3597{ 3601{
3598 ; 3602 ;
3599} 3603}
3600 3604
3601NavigatorBar *CalendarView::navigatorBar() 3605NavigatorBar *CalendarView::navigatorBar()
3602{ 3606{
3603 return mNavigatorBar; 3607 return mNavigatorBar;
3604} 3608}
3605 3609
3606 3610
3607 3611
3608void CalendarView::keyPressEvent ( QKeyEvent *e) 3612void CalendarView::keyPressEvent ( QKeyEvent *e)
3609{ 3613{
3610 //qDebug(" alendarView::keyPressEvent "); 3614 //qDebug(" alendarView::keyPressEvent ");
3611 e->ignore(); 3615 e->ignore();
3612} 3616}
3613 3617
3614//#include "calendarview.moc" 3618//#include "calendarview.moc"
3615 3619
3616//#include "calendarviewbase.moc" 3620//#include "calendarviewbase.moc"
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index dd978bf..5d7db4f 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,568 +1,570 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h>
44 45
45#include "koprefs.h" 46#include "koprefs.h"
46#include "mainwindow.h" 47#include "mainwindow.h"
47 48
48const char *germanwords[][2] = { 49const char *germanwords[][2] = {
49#include "wordsgerman.h" 50#include "wordsgerman.h"
50 "", "" 51 "", ""
51}; 52};
52 53
53KOPrefs *KOPrefs::mInstance = 0; 54KOPrefs *KOPrefs::mInstance = 0;
54static KStaticDeleter<KOPrefs> insd; 55static KStaticDeleter<KOPrefs> insd;
55 56
56KOPrefs::KOPrefs() : 57KOPrefs::KOPrefs() :
57 KPimPrefs("korganizerrc") 58 KPimPrefs("korganizerrc")
58{ 59{
59 mCategoryColors.setAutoDelete(true); 60 mCategoryColors.setAutoDelete(true);
60 mLocaleDict = 0; 61 mLocaleDict = 0;
61 fillMailDefaults(); 62 fillMailDefaults();
62 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
63 QColor defaultHolidayColor = QColor(255,0,0); 64 QColor defaultHolidayColor = QColor(255,0,0);
64 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
65 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
66 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
67 QColor defaultTodoDueTodayColor = QColor(255,220,100); 68 QColor defaultTodoDueTodayColor = QColor(255,220,100);
68 QColor defaultTodoOverdueColor = QColor(255,153,125); 69 QColor defaultTodoOverdueColor = QColor(255,153,125);
69 70
70 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
71 mDefaultViewFont = QFont("helvetica",10); 72 mDefaultViewFont = QFont("helvetica",10);
72 mDefaultMonthViewFont = QFont("helvetica",8); 73 mDefaultMonthViewFont = QFont("helvetica",8);
73 mMarcusBainsFont= QFont("helvetica",10); 74 mMarcusBainsFont= QFont("helvetica",10);
74 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
75 mEditBoxFont = QFont("helvetica",12); 76 mEditBoxFont = QFont("helvetica",12);
76 mJornalViewFont = QFont("helvetica",12); 77 mJornalViewFont = QFont("helvetica",12);
77 78
78 KPrefs::setCurrentGroup("General"); 79 KPrefs::setCurrentGroup("General");
79 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 80 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
80 81
81 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 82 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
82 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 83 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
83 addItemBool("ShowIconSearch",&mShowIconSearch,true); 84 addItemBool("ShowIconSearch",&mShowIconSearch,true);
84 addItemBool("ShowIconList",&mShowIconList,true); 85 addItemBool("ShowIconList",&mShowIconList,true);
85 addItemBool("ShowIconDay1",&mShowIconDay1,true); 86 addItemBool("ShowIconDay1",&mShowIconDay1,true);
86 addItemBool("ShowIconDay5",&mShowIconDay5,true); 87 addItemBool("ShowIconDay5",&mShowIconDay5,true);
87 addItemBool("ShowIconDay7",&mShowIconDay7,true); 88 addItemBool("ShowIconDay7",&mShowIconDay7,true);
88 addItemBool("ShowIconMonth",&mShowIconMonth,true); 89 addItemBool("ShowIconMonth",&mShowIconMonth,true);
89 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 90 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
90 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 91 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
91 addItemBool("ShowIconBack",&mShowIconBack,true); 92 addItemBool("ShowIconBack",&mShowIconBack,true);
92 addItemBool("ShowIconToday",&mShowIconToday,true); 93 addItemBool("ShowIconToday",&mShowIconToday,true);
93 addItemBool("ShowIconForward",&mShowIconForward,true); 94 addItemBool("ShowIconForward",&mShowIconForward,true);
94 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 95 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
95 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 96 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
96 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 97 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
97 addItemBool("ShowIconNext",&mShowIconNext,true); 98 addItemBool("ShowIconNext",&mShowIconNext,true);
98 addItemBool("ShowIconJournal",&mShowIconJournal,true); 99 addItemBool("ShowIconJournal",&mShowIconJournal,true);
99 addItemBool("ShowIconStretch",&mShowIconStretch,true); 100 addItemBool("ShowIconStretch",&mShowIconStretch,true);
100 addItemBool("LanguageChanged",&mLanguageChanged,false); 101 addItemBool("LanguageChanged",&mLanguageChanged,false);
101 102
102 addItemBool("AskForQuit",&mAskForQuit,false); 103 addItemBool("AskForQuit",&mAskForQuit,false);
103 104
104#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
105 addItemBool("ShowFullMenu",&mShowFullMenu,false); 106 addItemBool("ShowFullMenu",&mShowFullMenu,false);
106#else 107#else
107 addItemBool("ShowFullMenu",&mShowFullMenu,true); 108 addItemBool("ShowFullMenu",&mShowFullMenu,true);
108#endif 109#endif
109 addItemBool("ToolBarHor",&mToolBarHor, true ); 110 addItemBool("ToolBarHor",&mToolBarHor, true );
110 addItemBool("ToolBarUp",&mToolBarUp, false ); 111 addItemBool("ToolBarUp",&mToolBarUp, false );
111 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 112 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
112 addItemInt("Whats Next Days",&mWhatsNextDays,3); 113 addItemInt("Whats Next Days",&mWhatsNextDays,3);
113 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 114 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
114 115
115 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 116 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
116 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 117 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
117 addItemInt("AllDay Size",&mAllDaySize,28); 118 addItemInt("AllDay Size",&mAllDaySize,28);
118 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 119 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
119 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 120 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
120 121
121 addItemStringList("LocationDefaults",&mLocationDefaults ); 122 addItemStringList("LocationDefaults",&mLocationDefaults );
122 addItemStringList("EventSummary User",&mEventSummaryUser); 123 addItemStringList("EventSummary User",&mEventSummaryUser);
123 addItemStringList("TodoSummary User",&mTodoSummaryUser); 124 addItemStringList("TodoSummary User",&mTodoSummaryUser);
124 125
125 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 126 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
126 addItemBool("Enable Project View",&mEnableProjectView,false); 127 addItemBool("Enable Project View",&mEnableProjectView,false);
127 addItemBool("Auto Save",&mAutoSave,false); 128 addItemBool("Auto Save",&mAutoSave,false);
128 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 129 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
129 addItemBool("Confirm Deletes",&mConfirm,true); 130 addItemBool("Confirm Deletes",&mConfirm,true);
130 addItemString("Archive File",&mArchiveFile); 131 addItemString("Archive File",&mArchiveFile);
131 addItemString("Html Export File",&mHtmlExportFile, 132 addItemString("Html Export File",&mHtmlExportFile,
132 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 133 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
133 addItemBool("Html With Save",&mHtmlWithSave,false); 134 addItemBool("Html With Save",&mHtmlWithSave,false);
134 135
135 KPrefs::setCurrentGroup("Personal Settings"); 136 KPrefs::setCurrentGroup("Personal Settings");
136 137
137 addItemInt("Mail Client",&mMailClient,MailClientKMail); 138 addItemInt("Mail Client",&mMailClient,MailClientKMail);
138 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 139 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
139 addItemBool("Bcc",&mBcc,false); 140 addItemBool("Bcc",&mBcc,false);
140 141
141 KPrefs::setCurrentGroup("Time & Date"); 142 KPrefs::setCurrentGroup("Time & Date");
142 143
143 // addItemString("Time Zone",&mTimeZone,"+0100"); 144 // addItemString("Time Zone",&mTimeZone,"+0100");
144 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 145 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
145 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); 146 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
146 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 147 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
147 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 148 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
148 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 149 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
149 150
150 151
151 addItemInt("Default Start Time",&mStartTime,10); 152 addItemInt("Default Start Time",&mStartTime,10);
152 addItemInt("Default Duration",&mDefaultDuration,2); 153 addItemInt("Default Duration",&mDefaultDuration,2);
153 addItemInt("Default Alarm Time",&mAlarmTime,3); 154 addItemInt("Default Alarm Time",&mAlarmTime,3);
154 addItemInt("Daylight Savings",&mDaylightSavings,0); 155 addItemInt("Daylight Savings",&mDaylightSavings,0);
155 KPrefs::setCurrentGroup("AlarmSettings"); 156 KPrefs::setCurrentGroup("AlarmSettings");
156 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 157 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
157 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 158 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
158 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 159 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
159 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 160 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
160 161
161 162
162 KPrefs::setCurrentGroup("Calendar"); 163 KPrefs::setCurrentGroup("Calendar");
163 164
164 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 165 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
165 166
166 KPrefs::setCurrentGroup("Fonts"); 167 KPrefs::setCurrentGroup("Fonts");
167 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 168 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
168 addItemFont("TimeBar Font",&mTimeBarFont); 169 addItemFont("TimeBar Font",&mTimeBarFont);
169 addItemFont("MonthView Font",&mMonthViewFont); 170 addItemFont("MonthView Font",&mMonthViewFont);
170 addItemFont("AgendaView Font",&mAgendaViewFont); 171 addItemFont("AgendaView Font",&mAgendaViewFont);
171 addItemFont("MarcusBains Font",&mMarcusBainsFont); 172 addItemFont("MarcusBains Font",&mMarcusBainsFont);
172 addItemFont("TimeLabels Font",&mTimeLabelsFont); 173 addItemFont("TimeLabels Font",&mTimeLabelsFont);
173 addItemFont("TodoView Font",&mTodoViewFont); 174 addItemFont("TodoView Font",&mTodoViewFont);
174 addItemFont("ListView Font",&mListViewFont); 175 addItemFont("ListView Font",&mListViewFont);
175 addItemFont("DateNavigator Font",&mDateNavigatorFont); 176 addItemFont("DateNavigator Font",&mDateNavigatorFont);
176 addItemFont("EditBox Font",&mEditBoxFont); 177 addItemFont("EditBox Font",&mEditBoxFont);
177 addItemFont("JournalView Font",&mJornalViewFont); 178 addItemFont("JournalView Font",&mJornalViewFont);
178 addItemFont("WhatsNextView Font",&mWhatsNextFont); 179 addItemFont("WhatsNextView Font",&mWhatsNextFont);
179 addItemFont("EventView Font",&mEventViewFont); 180 addItemFont("EventView Font",&mEventViewFont);
180 181
181// KPrefs::setCurrentGroup("SyncProfiles"); 182// KPrefs::setCurrentGroup("SyncProfiles");
182// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 183// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
183// addItemStringList("SyncProfileNames",&mSyncProfileNames); 184// addItemStringList("SyncProfileNames",&mSyncProfileNames);
184// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); 185// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
185 186
186 KPrefs::setCurrentGroup("RemoteSyncing"); 187 KPrefs::setCurrentGroup("RemoteSyncing");
187// addItemBool("UsePasswd",&mUsePassWd,false); 188// addItemBool("UsePasswd",&mUsePassWd,false);
188// addItemBool("WriteBackFile",&mWriteBackFile,true); 189// addItemBool("WriteBackFile",&mWriteBackFile,true);
189// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 190// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
190// addItemBool("AskForPreferences",&mAskForPreferences,true); 191// addItemBool("AskForPreferences",&mAskForPreferences,true);
191// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 192// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
192 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 193 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
193 addItemInt("LastSyncTime",&mLastSyncTime,0); 194 addItemInt("LastSyncTime",&mLastSyncTime,0);
194 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); 195 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
195 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); 196 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
196 197
197#ifdef _WIN32_ 198#ifdef _WIN32_
198 QString hdp= locateLocal("data","korganizer")+"\\\\"; 199 QString hdp= locateLocal("data","korganizer")+"\\\\";
199#else 200#else
200 QString hdp= locateLocal("data","korganizer")+"/"; 201 QString hdp= locateLocal("data","korganizer")+"/";
201#endif 202#endif
202// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); 203// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
203// addItemString("RemoteUser",&mRemoteUser, "zaurus"); 204// addItemString("RemoteUser",&mRemoteUser, "zaurus");
204// addItemString("RemotePassWd",&mRemotePassWd, ""); 205// addItemString("RemotePassWd",&mRemotePassWd, "");
205// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); 206// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
206// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); 207// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
207 208
208 209
209 KPrefs::setCurrentGroup("LoadSaveFileNames"); 210 KPrefs::setCurrentGroup("LoadSaveFileNames");
210 211
211 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 212 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
212 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 213 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
213 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 214 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
214 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 215 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
215 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); 216 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
216 217
217 218
218 KPrefs::setCurrentGroup("Locale"); 219 KPrefs::setCurrentGroup("Locale");
219 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 220 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
220 addItemInt("PreferredTime",&mPreferredTime,0); 221 addItemInt("PreferredTime",&mPreferredTime,0);
221 addItemInt("PreferredDate",&mPreferredDate,0); 222 addItemInt("PreferredDate",&mPreferredDate,0);
222 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 223 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
223 addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 224 addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
224 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 225 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
225 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 226 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
226 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 227 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
227 228
228 229
229 KPrefs::setCurrentGroup("Colors"); 230 KPrefs::setCurrentGroup("Colors");
230 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 231 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
231 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 232 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
232 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 233 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
233 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 234 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
234 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 235 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
235 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 236 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
236 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 237 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
237 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 238 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
238 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 239 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
239 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 240 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
240 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 241 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
241 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 242 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
242 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 243 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
243 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 244 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
244 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 245 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
245 addItemBool("UseAppColors",&mUseAppColors,false); 246 addItemBool("UseAppColors",&mUseAppColors,false);
246 247
247 248
248 249
249 KPrefs::setCurrentGroup("Views"); 250 KPrefs::setCurrentGroup("Views");
250 addItemInt("Hour Size",&mHourSize,8); 251 addItemInt("Hour Size",&mHourSize,8);
251 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 252 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
252 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 253 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
253 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 254 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
254 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 255 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
255 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 256 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
256 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 257 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
257 addItemBool("Enable ToolTips",&mEnableToolTips,false); 258 addItemBool("Enable ToolTips",&mEnableToolTips,false);
258 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 259 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
259 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 260 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
260 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 261 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
261 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 262 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
262 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 263 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
263 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 264 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
264 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 265 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
265 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 266 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
266 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 267 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
267 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); 268 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
268 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 269 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
269 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 270 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
270 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 271 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
271 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 272 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
272 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 273 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
273 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 274 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
274 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 275 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
275 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 276 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
276#ifdef DESKTOP_VERSION 277#ifdef DESKTOP_VERSION
277 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 278 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
278#else 279#else
279 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 280 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
280#endif 281#endif
281 addItemInt("Day Begins",&mDayBegins,7); 282 addItemInt("Day Begins",&mDayBegins,7);
282 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 283 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
283 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 284 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
284 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 285 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
285 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 286 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
286 287
287 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 288 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
288 addItemBool("Full View Month",&mFullViewMonth,true); 289 addItemBool("Full View Month",&mFullViewMonth,true);
289 addItemBool("Full View Todo",&mFullViewTodo,true); 290 addItemBool("Full View Todo",&mFullViewTodo,true);
290 addItemBool("Quick Todo",&mEnableQuickTodo,false); 291 addItemBool("Quick Todo",&mEnableQuickTodo,false);
291 292
292 addItemInt("Next X Days",&mNextXDays,3); 293 addItemInt("Next X Days",&mNextXDays,3);
293 294
294 KPrefs::setCurrentGroup("Printer"); 295 KPrefs::setCurrentGroup("Printer");
295 296
296 KPrefs::setCurrentGroup("Layout"); 297 KPrefs::setCurrentGroup("Layout");
297 298
298 addItemBool("CompactDialogs",&mCompactDialogs,false); 299 addItemBool("CompactDialogs",&mCompactDialogs,false);
299 addItemBool("VerticalScreen",&mVerticalScreen,true); 300 addItemBool("VerticalScreen",&mVerticalScreen,true);
300 301
301 KPrefs::setCurrentGroup("KOrganizer Plugins"); 302 KPrefs::setCurrentGroup("KOrganizer Plugins");
302 303
303 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 304 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
304 305
305 KPrefs::setCurrentGroup("Group Scheduling"); 306 KPrefs::setCurrentGroup("Group Scheduling");
306 307
307 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 308 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
308 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 309 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
309 addItemStringList("AdditionalMails",&mAdditionalMails,""); 310 addItemStringList("AdditionalMails",&mAdditionalMails,"");
310 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 311 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
311 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 312 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
312 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 313 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
313 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 314 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
314 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 315 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
315 316
316 KPrefs::setCurrentGroup( "Editors" ); 317 KPrefs::setCurrentGroup( "Editors" );
317 318
318 addItemStringList( "EventTemplates", &mEventTemplates ); 319 addItemStringList( "EventTemplates", &mEventTemplates );
319 addItemStringList( "TodoTemplates", &mTodoTemplates ); 320 addItemStringList( "TodoTemplates", &mTodoTemplates );
320 321
321 addItemInt("DestinationPolicy",&mDestination,standardDestination); 322 addItemInt("DestinationPolicy",&mDestination,standardDestination);
322 323
323 324
324 325
325} 326}
326 327
327 328
328KOPrefs::~KOPrefs() 329KOPrefs::~KOPrefs()
329{ 330{
330 if (mInstance == this) 331 if (mInstance == this)
331 mInstance = insd.setObject(0); 332 mInstance = insd.setObject(0);
332 setLocaleDict( 0 ); 333 setLocaleDict( 0 );
333 if ( mLocaleDict ) 334 if ( mLocaleDict )
334 delete mLocaleDict; 335 delete mLocaleDict;
335 //qDebug("KOPrefs::~KOPrefs() "); 336 //qDebug("KOPrefs::~KOPrefs() ");
336} 337}
337 338
338 339
339KOPrefs *KOPrefs::instance() 340KOPrefs *KOPrefs::instance()
340{ 341{
341 if (!mInstance) { 342 if (!mInstance) {
342 mInstance = insd.setObject(new KOPrefs()); 343 mInstance = insd.setObject(new KOPrefs());
343 mInstance->readConfig(); 344 mInstance->readConfig();
344 } 345 }
345 346
346 return mInstance; 347 return mInstance;
347} 348}
348 349
349void KOPrefs::usrSetDefaults() 350void KOPrefs::usrSetDefaults()
350{ 351{
351 352
352} 353}
353 354
354void KOPrefs::fillMailDefaults() 355void KOPrefs::fillMailDefaults()
355{ 356{
356 if (mName.isEmpty()) mName = i18n("Anonymous"); 357 if (mName.isEmpty()) mName = i18n("Anonymous");
357 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 358 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
358} 359}
359 360
360void KOPrefs::setTimeZoneIdDefault() 361void KOPrefs::setTimeZoneIdDefault()
361{ 362{
362 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); 363 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
363} 364}
364 365
365void KOPrefs::setCategoryDefaults() 366void KOPrefs::setCategoryDefaults()
366{ 367{
367 mCustomCategories.clear(); 368 mCustomCategories.clear();
368 mCustomCategories = getDefaultList(); 369 mCustomCategories = getDefaultList();
369 370
370 QStringList::Iterator it; 371 QStringList::Iterator it;
371 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 372 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
372 setCategoryColor(*it,mDefaultCategoryColor); 373 setCategoryColor(*it,mDefaultCategoryColor);
373 } 374 }
374} 375}
375 376
376QStringList KOPrefs::getDefaultList() 377QStringList KOPrefs::getDefaultList()
377{ 378{
378 QStringList retval ; 379 QStringList retval ;
379 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 380 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
380 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 381 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
381 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 382 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
382 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 383 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
383 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 384 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
384 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 385 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
385 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 386 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
386 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 387 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
387 retval.sort(); 388 retval.sort();
388 return retval; 389 return retval;
389} 390}
390 391
391void KOPrefs::usrReadConfig() 392void KOPrefs::usrReadConfig()
392{ 393{
394 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
393 mLocaleDict = 0; 395 mLocaleDict = 0;
394 // pending LR fix translation 396 // pending LR fix translation
395 // qDebug("KOPrefs::usrReadConfig() fix translation "); 397 // qDebug("KOPrefs::usrReadConfig() fix translation ");
396 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { 398 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) {
397 if ( mPreferredLanguage == 1 ) { 399 if ( mPreferredLanguage == 1 ) {
398 mLocaleDict = new QDict<QString>; 400 mLocaleDict = new QDict<QString>;
399 int i = 0; 401 int i = 0;
400 QString fw ( germanwords[i] [0]); 402 QString fw ( germanwords[i] [0]);
401 while ( !fw.isEmpty() ) { 403 while ( !fw.isEmpty() ) {
402 mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); 404 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
403 ++i; 405 ++i;
404 fw = germanwords[i] [0]; 406 fw = germanwords[i] [0];
405 } 407 }
406 408
407 setLocaleDict( mLocaleDict ); 409 setLocaleDict( mLocaleDict );
408 } else { 410 } else {
409 QString fileName ; 411 QString fileName ;
410 if ( mPreferredLanguage == 3 ) 412 if ( mPreferredLanguage == 3 )
411 fileName = MainWindow::resourcePath()+"usertranslation.txt"; 413 fileName = MainWindow::resourcePath()+"usertranslation.txt";
412 else if ( mPreferredLanguage == 2 ) 414 else if ( mPreferredLanguage == 2 )
413 fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; 415 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
414 QFile file( fileName ); 416 QFile file( fileName );
415 if (file.open( IO_ReadOnly ) ) { 417 if (file.open( IO_ReadOnly ) ) {
416 QTextStream ts( &file ); 418 QTextStream ts( &file );
417 ts.setEncoding( QTextStream::Latin1 ); 419 ts.setEncoding( QTextStream::Latin1 );
418 //ts.setCodec( QTextCodec::latin1 ); 420 //ts.setCodec( QTextCodec::latin1 );
419 QString text = ts.read(); 421 QString text = ts.read();
420 file.close(); 422 file.close();
421 text.replace( QRegExp("\\\\n"), "\n" ); 423 text.replace( QRegExp("\\\\n"), "\n" );
422 QString line; 424 QString line;
423 QString we; 425 QString we;
424 QString wt; 426 QString wt;
425 int br = 0; 427 int br = 0;
426 int nbr; 428 int nbr;
427 nbr = text.find ( "},", br ); 429 nbr = text.find ( "},", br );
428 line = text.mid( br, nbr - br ); 430 line = text.mid( br, nbr - br );
429 br = nbr+1; 431 br = nbr+1;
430 int se, ee, st, et; 432 int se, ee, st, et;
431 mLocaleDict = new QDict<QString>; 433 mLocaleDict = new QDict<QString>;
432 QString end = "{ \"\",\"\" }"; 434 QString end = "{ \"\",\"\" }";
433 while ( (line != end) && (br > 1) ) { 435 while ( (line != end) && (br > 1) ) {
434 //qDebug("%d *%s* ", br, line.latin1()); 436 //qDebug("%d *%s* ", br, line.latin1());
435 se = line.find("\"")+1; 437 se = line.find("\"")+1;
436 et = line.findRev("\"",-1); 438 et = line.findRev("\"",-1);
437 ee = line.find("\",\""); 439 ee = line.find("\",\"");
438 st = ee+3; 440 st = ee+3;
439 we = line.mid( se, ee-se ); 441 we = line.mid( se, ee-se );
440 wt = line.mid( st, et-st ); 442 wt = line.mid( st, et-st );
441 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 443 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
442 mLocaleDict->insert( we, new QString (wt) ); 444 mLocaleDict->insert( we, new QString (wt) );
443 nbr = text.find ( "}", br ); 445 nbr = text.find ( "}", br );
444 line = text.mid( br, nbr - br ); 446 line = text.mid( br, nbr - br );
445 br = nbr+1; 447 br = nbr+1;
446 } 448 }
447 //qDebug("end *%s* ", end.latin1()); 449 //qDebug("end *%s* ", end.latin1());
448 450
449 setLocaleDict( mLocaleDict ); 451 setLocaleDict( mLocaleDict );
450 } else { 452 } else {
451 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 453 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
452 } 454 }
453 455
454 } 456 }
455 } 457 }
456 config()->setGroup("General"); 458 config()->setGroup("General");
457 459
458 mCustomCategories = config()->readListEntry("Custom Categories"); 460 mCustomCategories = config()->readListEntry("Custom Categories");
459 if ( KOPrefs::instance()->mLanguageChanged ) { 461 if ( KOPrefs::instance()->mLanguageChanged ) {
460 mLocationDefaults.clear(); 462 mLocationDefaults.clear();
461 mEventSummaryUser.clear(); 463 mEventSummaryUser.clear();
462 mTodoSummaryUser.clear(); 464 mTodoSummaryUser.clear();
463 } 465 }
464 if (mLocationDefaults.isEmpty()) { 466 if (mLocationDefaults.isEmpty()) {
465 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 467 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
466 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 468 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
467 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 469 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
468 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 470 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
469 mLocationDefaults.sort(); 471 mLocationDefaults.sort();
470 } 472 }
471 473
472 if (mEventSummaryUser.isEmpty()) { 474 if (mEventSummaryUser.isEmpty()) {
473 mEventSummaryUser = getDefaultList() ; 475 mEventSummaryUser = getDefaultList() ;
474 } 476 }
475 if (mTodoSummaryUser.isEmpty()) { 477 if (mTodoSummaryUser.isEmpty()) {
476 mTodoSummaryUser = getDefaultList() ; 478 mTodoSummaryUser = getDefaultList() ;
477 } 479 }
478 480
479 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 481 if (mCustomCategories.isEmpty()) setCategoryDefaults();
480 482
481 config()->setGroup("Personal Settings"); 483 config()->setGroup("Personal Settings");
482 mName = config()->readEntry("user_name",""); 484 mName = config()->readEntry("user_name","");
483 mEmail = config()->readEntry("user_email",""); 485 mEmail = config()->readEntry("user_email","");
484 fillMailDefaults(); 486 fillMailDefaults();
485 487
486 config()->setGroup("Category Colors"); 488 config()->setGroup("Category Colors");
487 QStringList::Iterator it; 489 QStringList::Iterator it;
488 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 490 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
489 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 491 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
490 492
491 } 493 }
492 494
493 if (mTimeZoneId.isEmpty()) { 495 if (mTimeZoneId.isEmpty()) {
494 setTimeZoneIdDefault(); 496 setTimeZoneIdDefault();
495 } 497 }
496 KPimPrefs::usrReadConfig(); 498 KPimPrefs::usrReadConfig();
497} 499}
498 500
499 501
500void KOPrefs::usrWriteConfig() 502void KOPrefs::usrWriteConfig()
501{ 503{
502 config()->setGroup("General"); 504 config()->setGroup("General");
503 config()->writeEntry("Custom Categories",mCustomCategories); 505 config()->writeEntry("Custom Categories",mCustomCategories);
504 506
505 config()->setGroup("Personal Settings"); 507 config()->setGroup("Personal Settings");
506 config()->writeEntry("user_name",mName); 508 config()->writeEntry("user_name",mName);
507 config()->writeEntry("user_email",mEmail); 509 config()->writeEntry("user_email",mEmail);
508 510
509 config()->setGroup("Category Colors"); 511 config()->setGroup("Category Colors");
510 QDictIterator<QColor> it(mCategoryColors); 512 QDictIterator<QColor> it(mCategoryColors);
511 while (it.current()) { 513 while (it.current()) {
512 config()->writeEntry(it.currentKey(),*(it.current())); 514 config()->writeEntry(it.currentKey(),*(it.current()));
513 ++it; 515 ++it;
514 } 516 }
515 517
516 518
517 KPimPrefs::usrWriteConfig(); 519 KPimPrefs::usrWriteConfig();
518} 520}
519 521
520void KOPrefs::setCategoryColor(QString cat,const QColor & color) 522void KOPrefs::setCategoryColor(QString cat,const QColor & color)
521{ 523{
522 mCategoryColors.replace(cat,new QColor(color)); 524 mCategoryColors.replace(cat,new QColor(color));
523} 525}
524 526
525QColor *KOPrefs::categoryColor(QString cat) 527QColor *KOPrefs::categoryColor(QString cat)
526{ 528{
527 QColor *color = 0; 529 QColor *color = 0;
528 530
529 if (!cat.isEmpty()) color = mCategoryColors[cat]; 531 if (!cat.isEmpty()) color = mCategoryColors[cat];
530 532
531 if (color) return color; 533 if (color) return color;
532 else return &mDefaultCategoryColor; 534 else return &mDefaultCategoryColor;
533} 535}
534 536
535void KOPrefs::setFullName(const QString &name) 537void KOPrefs::setFullName(const QString &name)
536{ 538{
537 mName = name; 539 mName = name;
538} 540}
539 541
540void KOPrefs::setEmail(const QString &email) 542void KOPrefs::setEmail(const QString &email)
541{ 543{
542 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 544 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
543 mEmail = email; 545 mEmail = email;
544} 546}
545 547
546QString KOPrefs::fullName() 548QString KOPrefs::fullName()
547{ 549{
548 if (mEmailControlCenter) { 550 if (mEmailControlCenter) {
549 KEMailSettings settings; 551 KEMailSettings settings;
550 return settings.getSetting(KEMailSettings::RealName); 552 return settings.getSetting(KEMailSettings::RealName);
551 } else { 553 } else {
552 return mName; 554 return mName;
553 } 555 }
554} 556}
555 557
556QString KOPrefs::email() 558QString KOPrefs::email()
557{ 559{
558 if (mEmailControlCenter) { 560 if (mEmailControlCenter) {
559 KEMailSettings settings; 561 KEMailSettings settings;
560 return settings.getSetting(KEMailSettings::EmailAddress); 562 return settings.getSetting(KEMailSettings::EmailAddress);
561 } else { 563 } else {
562 return mEmail; 564 return mEmail;
563 } 565 }
564} 566}
565KConfig* KOPrefs::getConfig() 567KConfig* KOPrefs::getConfig()
566{ 568{
567 return config(); 569 return config();
568} 570}
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 7dafcd8..b4b3b27 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,1621 +1,1637 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56 56
57#include <kurlrequester.h> 57#include <kurlrequester.h>
58#include <klineedit.h> 58#include <klineedit.h>
59 59
60#if defined(USE_SOLARIS) 60#if defined(USE_SOLARIS)
61#include <sys/param.h> 61#include <sys/param.h>
62 62
63#define ZONEINFODIR "/usr/share/lib/zoneinfo" 63#define ZONEINFODIR "/usr/share/lib/zoneinfo"
64#define INITFILE "/etc/default/init" 64#define INITFILE "/etc/default/init"
65#endif 65#endif
66 66
67#include "koprefs.h" 67#include "koprefs.h"
68 68
69#include "koprefsdialog.h" 69#include "koprefsdialog.h"
70#include "kpimglobalprefs.h" 70#include "kpimglobalprefs.h"
71 71
72 72
73KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 73KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
74 KPrefsDialog(KOPrefs::instance(),parent,name,true) 74 KPrefsDialog(KOPrefs::instance(),parent,name,true)
75{ 75{
76 76
77 setCaption( i18n("Preferences - some settings need a restart (nr)")); 77 setCaption( i18n("Preferences - some settings need a restart (nr)"));
78 mCategoryDict.setAutoDelete(true); 78 mCategoryDict.setAutoDelete(true);
79 79
80 KGlobal::locale()->insertCatalogue("timezones"); 80 KGlobal::locale()->insertCatalogue("timezones");
81 81
82 setupGlobalTab(); 82 setupGlobalTab();
83 setupMainTab(); 83 setupMainTab();
84 setupLocaleTab(); 84 // setupLocaleTab();
85 setupTimeZoneTab(); 85 //setupTimeZoneTab();
86 setupTimeTab(); 86 setupTimeTab();
87 setupLocaleDateTab(); 87 //setupLocaleDateTab();
88 setupFontsTab(); 88 setupFontsTab();
89 setupColorsTab(); 89 setupColorsTab();
90 setupViewsTab(); 90 setupViewsTab();
91 //setupSyncTab(); 91 //setupSyncTab();
92 //setupSyncAlgTab(); 92 //setupSyncAlgTab();
93 //setupPrinterTab(); 93 //setupPrinterTab();
94 //setupGroupSchedulingTab(); 94 //setupGroupSchedulingTab();
95 //setupGroupAutomationTab(); 95 //setupGroupAutomationTab();
96} 96}
97 97
98 98
99KOPrefsDialog::~KOPrefsDialog() 99KOPrefsDialog::~KOPrefsDialog()
100{ 100{
101} 101}
102void KOPrefsDialog::setupGlobalTab() 102void KOPrefsDialog::setupGlobalTab()
103{ 103{
104 QFrame *topFrame = addPage(i18n("Global"),0,0); 104 QFrame *topFrame = addPage(i18n("Global"),0,0);
105 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 105 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
106 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 106 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
107 topLayout->addWidget( kdelibcfg ); 107 topLayout->addWidget( kdelibcfg );
108 108
109 109
110} 110}
111void KOPrefsDialog::setupLocaleDateTab() 111void KOPrefsDialog::setupLocaleDateTab()
112{ 112{
113#if 0
113QFrame *topFrame = addPage(i18n("Date Format"),0,0); 114QFrame *topFrame = addPage(i18n("Date Format"),0,0);
114 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 115 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
115 topLayout->setSpacing(spacingHint()); 116 topLayout->setSpacing(spacingHint());
116 topLayout->setMargin(marginHint()); 117 topLayout->setMargin(marginHint());
117 int iii = 0; 118 int iii = 0;
118 119
119 120
120 KPrefsDialogWidRadios *syncPrefsGroup = 121 KPrefsDialogWidRadios *syncPrefsGroup =
121 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 122 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
122 QString format; 123 QString format;
123 if ( QApplication::desktop()->width() < 480 ) 124 if ( QApplication::desktop()->width() < 480 )
124 format = "(%d.%m.%Y)"; 125 format = "(%d.%m.%Y)";
125 else 126 else
126 format = "(%d.%m.%Y|%A %d %B %Y)"; 127 format = "(%d.%m.%Y|%A %d %B %Y)";
127 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 128 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
128 if ( QApplication::desktop()->width() < 480 ) 129 if ( QApplication::desktop()->width() < 480 )
129 format = "(%m.%d.%Y)"; 130 format = "(%m.%d.%Y)";
130 else 131 else
131 format = "(%m.%d.%Y|%A %B %d %Y)"; 132 format = "(%m.%d.%Y|%A %B %d %Y)";
132 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 133 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
133 if ( QApplication::desktop()->width() < 480 ) 134 if ( QApplication::desktop()->width() < 480 )
134 format = "(%Y-%m-%d)"; 135 format = "(%Y-%m-%d)";
135 else 136 else
136 format = "(%Y-%m-%d|%A %Y %B %d)"; 137 format = "(%Y-%m-%d|%A %Y %B %d)";
137 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 138 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
138 syncPrefsGroup->addRadio(i18n("User defined")); 139 syncPrefsGroup->addRadio(i18n("User defined"));
139 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 140 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
140 ++iii; 141 ++iii;
141 ++iii; 142 ++iii;
142 QLabel * lab; 143 QLabel * lab;
143 mUserDateFormatLong = new QLineEdit(topFrame); 144 mUserDateFormatLong = new QLineEdit(topFrame);
144 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 145 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
145 topLayout->addWidget(lab ,iii,0); 146 topLayout->addWidget(lab ,iii,0);
146 topLayout->addWidget(mUserDateFormatLong,iii,1); 147 topLayout->addWidget(mUserDateFormatLong,iii,1);
147 ++iii; 148 ++iii;
148 mUserDateFormatShort = new QLineEdit(topFrame); 149 mUserDateFormatShort = new QLineEdit(topFrame);
149 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 150 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
150 topLayout->addWidget(lab ,iii,0); 151 topLayout->addWidget(lab ,iii,0);
151 topLayout->addWidget(mUserDateFormatShort,iii,1); 152 topLayout->addWidget(mUserDateFormatShort,iii,1);
152 ++iii; 153 ++iii;
153 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 154 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
154 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 155 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
155 ++iii; 156 ++iii;
156 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 157 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
157 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 158 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
158 ++iii; 159 ++iii;
159 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 160 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
160 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 161 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
161 ++iii; 162 ++iii;
163#endif
162 164
163} 165}
164 166
165void KOPrefsDialog::setupLocaleTab() 167void KOPrefsDialog::setupLocaleTab()
166{ 168{
169#if 0
167 QFrame *topFrame = addPage(i18n("Locale"),0,0); 170 QFrame *topFrame = addPage(i18n("Locale"),0,0);
168 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 171 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
169 topLayout->setSpacing(spacingHint()); 172 topLayout->setSpacing(spacingHint());
170 topLayout->setMargin(marginHint()); 173 topLayout->setMargin(marginHint());
171 int iii = 0; 174 int iii = 0;
172 KPrefsDialogWidRadios *syncPrefsGroup = 175 KPrefsDialogWidRadios *syncPrefsGroup =
173 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 176 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
174 syncPrefsGroup->addRadio(i18n("English")); 177 syncPrefsGroup->addRadio(i18n("English"));
175 syncPrefsGroup->addRadio(i18n("German")); 178 syncPrefsGroup->addRadio(i18n("German"));
176 syncPrefsGroup->addRadio(i18n("French")); 179 syncPrefsGroup->addRadio(i18n("French"));
177 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 180 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
178 if ( QApplication::desktop()->width() < 300 ) 181 if ( QApplication::desktop()->width() < 300 )
179 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 182 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
180 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 183 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
181 ++iii; 184 ++iii;
182 185
183 syncPrefsGroup = 186 syncPrefsGroup =
184 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 187 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
185 if ( QApplication::desktop()->width() > 300 ) 188 if ( QApplication::desktop()->width() > 300 )
186 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 189 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
187 syncPrefsGroup->addRadio(i18n("24:00")); 190 syncPrefsGroup->addRadio(i18n("24:00"));
188 syncPrefsGroup->addRadio(i18n("12:00am")); 191 syncPrefsGroup->addRadio(i18n("12:00am"));
189 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 192 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
190 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 193 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
191 ++iii; 194 ++iii;
192 KPrefsDialogWidBool *sb; 195 KPrefsDialogWidBool *sb;
193 if ( QApplication::desktop()->width() < 300 ) { 196 if ( QApplication::desktop()->width() < 300 ) {
194 sb = 197 sb =
195 addWidBool(i18n("Week starts on Sunday"), 198 addWidBool(i18n("Week starts on Sunday"),
196 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 199 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
197 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 200 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
198 ++iii; 201 ++iii;
199 sb = 202 sb =
200 addWidBool(i18n("Use short date in (WN/E) view"), 203 addWidBool(i18n("Use short date in (WN/E) view"),
201 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 204 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
202 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 205 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
203 } 206 }
204 else { 207 else {
205 QWidget * hb = new QWidget( topFrame ); 208 QWidget * hb = new QWidget( topFrame );
206 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 209 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
207 sb = 210 sb =
208 addWidBool(i18n("Week starts on Sunday"), 211 addWidBool(i18n("Week starts on Sunday"),
209 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 212 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
210 hbLayout->addWidget(sb->checkBox() ); 213 hbLayout->addWidget(sb->checkBox() );
211 sb = 214 sb =
212 addWidBool(i18n("Use short date in (WN/E) view"), 215 addWidBool(i18n("Use short date in (WN/E) view"),
213 &(KOPrefs::instance()->mShortDateInViewer),hb); 216 &(KOPrefs::instance()->mShortDateInViewer),hb);
214 hbLayout->addWidget(sb->checkBox() ); 217 hbLayout->addWidget(sb->checkBox() );
215 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 218 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
216 219
217 } 220 }
218 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION 221 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
219#if 0 222#if 0
220 ++iii; 223 ++iii;
221 sb = 224 sb =
222 addWidBool(i18n("Quick load/save (w/o Unicode)"), 225 addWidBool(i18n("Quick load/save (w/o Unicode)"),
223 &(KOPrefs::instance()->mUseQuicksave),topFrame); 226 &(KOPrefs::instance()->mUseQuicksave),topFrame);
224 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 227 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
225#endif 228#endif
229#endif
226} 230}
227void KOPrefsDialog::showSyncPage() 231void KOPrefsDialog::showSyncPage()
228{ 232{
229 showPage ( 2 ) ; 233 showPage ( 2 ) ;
230 234
231} 235}
232void KOPrefsDialog::setupSyncAlgTab() 236void KOPrefsDialog::setupSyncAlgTab()
233{ 237{
234#if 0 238#if 0
235 QLabel * lab; 239 QLabel * lab;
236 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 240 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
237 mSetupSyncAlgTab = topFrame; 241 mSetupSyncAlgTab = topFrame;
238 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 242 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
239 topLayout->setSpacing(spacingHint()); 243 topLayout->setSpacing(spacingHint());
240 topLayout->setMargin(marginHint()); 244 topLayout->setMargin(marginHint());
241 int iii = 0; 245 int iii = 0;
242 246
243 KPrefsDialogWidBool *sb = 247 KPrefsDialogWidBool *sb =
244 addWidBool(i18n("Ask for preferences before syncing"), 248 addWidBool(i18n("Ask for preferences before syncing"),
245 &(KOPrefs::instance()->mAskForPreferences),topFrame); 249 &(KOPrefs::instance()->mAskForPreferences),topFrame);
246 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 250 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
247 251
248 ++iii; 252 ++iii;
249 253
250 KPrefsDialogWidRadios *syncPrefsGroup = 254 KPrefsDialogWidRadios *syncPrefsGroup =
251 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 255 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
252 topFrame); 256 topFrame);
253 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 257 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
254 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 258 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
255 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 259 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
256 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 260 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
257 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 261 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
258 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 262 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
259 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 263 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
260 ++iii; 264 ++iii;
261 sb = 265 sb =
262 addWidBool(i18n("Show summary after syncing"), 266 addWidBool(i18n("Show summary after syncing"),
263 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 267 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
264 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 268 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
265 269
266 ++iii; 270 ++iii;
267#endif 271#endif
268 272
269 273
270 274
271} 275}
272 276
273 277
274void KOPrefsDialog::setupSyncTab() 278void KOPrefsDialog::setupSyncTab()
275{ 279{
276#if 0 280#if 0
277 QLabel * lab; 281 QLabel * lab;
278 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 282 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
279 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 283 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
280 topLayout->setSpacing(spacingHint()); 284 topLayout->setSpacing(spacingHint());
281 topLayout->setMargin(marginHint()); 285 topLayout->setMargin(marginHint());
282 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 286 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
283 int iii = 0; 287 int iii = 0;
284 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 288 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
285 ++iii; 289 ++iii;
286 290
287 mRemoteIPEdit = new QLineEdit(topFrame); 291 mRemoteIPEdit = new QLineEdit(topFrame);
288 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 292 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
289 topLayout->addWidget(lab ,iii,0); 293 topLayout->addWidget(lab ,iii,0);
290 topLayout->addWidget(mRemoteIPEdit,iii,1); 294 topLayout->addWidget(mRemoteIPEdit,iii,1);
291 ++iii; 295 ++iii;
292 mRemoteUser = new QLineEdit(topFrame); 296 mRemoteUser = new QLineEdit(topFrame);
293 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 297 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
294 topLayout->addWidget(lab ,iii,0); 298 topLayout->addWidget(lab ,iii,0);
295 topLayout->addWidget(mRemoteUser, iii,1); 299 topLayout->addWidget(mRemoteUser, iii,1);
296 ++iii; 300 ++iii;
297 301
298 mRemoteFile = new QLineEdit(topFrame); 302 mRemoteFile = new QLineEdit(topFrame);
299 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 303 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
300 topLayout->addWidget(lab ,iii,0); 304 topLayout->addWidget(lab ,iii,0);
301 topLayout->addWidget(mRemoteFile,iii,1); 305 topLayout->addWidget(mRemoteFile,iii,1);
302 ++iii; 306 ++iii;
303 307
304 mLocalTempFile = new QLineEdit(topFrame); 308 mLocalTempFile = new QLineEdit(topFrame);
305 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 309 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
306 topLayout->addWidget(lab ,iii,0); 310 topLayout->addWidget(lab ,iii,0);
307 topLayout->addWidget(mLocalTempFile,iii,1); 311 topLayout->addWidget(mLocalTempFile,iii,1);
308 ++iii; 312 ++iii;
309 313
310 KPrefsDialogWidBool *wb = 314 KPrefsDialogWidBool *wb =
311 addWidBool(i18n("Write back synced file"), 315 addWidBool(i18n("Write back synced file"),
312 &(KOPrefs::instance()->mWriteBackFile),topFrame); 316 &(KOPrefs::instance()->mWriteBackFile),topFrame);
313 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 317 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
314 ++iii; 318 ++iii;
315 wb = 319 wb =
316 addWidBool(i18n("Write back existing entries only"), 320 addWidBool(i18n("Write back existing entries only"),
317 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); 321 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
318 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 322 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
319 ++iii; 323 ++iii;
320 324
321#endif 325#endif
322} 326}
323 327
324void KOPrefsDialog::setupMainTab() 328void KOPrefsDialog::setupMainTab()
325{ 329{
326 QFrame *topFrame = addPage(i18n("General"),0,0); 330 QFrame *topFrame = addPage(i18n("General"),0,0);
327 // DesktopIcon("identity",KIcon::SizeMedium)); 331 // DesktopIcon("identity",KIcon::SizeMedium));
328 332
329 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 333 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
330 topLayout->setSpacing(spacingHint()); 334 topLayout->setSpacing(spacingHint());
331 topLayout->setMargin(marginHint()); 335 topLayout->setMargin(marginHint());
332 336
333 // KPrefsDialogWidBool *emailControlCenter = 337 // KPrefsDialogWidBool *emailControlCenter =
334// addWidBool(i18n("&Use email settings from Control Center"), 338// addWidBool(i18n("&Use email settings from Control Center"),
335// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 339// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
336// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 340// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
337 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 341 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
338 // SLOT(toggleEmailSettings(bool))); 342 // SLOT(toggleEmailSettings(bool)));
339 343
340 mNameEdit = new QLineEdit(topFrame); 344 mNameEdit = new QLineEdit(topFrame);
341 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 345 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
342 topLayout->addWidget(mNameLabel,0,0); 346 topLayout->addWidget(mNameLabel,0,0);
343 topLayout->addWidget(mNameEdit,0,1); 347 topLayout->addWidget(mNameEdit,0,1);
344 348
345 mEmailEdit = new QLineEdit(topFrame); 349 mEmailEdit = new QLineEdit(topFrame);
346 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 350 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
347 topLayout->addWidget(mEmailLabel,1,0); 351 topLayout->addWidget(mEmailLabel,1,0);
348 topLayout->addWidget(mEmailEdit,1,1); 352 topLayout->addWidget(mEmailEdit,1,1);
349 KPrefsDialogWidBool *wb; 353 KPrefsDialogWidBool *wb;
350 QHBox *dummy; 354 QHBox *dummy;
351 if ( QApplication::desktop()->width() > 480 ) { 355 if ( QApplication::desktop()->width() > 480 ) {
352 dummy = new QHBox(topFrame); 356 dummy = new QHBox(topFrame);
353 } else { 357 } else {
354 dummy = new QVBox(topFrame); 358 dummy = new QVBox(topFrame);
355 } 359 }
356 360
357 topLayout->addMultiCellWidget(dummy, 2,2,0,1); 361 topLayout->addMultiCellWidget(dummy, 2,2,0,1);
358 addWidBool(i18n("Full menu bar(nr)"), 362 addWidBool(i18n("Full menu bar(nr)"),
359 &(KOPrefs::instance()->mShowFullMenu),dummy); 363 &(KOPrefs::instance()->mShowFullMenu),dummy);
360 364
361 365
362 addWidBool(i18n("Mini icons in toolbar(nr)"), 366 addWidBool(i18n("Mini icons in toolbar(nr)"),
363 &(KOPrefs::instance()->mToolBarMiniIcons),dummy); 367 &(KOPrefs::instance()->mToolBarMiniIcons),dummy);
364 368
365 369
366 dummy = new QHBox(topFrame); 370 dummy = new QHBox(topFrame);
367 new QLabel(i18n("Days in What's Next:"),dummy); 371 new QLabel(i18n("Days in What's Next:"),dummy);
368 mWhatsNextSpin = new QSpinBox(1,14,1,dummy); 372 mWhatsNextSpin = new QSpinBox(1,14,1,dummy);
369 373
370 topLayout->addMultiCellWidget(dummy,3,3,0,1); 374 topLayout->addMultiCellWidget(dummy,3,3,0,1);
371 375
372 376
373 377
374 dummy = new QHBox(topFrame); 378 dummy = new QHBox(topFrame);
375 new QLabel(i18n("Days in Next-X-Days:"),dummy); 379 new QLabel(i18n("Days in Next-X-Days:"),dummy);
376 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 380 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
377 381
378 topLayout->addMultiCellWidget(dummy,4,4,0,1); 382 topLayout->addMultiCellWidget(dummy,4,4,0,1);
379 383
380 QHBox *prioBox = new QHBox(topFrame); 384 QHBox *prioBox = new QHBox(topFrame);
381 // intervalBox->setSpacing(spacingHint()); 385 // intervalBox->setSpacing(spacingHint());
382 topLayout->addMultiCellWidget(prioBox,5,5,0,1); 386 topLayout->addMultiCellWidget(prioBox,5,5,0,1);
383 QString messa = i18n("Show topmost todo prios in What's Next:"); 387 QString messa = i18n("Show topmost todo prios in What's Next:");
384 388
385 if ( QApplication::desktop()->width() < 300 ) 389 if ( QApplication::desktop()->width() < 300 )
386 messa = i18n("Show topmost todo prios in What's N.:"); 390 messa = i18n("Show topmost todo prios in What's N.:");
387 QLabel *prioLabel = new QLabel(messa, prioBox); 391 QLabel *prioLabel = new QLabel(messa, prioBox);
388 mPrioSpin = new QSpinBox(0,5,1,prioBox); 392 mPrioSpin = new QSpinBox(0,5,1,prioBox);
389 if ( QApplication::desktop()->width() < 300 ) 393 if ( QApplication::desktop()->width() < 300 )
390 mPrioSpin->setFixedWidth( 40 ); 394 mPrioSpin->setFixedWidth( 40 );
391 395
392 // KPrefsDialogWidBool *bcc = 396 // KPrefsDialogWidBool *bcc =
393// addWidBool(i18n("Send copy to owner when mailing events"), 397// addWidBool(i18n("Send copy to owner when mailing events"),
394// &(KOPrefs::instance()->mBcc),topFrame); 398// &(KOPrefs::instance()->mBcc),topFrame);
395// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 399// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
396 400
397 401
398 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 402 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
399 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 403 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
400 404
401 // addWidBool(i18n("Enable automatic saving of calendar"), 405 // addWidBool(i18n("Enable automatic saving of calendar"),
402 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 406 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
403 407
404 QHBox *intervalBox = new QHBox(topFrame); 408 QHBox *intervalBox = new QHBox(topFrame);
405 // intervalBox->setSpacing(spacingHint()); 409 // intervalBox->setSpacing(spacingHint());
406 topLayout->addMultiCellWidget(intervalBox,6,6,0,1); 410 topLayout->addMultiCellWidget(intervalBox,6,6,0,1);
407 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 411 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
408 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 412 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
409 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 413 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
410 /* 414 /*
411 QHBox * agendasize = new QHBox ( topFrame ); 415 QHBox * agendasize = new QHBox ( topFrame );
412 416
413 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 417 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
414 418
415 419
416 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 420 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
417 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 421 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
418 */ 422 */
419 KPrefsDialogWidBool *verticalScreen = 423 KPrefsDialogWidBool *verticalScreen =
420 addWidBool(i18n("Show vertical screen (Needs restart)"), 424 addWidBool(i18n("Show vertical screen (Needs restart)"),
421 &(KOPrefs::instance()->mVerticalScreen),topFrame); 425 &(KOPrefs::instance()->mVerticalScreen),topFrame);
422 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 426 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
423 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); 427 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1);
424 428
425 KPrefsDialogWidBool *ask = 429 KPrefsDialogWidBool *ask =
426 addWidBool(i18n("Ask for quit when closing KO/Pi"), 430 addWidBool(i18n("Ask for quit when closing KO/Pi"),
427 &(KOPrefs::instance()->mAskForQuit),topFrame); 431 &(KOPrefs::instance()->mAskForQuit),topFrame);
428 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); 432 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1);
429 433
430 434
431 /* 435 /*
432 KPrefsDialogWidBool *confirmCheck = 436 KPrefsDialogWidBool *confirmCheck =
433 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), 437 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
434 topFrame); 438 topFrame);
435 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); 439 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
436 440
437 441
438 mEnableGroupScheduling = 442 mEnableGroupScheduling =
439 addWidBool(i18n("Enable group scheduling"), 443 addWidBool(i18n("Enable group scheduling"),
440 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); 444 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame);
441 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); 445 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0);
442 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), 446 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()),
443 SLOT(warningGroupScheduling())); 447 SLOT(warningGroupScheduling()));
444 448
445 mEnableProjectView = 449 mEnableProjectView =
446 addWidBool(i18n("Enable project view"), 450 addWidBool(i18n("Enable project view"),
447 &(KOPrefs::instance()->mEnableProjectView),topFrame); 451 &(KOPrefs::instance()->mEnableProjectView),topFrame);
448 topLayout->addWidget(mEnableProjectView->checkBox(),9,0); 452 topLayout->addWidget(mEnableProjectView->checkBox(),9,0);
449 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), 453 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()),
450 SLOT(warningProjectView())); 454 SLOT(warningProjectView()));
451 455
452 // Can't be disabled anymore 456 // Can't be disabled anymore
453 mEnableGroupScheduling->checkBox()->hide(); 457 mEnableGroupScheduling->checkBox()->hide();
454 458
455 // Disable setting, because this feature now becomes stable 459 // Disable setting, because this feature now becomes stable
456 mEnableProjectView->checkBox()->hide(); 460 mEnableProjectView->checkBox()->hide();
457 461
458 KPrefsDialogWidRadios *defaultFormatGroup = 462 KPrefsDialogWidRadios *defaultFormatGroup =
459 addWidRadios(i18n("Default Calendar Format"), 463 addWidRadios(i18n("Default Calendar Format"),
460 &(KOPrefs::instance()->mDefaultFormat),topFrame); 464 &(KOPrefs::instance()->mDefaultFormat),topFrame);
461 defaultFormatGroup->addRadio(i18n("vCalendar")); 465 defaultFormatGroup->addRadio(i18n("vCalendar"));
462 defaultFormatGroup->addRadio(i18n("iCalendar")); 466 defaultFormatGroup->addRadio(i18n("iCalendar"));
463 467
464 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 468 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
465 469
466 // Default format unconditionally is iCalendar 470 // Default format unconditionally is iCalendar
467 defaultFormatGroup->groupBox()->hide(); 471 defaultFormatGroup->groupBox()->hide();
468 472
469 KPrefsDialogWidRadios *mailClientGroup = 473 KPrefsDialogWidRadios *mailClientGroup =
470 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 474 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
471 topFrame); 475 topFrame);
472 mailClientGroup->addRadio(i18n("KMail")); 476 mailClientGroup->addRadio(i18n("KMail"));
473 mailClientGroup->addRadio(i18n("Sendmail")); 477 mailClientGroup->addRadio(i18n("Sendmail"));
474 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 478 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
475 479
476 KPrefsDialogWidBool *htmlsave = 480 KPrefsDialogWidBool *htmlsave =
477 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 481 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
478 topFrame); 482 topFrame);
479 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 483 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
480 484
481 KPrefsDialogWidRadios *destinationGroup = 485 KPrefsDialogWidRadios *destinationGroup =
482 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 486 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
483 topFrame); 487 topFrame);
484 destinationGroup->addRadio(i18n("be added to the standard resource")); 488 destinationGroup->addRadio(i18n("be added to the standard resource"));
485 destinationGroup->addRadio(i18n("be asked which resource to use")); 489 destinationGroup->addRadio(i18n("be asked which resource to use"));
486 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 490 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
487 491
488 topLayout->setRowStretch(14,1); 492 topLayout->setRowStretch(14,1);
489 */ 493 */
490} 494}
491 495
492 496
493void KOPrefsDialog::setupTimeTab() 497void KOPrefsDialog::setupTimeTab()
494{ 498{
495 QFrame *topFrame = addPage(i18n("Time"),0,0); 499 QFrame *topFrame = addPage(i18n("Time"),0,0);
496 // DesktopIcon("clock",KIcon::SizeMedium)); 500 // DesktopIcon("clock",KIcon::SizeMedium));
497 501
498 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 502 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
499 topLayout->setSpacing(spacingHint()); 503 topLayout->setSpacing(spacingHint());
500 topLayout->setMargin(marginHint()); 504 topLayout->setMargin(marginHint());
501 505
502 QHBox *dummy = new QHBox(topFrame); 506 QHBox *dummy = new QHBox(topFrame);
503 KPrefsDialogWidTime *dayBegins = 507 KPrefsDialogWidTime *dayBegins =
504 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 508 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
505 dummy); 509 dummy);
506 //topLayout->addWidget(dayBegins->label(),2,0); 510 //topLayout->addWidget(dayBegins->label(),2,0);
507 511
508 //topLayout->addWidget(dayBegins->spinBox(),2,1); 512 //topLayout->addWidget(dayBegins->spinBox(),2,1);
509 topLayout->addMultiCellWidget(dummy,0,0,0,1); 513 topLayout->addMultiCellWidget(dummy,0,0,0,1);
510 514
511 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 515 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
512 topFrame),1,0); 516 topFrame),1,0);
513 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 517 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
514 mStartTimeSpin->setSuffix(":00"); 518 mStartTimeSpin->setSuffix(":00");
515 topLayout->addWidget(mStartTimeSpin,1,1); 519 topLayout->addWidget(mStartTimeSpin,1,1);
516 520
517 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 521 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
518 topFrame),2,0); 522 topFrame),2,0);
519 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 523 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
520 mDefaultDurationSpin->setSuffix(":00"); 524 mDefaultDurationSpin->setSuffix(":00");
521 topLayout->addWidget(mDefaultDurationSpin,2,1); 525 topLayout->addWidget(mDefaultDurationSpin,2,1);
522 526
523 QStringList alarmList; 527 QStringList alarmList;
524 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 528 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
525 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 529 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
526 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 530 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
527 3,0); 531 3,0);
528 mAlarmTimeCombo = new QComboBox(topFrame); 532 mAlarmTimeCombo = new QComboBox(topFrame);
529 mAlarmTimeCombo->insertStringList(alarmList); 533 mAlarmTimeCombo->insertStringList(alarmList);
530 topLayout->addWidget(mAlarmTimeCombo,3,1); 534 topLayout->addWidget(mAlarmTimeCombo,3,1);
531 535
532 536
533 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 537 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
534 i18n("Working Hours"), 538 i18n("Working Hours"),
535 topFrame); 539 topFrame);
536 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 540 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
537 workingHoursGroup->layout()->setSpacing( 0 ); 541 workingHoursGroup->layout()->setSpacing( 0 );
538 workingHoursGroup->layout()->setMargin( 4 ); 542 workingHoursGroup->layout()->setMargin( 4 );
539 QHBox *workStartBox = new QHBox(workingHoursGroup); 543 QHBox *workStartBox = new QHBox(workingHoursGroup);
540 // workStartBox->setMargin( 0 ); 544 // workStartBox->setMargin( 0 );
541 addWidTime(i18n("Daily starting hour:"), 545 addWidTime(i18n("Daily starting hour:"),
542 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 546 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
543 547
544 QHBox *workEndBox = new QHBox(workingHoursGroup); 548 QHBox *workEndBox = new QHBox(workingHoursGroup);
545 //workEndBox->setMargin( 0 ); 549 //workEndBox->setMargin( 0 );
546 addWidTime(i18n("Daily ending hour:"), 550 addWidTime(i18n("Daily ending hour:"),
547 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 551 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
548 QVBox *excludeBox = new QVBox(workingHoursGroup); 552 QVBox *excludeBox = new QVBox(workingHoursGroup);
549 //excludeBox->setMargin( 0 ); 553 //excludeBox->setMargin( 0 );
550 addWidBool(i18n("Exclude holidays"), 554 addWidBool(i18n("Exclude holidays"),
551 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 555 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
552 556
553 addWidBool(i18n("Exclude Saturdays"), 557 addWidBool(i18n("Exclude Saturdays"),
554 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 558 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
555 559
556// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 560// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
557 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 561 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
558 // topFrame); 562 // topFrame);
559// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 563// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
560 564
561 // topLayout->setRowStretch(6,1); 565 // topLayout->setRowStretch(6,1);
562} 566}
563 567
564 568
565void KOPrefsDialog::setupViewsTab() 569void KOPrefsDialog::setupViewsTab()
566{ 570{
567 571
568 QFrame *topFrame = addPage(i18n("Views"),0,0); 572 QFrame *topFrame = addPage(i18n("Views"),0,0);
569 // DesktopIcon("viewmag",KIcon::SizeMedium)); 573 // DesktopIcon("viewmag",KIcon::SizeMedium));
570 574
571 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 575 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
572 topLayout->setSpacing(spacingHint()); 576 topLayout->setSpacing(spacingHint());
573 topLayout->setMargin(marginHint()); 577 topLayout->setMargin(marginHint());
574 578
575// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 579// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
576// topLayout->addLayout(dayBeginsLayout,0,0); 580// topLayout->addLayout(dayBeginsLayout,0,0);
577 581
578// KPrefsDialogWidTime *dayBegins = 582// KPrefsDialogWidTime *dayBegins =
579// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 583// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
580// topFrame); 584// topFrame);
581// dayBeginsLayout->addWidget(dayBegins->label()); 585// dayBeginsLayout->addWidget(dayBegins->label());
582// dayBeginsLayout->addStretch(1); 586// dayBeginsLayout->addStretch(1);
583// dayBeginsLayout->addWidget(dayBegins->spinBox()); 587// dayBeginsLayout->addWidget(dayBegins->spinBox());
584 588
585// QBoxLayout *nextDaysLayout = new QHBoxLayout; 589// QBoxLayout *nextDaysLayout = new QHBoxLayout;
586// topLayout->addLayout(nextDaysLayout,1,0); 590// topLayout->addLayout(nextDaysLayout,1,0);
587// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 591// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
588// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 592// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
589// nextDaysLayout->addStretch(1); 593// nextDaysLayout->addStretch(1);
590// nextDaysLayout->addWidget(mNextXDaysSpin); 594// nextDaysLayout->addWidget(mNextXDaysSpin);
591 595
592 596
593 int ii = 0; 597 int ii = 0;
594 KPrefsDialogWidBool *dummy = 598 KPrefsDialogWidBool *dummy =
595 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 599 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
596 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 600 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
597 topLayout->addWidget(dummy->checkBox(),ii++,0); 601 topLayout->addWidget(dummy->checkBox(),ii++,0);
598 602
599 dummy = 603 dummy =
600 addWidBool(i18n("Highlight current day in agenda"), 604 addWidBool(i18n("Highlight current day in agenda"),
601 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 605 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
602 topLayout->addWidget(dummy->checkBox(),ii++,0); 606 topLayout->addWidget(dummy->checkBox(),ii++,0);
603 607
604 dummy = 608 dummy =
605 addWidBool(i18n("Use light color for highlight current day"), 609 addWidBool(i18n("Use light color for highlight current day"),
606 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 610 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
607 topLayout->addWidget(dummy->checkBox(),ii++,0); 611 topLayout->addWidget(dummy->checkBox(),ii++,0);
608 612
609 KPrefsDialogWidBool *dailyRecur = 613 KPrefsDialogWidBool *dailyRecur =
610 addWidBool(i18n("Show events that recur daily in date nav."), 614 addWidBool(i18n("Show events that recur daily in date nav."),
611 &(KOPrefs::instance()->mDailyRecur),topFrame); 615 &(KOPrefs::instance()->mDailyRecur),topFrame);
612 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 616 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
613 617
614 KPrefsDialogWidBool *weeklyRecur = 618 KPrefsDialogWidBool *weeklyRecur =
615 addWidBool(i18n("Show ev. that recur weekly in date nav."), 619 addWidBool(i18n("Show ev. that recur weekly in date nav."),
616 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 620 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
617 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 621 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
618 if ( QApplication::desktop()->width() > 640 ) { 622 if ( QApplication::desktop()->width() > 640 ) {
619 623
620 KPrefsDialogWidBool *enableToolTips = 624 KPrefsDialogWidBool *enableToolTips =
621 addWidBool(i18n("Enable tooltips displaying summary of ev."), 625 addWidBool(i18n("Enable tooltips displaying summary of ev."),
622 &(KOPrefs::instance()->mEnableToolTips),topFrame); 626 &(KOPrefs::instance()->mEnableToolTips),topFrame);
623 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 627 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
624 628
625 } 629 }
626 KPrefsDialogWidBool *passwdk = 630
627 addWidBool(i18n("Show parent To-Do's in What's Next view"),
628 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
629 topLayout->addWidget(passwdk->checkBox(), ii++,0);
630
631 passwdk =
632 addWidBool(i18n("Show location in What's Next view"),
633 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
634 topLayout->addWidget(passwdk->checkBox(), ii++,0);
635
636 passwdk =
637 addWidBool(i18n("Show Sync Events in WN/Agenda view"),
638 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
639 topLayout->addWidget(passwdk->checkBox(), ii++,0);
640
641
642 KPrefsDialogWidBool *marcusBainsEnabled = 631 KPrefsDialogWidBool *marcusBainsEnabled =
643 addWidBool(i18n("Show Marcus Bains line"), 632 addWidBool(i18n("Show Marcus Bains line"),
644 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 633 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
645 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 634 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
646 635
647 636
648 // topLayout->addWidget(hourSizeGroup,ii++,0); 637 // topLayout->addWidget(hourSizeGroup,ii++,0);
649 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 638 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
650 //topLayout->setRowStretch(11,1); 639 //topLayout->setRowStretch(11,1);
651 640
652 641
653 642
654 643
655 644
656 645
657 topFrame = addPage(i18n("ViewChange"),0,0); 646 topFrame = addPage(i18n("ViewChange"),0,0);
658 // DesktopIcon("viewmag",KIcon::SizeMedium)); 647 // DesktopIcon("viewmag",KIcon::SizeMedium));
659 648
660 topLayout = new QGridLayout(topFrame,6,1); 649 topLayout = new QGridLayout(topFrame,6,1);
661 topLayout->setSpacing(spacingHint()); 650 topLayout->setSpacing(spacingHint());
662 topLayout->setMargin(marginHint()); 651 topLayout->setMargin(marginHint());
663 ii = 0; 652 ii = 0;
664 653
665 654
666 dummy = 655 dummy =
667 addWidBool(i18n("Hold fullscreen on view change"), 656 addWidBool(i18n("Hold fullscreen on view change"),
668 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 657 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
669 topLayout->addWidget(dummy->checkBox(),ii++,0); 658 topLayout->addWidget(dummy->checkBox(),ii++,0);
670 659
671 dummy = 660 dummy =
672 addWidBool(i18n("Hold non-fullscreen on view change"), 661 addWidBool(i18n("Hold non-fullscreen on view change"),
673 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 662 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
674 topLayout->addWidget(dummy->checkBox(),ii++,0); 663 topLayout->addWidget(dummy->checkBox(),ii++,0);
675 664
676 665
677 KPrefsDialogWidBool *fullViewTodo = 666 KPrefsDialogWidBool *fullViewTodo =
678 addWidBool(i18n("Event list view uses full window"), 667 addWidBool(i18n("Event list view uses full window"),
679 &(KOPrefs::instance()->mFullViewTodo),topFrame); 668 &(KOPrefs::instance()->mFullViewTodo),topFrame);
680 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 669 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
681 670
682 KPrefsDialogWidBool *fullViewMonth = 671 KPrefsDialogWidBool *fullViewMonth =
683 addWidBool(i18n("Next days view uses full window"), 672 addWidBool(i18n("Next days view uses full window"),
684 &(KOPrefs::instance()->mFullViewMonth),topFrame); 673 &(KOPrefs::instance()->mFullViewMonth),topFrame);
685 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 674 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
686 675
687 dummy = 676 dummy =
688 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 677 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
689 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 678 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
690 topLayout->addWidget(dummy->checkBox(),ii++,0); 679 topLayout->addWidget(dummy->checkBox(),ii++,0);
691 680
692 dummy = 681 dummy =
693 addWidBool(i18n("Set agenda to current time on change"), 682 addWidBool(i18n("Set agenda to current time on change"),
694 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 683 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
695 topLayout->addWidget(dummy->checkBox(),ii++,0); 684 topLayout->addWidget(dummy->checkBox(),ii++,0);
696 685
697 dummy = 686 dummy =
698 addWidBool(i18n("Listview uses monthly timespan"), 687 addWidBool(i18n("Listview uses monthly timespan"),
699 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 688 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
700 topLayout->addWidget(dummy->checkBox(),ii++,0); 689 topLayout->addWidget(dummy->checkBox(),ii++,0);
701 dummy = 690 dummy =
702 addWidBool(i18n("Highlight selection in Time Edit"), 691 addWidBool(i18n("Highlight selection in Time Edit"),
703 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 692 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
704 topLayout->addWidget( dummy->checkBox(), ii++,0); 693 topLayout->addWidget( dummy->checkBox(), ii++,0);
705 694
706 695
707 696
708 697
709 698
710 topFrame = addPage(i18n("Month View"),0,0); 699 topFrame = addPage(i18n("Month View"),0,0);
711 // DesktopIcon("viewmag",KIcon::SizeMedium)); 700 // DesktopIcon("viewmag",KIcon::SizeMedium));
712 701
713 topLayout = new QGridLayout(topFrame,5,1); 702 topLayout = new QGridLayout(topFrame,5,1);
714 topLayout->setSpacing(spacingHint()); 703 topLayout->setSpacing(spacingHint());
715 topLayout->setMargin(marginHint()); 704 topLayout->setMargin(marginHint());
716 ii = 0; 705 ii = 0;
717 QLabel *lab; 706 QLabel *lab;
718 QHBox *habo = new QHBox( topFrame ); 707 QHBox *habo = new QHBox( topFrame );
719 if ( QApplication::desktop()->width() < 320 ) { 708 if ( QApplication::desktop()->width() < 320 ) {
720 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 709 lab = new QLabel ( i18n("Show events that recur "), topFrame );
721 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 710 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
722 ii++; 711 ii++;
723 712
724 } else { 713 } else {
725 new QLabel ( i18n("Show events that recur "), habo ); 714 new QLabel ( i18n("Show events that recur "), habo );
726 715
727 } 716 }
728 dailyRecur = 717 dailyRecur =
729 addWidBool(i18n("daily"), 718 addWidBool(i18n("daily"),
730 &(KOPrefs::instance()->mMonthDailyRecur),habo); 719 &(KOPrefs::instance()->mMonthDailyRecur),habo);
731 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 720 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
732 721
733 weeklyRecur = 722 weeklyRecur =
734 addWidBool(i18n("weekly"), 723 addWidBool(i18n("weekly"),
735 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 724 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
736 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 725 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
737 ii++; 726 ii++;
738 727
739 728
740 habo = new QHBox( topFrame ); 729 habo = new QHBox( topFrame );
741 if ( QApplication::desktop()->width() < 320 ) { 730 if ( QApplication::desktop()->width() < 320 ) {
742 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 731 lab = new QLabel (i18n("Show in every cell ") , topFrame );
743 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 732 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
744 ii++; 733 ii++;
745 734
746 } else { 735 } else {
747 new QLabel ( i18n("Show in every cell "), habo ); 736 new QLabel ( i18n("Show in every cell "), habo );
748 } 737 }
749 weeklyRecur = 738 weeklyRecur =
750 addWidBool(i18n("short month"), 739 addWidBool(i18n("short month"),
751 &(KOPrefs::instance()->mMonthShowShort),habo); 740 &(KOPrefs::instance()->mMonthShowShort),habo);
752 weeklyRecur = 741 weeklyRecur =
753 addWidBool(i18n("icons"), 742 addWidBool(i18n("icons"),
754 &(KOPrefs::instance()->mMonthShowIcons),habo); 743 &(KOPrefs::instance()->mMonthShowIcons),habo);
755 744
756 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 745 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
757 ii++; 746 ii++;
758#ifdef DESKTOP_VERSION 747#ifdef DESKTOP_VERSION
759 KPrefsDialogWidBool *enableMonthScroll = 748 KPrefsDialogWidBool *enableMonthScroll =
760 addWidBool(i18n("Enable scrollbars in month view cells"), 749 addWidBool(i18n("Enable scrollbars in month view cells"),
761 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 750 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
762 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 751 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
763#endif 752#endif
764 753
765 dummy = 754 dummy =
766 addWidBool(i18n("Show Sat/Sun together"), 755 addWidBool(i18n("Show Sat/Sun together"),
767 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 756 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
768 topLayout->addWidget(dummy->checkBox(),ii++,0); 757 topLayout->addWidget(dummy->checkBox(),ii++,0);
769 758
770 KPrefsDialogWidBool *coloredCategoriesInMonthView = 759 KPrefsDialogWidBool *coloredCategoriesInMonthView =
771 addWidBool(i18n("Month view uses category colors"), 760 addWidBool(i18n("Month view uses category colors"),
772 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 761 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
773 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 762 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
774 763
775 dummy = 764 dummy =
776 addWidBool(i18n("Categorie colors are applied to text"), 765 addWidBool(i18n("Categorie colors are applied to text"),
777 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 766 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
778 topLayout->addWidget(dummy->checkBox(),ii++,0); 767 topLayout->addWidget(dummy->checkBox(),ii++,0);
779 coloredCategoriesInMonthView = 768 coloredCategoriesInMonthView =
780 addWidBool(i18n("Month view uses day colors"), 769 addWidBool(i18n("Month view uses day colors"),
781 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 770 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
782 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 771 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
783 772
784 KPrefsDialogWidColor *holidayColor = 773 KPrefsDialogWidColor *holidayColor =
785 addWidColor(i18n("Day color odd months"), 774 addWidColor(i18n("Day color odd months"),
786 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 775 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
787 topLayout->addWidget(holidayColor->label(),ii,0); 776 topLayout->addWidget(holidayColor->label(),ii,0);
788 topLayout->addWidget(holidayColor->button(),ii++,1); 777 topLayout->addWidget(holidayColor->button(),ii++,1);
789 778
790 holidayColor = 779 holidayColor =
791 addWidColor(i18n("Day color even months"), 780 addWidColor(i18n("Day color even months"),
792 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 781 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
793 topLayout->addWidget(holidayColor->label(),ii,0); 782 topLayout->addWidget(holidayColor->label(),ii,0);
794 topLayout->addWidget(holidayColor->button(),ii++,1); 783 topLayout->addWidget(holidayColor->button(),ii++,1);
795 784
796 785
797 holidayColor = 786 holidayColor =
798 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 787 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
799 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 788 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
800 topLayout->addWidget(holidayColor->label(),ii,0); 789 topLayout->addWidget(holidayColor->label(),ii,0);
801 topLayout->addWidget(holidayColor->button(),ii++,1); 790 topLayout->addWidget(holidayColor->button(),ii++,1);
802 791 // *********************** What'sNext View
792 topFrame = addPage(i18n("What's Next View"),0,0);
793 // DesktopIcon("viewmag",KIcon::SizeMedium));
794
795 topLayout = new QGridLayout(topFrame,4,1);
796 topLayout->setSpacing(spacingHint());
797 topLayout->setMargin(marginHint());
798 ii = 0;
799 KPrefsDialogWidBool *passwdk =
800 addWidBool(i18n("Show parent To-Do's in What's Next view"),
801 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
802 topLayout->addWidget(passwdk->checkBox(), ii++,0);
803
804 passwdk =
805 addWidBool(i18n("Show location in What's Next view"),
806 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
807 topLayout->addWidget(passwdk->checkBox(), ii++,0);
808
809 passwdk =
810 addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"),
811 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
812 topLayout->addWidget(passwdk->checkBox(), ii++,0);
813 passwdk =
814 addWidBool(i18n("Use short date in \nWhat's Next/Event view"),
815 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
816 topLayout->addMultiCellWidget(passwdk->checkBox(), ii,ii,0,1);
817
803 // *********************** Todo View 818 // *********************** Todo View
804 819
805 topFrame = addPage(i18n("Todo View"),0,0); 820 topFrame = addPage(i18n("Todo View"),0,0);
806 // DesktopIcon("viewmag",KIcon::SizeMedium)); 821 // DesktopIcon("viewmag",KIcon::SizeMedium));
807 822
808 topLayout = new QGridLayout(topFrame,4,1); 823 topLayout = new QGridLayout(topFrame,4,1);
809 topLayout->setSpacing(spacingHint()); 824 topLayout->setSpacing(spacingHint());
810 topLayout->setMargin(marginHint()); 825 topLayout->setMargin(marginHint());
811 ii = 0; 826 ii = 0;
812 827
813 KPrefsDialogWidBool *showCompletedTodo = 828 KPrefsDialogWidBool *showCompletedTodo =
814 addWidBool(i18n("To-do view shows completed Todos"), 829 addWidBool(i18n("To-do view shows completed Todos"),
815 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 830 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
816 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 831 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
817 dummy = 832 dummy =
818 addWidBool(i18n("To-do view shows complete as 'xx %'"), 833 addWidBool(i18n("To-do view shows complete as 'xx %'"),
819 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 834 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
820 topLayout->addWidget(dummy->checkBox(),ii++,0); 835 topLayout->addWidget(dummy->checkBox(),ii++,0);
821 836
822 dummy = 837 dummy =
823 addWidBool(i18n("Small To-do view uses smaller font"), 838 addWidBool(i18n("Small To-do view uses smaller font"),
824 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 839 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
825 topLayout->addWidget(dummy->checkBox(),ii++,0); 840 topLayout->addWidget(dummy->checkBox(),ii++,0);
826 841
827 842
828 843
829 dummy = 844 dummy =
830 addWidBool(i18n("Todo view uses category colors"), 845 addWidBool(i18n("Todo view uses category colors"),
831 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 846 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
832 topLayout->addWidget(dummy->checkBox(),ii++,0); 847 topLayout->addWidget(dummy->checkBox(),ii++,0);
833 848
834 849
835 QWidget* wid = new QWidget( topFrame ); 850 QWidget* wid = new QWidget( topFrame );
836 // Todo due today color 851 // Todo due today color
837 KPrefsDialogWidColor *todoDueTodayColor = 852 KPrefsDialogWidColor *todoDueTodayColor =
838 addWidColor(i18n("Todo due today color:"), 853 addWidColor(i18n("Todo due today color:"),
839 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 854 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
840 QHBoxLayout *widLayout = new QHBoxLayout(wid); 855 QHBoxLayout *widLayout = new QHBoxLayout(wid);
841 widLayout->addWidget( todoDueTodayColor->label() ); 856 widLayout->addWidget( todoDueTodayColor->label() );
842 widLayout->addWidget( todoDueTodayColor->button() ); 857 widLayout->addWidget( todoDueTodayColor->button() );
843 topLayout->addWidget(wid,ii++,0); 858 topLayout->addWidget(wid,ii++,0);
844 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 859 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
845 860
846 // Todo overdue color 861 // Todo overdue color
847 wid = new QWidget( topFrame ); 862 wid = new QWidget( topFrame );
848 widLayout = new QHBoxLayout(wid); 863 widLayout = new QHBoxLayout(wid);
849 KPrefsDialogWidColor *todoOverdueColor = 864 KPrefsDialogWidColor *todoOverdueColor =
850 addWidColor(i18n("Todo overdue color:"), 865 addWidColor(i18n("Todo overdue color:"),
851 &(KOPrefs::instance()->mTodoOverdueColor),wid); 866 &(KOPrefs::instance()->mTodoOverdueColor),wid);
852 widLayout->addWidget(todoOverdueColor->label()); 867 widLayout->addWidget(todoOverdueColor->label());
853 widLayout->addWidget(todoOverdueColor->button()); 868 widLayout->addWidget(todoOverdueColor->button());
854 topLayout->addWidget(wid,ii++,0); 869 topLayout->addWidget(wid,ii++,0);
855 870
856 dummy = 871 dummy =
857 addWidBool(i18n("Colors are applied to text"), 872 addWidBool(i18n("Colors are applied to text"),
858 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 873 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
859 topLayout->addWidget(dummy->checkBox(),ii++,0); 874 topLayout->addWidget(dummy->checkBox(),ii++,0);
860 875
861 dummy = 876 dummy =
862 addWidBool(i18n("Allday Agenda view shows todos"), 877 addWidBool(i18n("Allday Agenda view shows todos"),
863 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 878 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
864 topLayout->addWidget(dummy->checkBox(),ii++,0); 879 topLayout->addWidget(dummy->checkBox(),ii++,0);
865 880
866 881
867 882
868 883
869 topFrame = addPage(i18n("Alarm"),0,0); 884 topFrame = addPage(i18n("Alarm"),0,0);
870 // DesktopIcon("viewmag",KIcon::SizeMedium)); 885 // DesktopIcon("viewmag",KIcon::SizeMedium));
871 886
872 topLayout = new QGridLayout(topFrame,2,1); 887 topLayout = new QGridLayout(topFrame,2,1);
873 topLayout->setSpacing(spacingHint()); 888 topLayout->setSpacing(spacingHint());
874 topLayout->setMargin(marginHint()); 889 topLayout->setMargin(marginHint());
875 int iii = 0; 890 int iii = 0;
876 891
877 dummy = 892 dummy =
878 addWidBool(i18n("Use internal alarm notification"), 893 addWidBool(i18n("Use internal alarm notification"),
879 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 894 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
880 topLayout->addWidget(dummy->checkBox(),iii++,0); 895 topLayout->addWidget(dummy->checkBox(),iii++,0);
881 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 896 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
882 897
883 topLayout->addWidget(lab ,iii++,0); 898 topLayout->addWidget(lab ,iii++,0);
884#ifndef DESKTOP_VERSION 899#ifndef DESKTOP_VERSION
885 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 900 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
886#else 901#else
887 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 902 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
888 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 903 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
889#endif 904#endif
890 905
891 QHBox* dummyBox = new QHBox(topFrame); 906 QHBox* dummyBox = new QHBox(topFrame);
892 new QLabel(i18n("Play beeps count:"),dummyBox); 907 new QLabel(i18n("Play beeps count:"),dummyBox);
893 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 908 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
894 topLayout->addWidget(dummyBox,iii++,0); 909 topLayout->addWidget(dummyBox,iii++,0);
895 910
896 dummyBox = new QHBox(topFrame); 911 dummyBox = new QHBox(topFrame);
897 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 912 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
898 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 913 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
899 topLayout->addWidget(dummyBox,iii++,0); 914 topLayout->addWidget(dummyBox,iii++,0);
900 915
901 dummyBox = new QHBox(topFrame); 916 dummyBox = new QHBox(topFrame);
902 new QLabel(i18n("Default suspend time in min:"),dummyBox); 917 new QLabel(i18n("Default suspend time in min:"),dummyBox);
903 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 918 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
904 topLayout->addWidget(dummyBox,iii++,0); 919 topLayout->addWidget(dummyBox,iii++,0);
905 920
906 dummyBox = new QHBox(topFrame); 921 dummyBox = new QHBox(topFrame);
907 new QLabel(i18n("Auto suspend count:"),dummyBox); 922 new QLabel(i18n("Auto suspend count:"),dummyBox);
908 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 923 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
909 topLayout->addWidget(dummyBox,iii++,0); 924 topLayout->addWidget(dummyBox,iii++,0);
910 925
911 926
912 927
913 928
914 929
915 930
916 931
917 QHBox* hbo = new QHBox ( topFrame ); 932 QHBox* hbo = new QHBox ( topFrame );
918 mDefaultAlarmFile = new QLineEdit(hbo); 933 mDefaultAlarmFile = new QLineEdit(hbo);
919 QPushButton * loadTemplate = new QPushButton(hbo); 934 QPushButton * loadTemplate = new QPushButton(hbo);
920 QPixmap icon; 935 QPixmap icon;
921 if ( QApplication::desktop()->width() < 321 ) 936 if ( QApplication::desktop()->width() < 321 )
922 icon = SmallIcon("fileimport16"); 937 icon = SmallIcon("fileimport16");
923 else 938 else
924 icon = SmallIcon("fileimport"); 939 icon = SmallIcon("fileimport");
925 loadTemplate->setIconSet (icon ) ; 940 loadTemplate->setIconSet (icon ) ;
926 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 941 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
927 int size = loadTemplate->sizeHint().height(); 942 int size = loadTemplate->sizeHint().height();
928 loadTemplate->setFixedSize( size, size ); 943 loadTemplate->setFixedSize( size, size );
929 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 944 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
930 // topLayout->addWidget(lab ,iii++,0); 945 // topLayout->addWidget(lab ,iii++,0);
931 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 946 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
932 topLayout->addWidget(lab ,iii++,0); 947 topLayout->addWidget(lab ,iii++,0);
933 topLayout->addWidget(hbo,iii++,0); 948 topLayout->addWidget(hbo,iii++,0);
934 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 949 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
935 950
936// topLayout->addWidget(lab ,iii++,0); 951// topLayout->addWidget(lab ,iii++,0);
937// #ifndef DESKTOP_VERSION 952// #ifndef DESKTOP_VERSION
938// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 953// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
939// #else 954// #else
940// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 955// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
941// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 956// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
942// #endif 957// #endif
943 958
944 959
945} 960}
946 961
947void KOPrefsDialog::selectSoundFile() 962void KOPrefsDialog::selectSoundFile()
948{ 963{
949 QString fileName = mDefaultAlarmFile->text(); 964 QString fileName = mDefaultAlarmFile->text();
950 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 965 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
951 if ( fileName.length() > 0 ) 966 if ( fileName.length() > 0 )
952 mDefaultAlarmFile->setText( fileName ); 967 mDefaultAlarmFile->setText( fileName );
953} 968}
954void KOPrefsDialog::setupFontsTab() 969void KOPrefsDialog::setupFontsTab()
955{ 970{
956 971
957 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 972 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
958 // DesktopIcon("fonts",KIcon::SizeMedium)); 973 // DesktopIcon("fonts",KIcon::SizeMedium));
959 974
960 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 975 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
961 topLayout->setSpacing(1); 976 topLayout->setSpacing(1);
962 topLayout->setMargin(3); 977 topLayout->setMargin(3);
963 KPrefsDialogWidFont * tVFont; 978 KPrefsDialogWidFont * tVFont;
964 int i = 0; 979 int i = 0;
965 KPrefsDialogWidFont *timeLabelsFont = 980 KPrefsDialogWidFont *timeLabelsFont =
966 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 981 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
967 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 982 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
968 topLayout->addWidget(timeLabelsFont->label(),i,0); 983 topLayout->addWidget(timeLabelsFont->label(),i,0);
969 topLayout->addWidget(timeLabelsFont->preview(),i,1); 984 topLayout->addWidget(timeLabelsFont->preview(),i,1);
970 topLayout->addWidget(timeLabelsFont->button(),i,2); 985 topLayout->addWidget(timeLabelsFont->button(),i,2);
971 ++i; 986 ++i;
972 987
973 988
974 timeLabelsFont = 989 timeLabelsFont =
975 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 990 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
976 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 991 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
977 topLayout->addWidget(timeLabelsFont->label(),i,0); 992 topLayout->addWidget(timeLabelsFont->label(),i,0);
978 topLayout->addWidget(timeLabelsFont->preview(),i,1); 993 topLayout->addWidget(timeLabelsFont->preview(),i,1);
979 topLayout->addWidget(timeLabelsFont->button(),i,2); 994 topLayout->addWidget(timeLabelsFont->button(),i,2);
980 ++i; 995 ++i;
981 996
982 KPrefsDialogWidFont *timeBarFont = 997 KPrefsDialogWidFont *timeBarFont =
983 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 998 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
984 &(KOPrefs::instance()->mTimeBarFont),topFrame); 999 &(KOPrefs::instance()->mTimeBarFont),topFrame);
985 topLayout->addWidget(timeBarFont->label(),i,0); 1000 topLayout->addWidget(timeBarFont->label(),i,0);
986 topLayout->addWidget(timeBarFont->preview(),i,1); 1001 topLayout->addWidget(timeBarFont->preview(),i,1);
987 topLayout->addWidget(timeBarFont->button(),i,2); 1002 topLayout->addWidget(timeBarFont->button(),i,2);
988 ++i; 1003 ++i;
989 1004
990 1005
991 KPrefsDialogWidFont *marcusBainsFont = 1006 KPrefsDialogWidFont *marcusBainsFont =
992 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1007 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
993 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1008 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
994 topLayout->addWidget(marcusBainsFont->label(),i,0); 1009 topLayout->addWidget(marcusBainsFont->label(),i,0);
995 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1010 topLayout->addWidget(marcusBainsFont->preview(),i,1);
996 topLayout->addWidget(marcusBainsFont->button(),i,2); 1011 topLayout->addWidget(marcusBainsFont->button(),i,2);
997 ++i; 1012 ++i;
998 1013
999 tVFont = 1014 tVFont =
1000 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1015 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1001 &(KOPrefs::instance()->mEventViewFont),topFrame); 1016 &(KOPrefs::instance()->mEventViewFont),topFrame);
1002 topLayout->addWidget(tVFont->label(),i,0); 1017 topLayout->addWidget(tVFont->label(),i,0);
1003 topLayout->addWidget(tVFont->preview(),i,1); 1018 topLayout->addWidget(tVFont->preview(),i,1);
1004 topLayout->addWidget(tVFont->button(),i,2); 1019 topLayout->addWidget(tVFont->button(),i,2);
1005 ++i; 1020 ++i;
1006 1021
1007 1022
1008 1023
1009 tVFont = 1024 tVFont =
1010 addWidFont(i18n("Details"),i18n("EditorBox:"), 1025 addWidFont(i18n("Details"),i18n("EditorBox:"),
1011 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1026 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1012 topLayout->addWidget(tVFont->label(),i,0); 1027 topLayout->addWidget(tVFont->label(),i,0);
1013 topLayout->addWidget(tVFont->preview(),i,1); 1028 topLayout->addWidget(tVFont->preview(),i,1);
1014 topLayout->addWidget(tVFont->button(),i,2); 1029 topLayout->addWidget(tVFont->button(),i,2);
1015 ++i; 1030 ++i;
1016 1031
1017 1032
1018 1033
1019 topLayout->setColStretch(1,1); 1034 topLayout->setColStretch(1,1);
1020 topLayout->setRowStretch(4,1); 1035 topLayout->setRowStretch(4,1);
1021 1036
1022 1037
1023 i = 0; 1038 i = 0;
1024 topFrame = addPage(i18n("View Fonts"),0, 1039 topFrame = addPage(i18n("View Fonts"),0,
1025 DesktopIcon("fonts",KIcon::SizeMedium)); 1040 DesktopIcon("fonts",KIcon::SizeMedium));
1026 1041
1027 topLayout = new QGridLayout(topFrame,7,3); 1042 topLayout = new QGridLayout(topFrame,7,3);
1028 topLayout->setSpacing(1); 1043 topLayout->setSpacing(1);
1029 topLayout->setMargin(3); 1044 topLayout->setMargin(3);
1030 1045
1031 tVFont = 1046 tVFont =
1032 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1047 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1033 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1048 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1034 topLayout->addWidget(tVFont->label(),i,0); 1049 topLayout->addWidget(tVFont->label(),i,0);
1035 topLayout->addWidget(tVFont->preview(),i,1); 1050 topLayout->addWidget(tVFont->preview(),i,1);
1036 topLayout->addWidget(tVFont->button(),i,2); 1051 topLayout->addWidget(tVFont->button(),i,2);
1037 ++i; 1052 ++i;
1038 KPrefsDialogWidFont *agendaViewFont = 1053 KPrefsDialogWidFont *agendaViewFont =
1039 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1054 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1040 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1055 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1041 topLayout->addWidget(agendaViewFont->label(),i,0); 1056 topLayout->addWidget(agendaViewFont->label(),i,0);
1042 topLayout->addWidget(agendaViewFont->preview(),i,1); 1057 topLayout->addWidget(agendaViewFont->preview(),i,1);
1043 topLayout->addWidget(agendaViewFont->button(),i,2); 1058 topLayout->addWidget(agendaViewFont->button(),i,2);
1044 ++i; 1059 ++i;
1045 1060
1046 1061
1047 KPrefsDialogWidFont *monthViewFont = 1062 KPrefsDialogWidFont *monthViewFont =
1048 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1063 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1049 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1064 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1050 topLayout->addWidget(monthViewFont->label(),i,0); 1065 topLayout->addWidget(monthViewFont->label(),i,0);
1051 topLayout->addWidget(monthViewFont->preview(),i,1); 1066 topLayout->addWidget(monthViewFont->preview(),i,1);
1052 topLayout->addWidget(monthViewFont->button(),i,2); 1067 topLayout->addWidget(monthViewFont->button(),i,2);
1053 ++i; 1068 ++i;
1054 1069
1055 1070
1056 KPrefsDialogWidFont *lVFont = 1071 KPrefsDialogWidFont *lVFont =
1057 addWidFont(i18n("Event"),i18n("List View:"), 1072 addWidFont(i18n("Event"),i18n("List View:"),
1058 &(KOPrefs::instance()->mListViewFont),topFrame); 1073 &(KOPrefs::instance()->mListViewFont),topFrame);
1059 topLayout->addWidget(lVFont->label(),i,0); 1074 topLayout->addWidget(lVFont->label(),i,0);
1060 topLayout->addWidget(lVFont->preview(),i,1); 1075 topLayout->addWidget(lVFont->preview(),i,1);
1061 topLayout->addWidget(lVFont->button(),i,2); 1076 topLayout->addWidget(lVFont->button(),i,2);
1062 ++i; 1077 ++i;
1063 1078
1064 1079
1065 tVFont = 1080 tVFont =
1066 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1081 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1067 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1082 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1068 topLayout->addWidget(tVFont->label(),i,0); 1083 topLayout->addWidget(tVFont->label(),i,0);
1069 topLayout->addWidget(tVFont->preview(),i,1); 1084 topLayout->addWidget(tVFont->preview(),i,1);
1070 topLayout->addWidget(tVFont->button(),i,2); 1085 topLayout->addWidget(tVFont->button(),i,2);
1071 ++i; 1086 ++i;
1072 1087
1073 1088
1074 tVFont = 1089 tVFont =
1075 addWidFont(i18n("Today"),i18n("JournalView:"), 1090 addWidFont(i18n("Today"),i18n("JournalView:"),
1076 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1091 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1077 topLayout->addWidget(tVFont->label(),i,0); 1092 topLayout->addWidget(tVFont->label(),i,0);
1078 topLayout->addWidget(tVFont->preview(),i,1); 1093 topLayout->addWidget(tVFont->preview(),i,1);
1079 topLayout->addWidget(tVFont->button(),i,2); 1094 topLayout->addWidget(tVFont->button(),i,2);
1080 ++i; 1095 ++i;
1081 1096
1082 1097
1083 1098
1084 1099
1085 topLayout->setColStretch(1,1); 1100 topLayout->setColStretch(1,1);
1086 topLayout->setRowStretch(4,1); 1101 topLayout->setRowStretch(4,1);
1087 1102
1088 1103
1089 1104
1090 1105
1091} 1106}
1092 1107
1093void KOPrefsDialog::setupColorsTab() 1108void KOPrefsDialog::setupColorsTab()
1094{ 1109{
1095 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1110 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1096 // DesktopIcon("colorize",KIcon::SizeMedium)); 1111 // DesktopIcon("colorize",KIcon::SizeMedium));
1097 1112
1098 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1113 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1099 // topLayout->setSpacing(spacingHint()); 1114 // topLayout->setSpacing(spacingHint());
1100 // topLayout->setMargin(marginHint()); 1115 // topLayout->setMargin(marginHint());
1101 1116
1102 topLayout->setSpacing(2); 1117 topLayout->setSpacing(2);
1103 topLayout->setMargin(3); 1118 topLayout->setMargin(3);
1104 1119
1105 int ii = 1; 1120 int ii = 1;
1106 QGroupBox *categoryGroup ; 1121 QGroupBox *categoryGroup ;
1107 1122
1108 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1123 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1109 topFrame); 1124 topFrame);
1110 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1125 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1111 1126
1112 mCategoryCombo = new QComboBox(categoryGroup); 1127 mCategoryCombo = new QComboBox(categoryGroup);
1113 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1128 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1114 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1129 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1115 1130
1116 mCategoryButton = new KColorButton(categoryGroup); 1131 mCategoryButton = new KColorButton(categoryGroup);
1117 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1132 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1118 updateCategoryColor(); 1133 updateCategoryColor();
1119 1134
1120 1135
1121 // Holiday Color 1136 // Holiday Color
1122 1137
1123 KPrefsDialogWidColor *holidayColor = 1138 KPrefsDialogWidColor *holidayColor =
1124 addWidColor(i18n("Holiday color:"), 1139 addWidColor(i18n("Holiday color:"),
1125 &(KOPrefs::instance()->mHolidayColor),topFrame); 1140 &(KOPrefs::instance()->mHolidayColor),topFrame);
1126 topLayout->addWidget(holidayColor->label(),ii,0); 1141 topLayout->addWidget(holidayColor->label(),ii,0);
1127 topLayout->addWidget(holidayColor->button(),ii++,1); 1142 topLayout->addWidget(holidayColor->button(),ii++,1);
1128 1143
1129 // Highlight Color 1144 // Highlight Color
1130 KPrefsDialogWidColor *highlightColor = 1145 KPrefsDialogWidColor *highlightColor =
1131 addWidColor(i18n("Highlight color:"), 1146 addWidColor(i18n("Highlight color:"),
1132 &(KOPrefs::instance()->mHighlightColor),topFrame); 1147 &(KOPrefs::instance()->mHighlightColor),topFrame);
1133 topLayout->addWidget(highlightColor->label(),ii,0); 1148 topLayout->addWidget(highlightColor->label(),ii,0);
1134 topLayout->addWidget(highlightColor->button(),ii++,1); 1149 topLayout->addWidget(highlightColor->button(),ii++,1);
1135 1150
1136 // Event color 1151 // Event color
1137 KPrefsDialogWidColor *eventColor = 1152 KPrefsDialogWidColor *eventColor =
1138 addWidColor(i18n("Default event color:"), 1153 addWidColor(i18n("Default event color:"),
1139 &(KOPrefs::instance()->mEventColor),topFrame); 1154 &(KOPrefs::instance()->mEventColor),topFrame);
1140 topLayout->addWidget(eventColor->label(),ii,0); 1155 topLayout->addWidget(eventColor->label(),ii,0);
1141 topLayout->addWidget(eventColor->button(),ii++,1); 1156 topLayout->addWidget(eventColor->button(),ii++,1);
1142 1157
1143 // agenda view background color 1158 // agenda view background color
1144 KPrefsDialogWidColor *agendaBgColor = 1159 KPrefsDialogWidColor *agendaBgColor =
1145 addWidColor(i18n("Agenda view background color:"), 1160 addWidColor(i18n("Agenda view background color:"),
1146 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1161 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1147 topLayout->addWidget(agendaBgColor->label(),ii,0); 1162 topLayout->addWidget(agendaBgColor->label(),ii,0);
1148 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1163 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1149 1164
1150 // working hours color 1165 // working hours color
1151 KPrefsDialogWidColor *workingHoursColor = 1166 KPrefsDialogWidColor *workingHoursColor =
1152 addWidColor(i18n("Working hours color:"), 1167 addWidColor(i18n("Working hours color:"),
1153 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1168 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1154 topLayout->addWidget(workingHoursColor->label(),ii,0); 1169 topLayout->addWidget(workingHoursColor->label(),ii,0);
1155 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1170 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1156 1171
1157 KPrefsDialogWidBool *sb = 1172 KPrefsDialogWidBool *sb =
1158 addWidBool(i18n("Use colors for application:"), 1173 addWidBool(i18n("Use colors for application:"),
1159 &(KOPrefs::instance()->mUseAppColors),topFrame); 1174 &(KOPrefs::instance()->mUseAppColors),topFrame);
1160 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1175 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1161 1176
1162 ii++; 1177 ii++;
1163 KPrefsDialogWidColor * workingHoursColor1 = 1178 KPrefsDialogWidColor * workingHoursColor1 =
1164 addWidColor(i18n("Buttons, menus, etc.:"), 1179 addWidColor(i18n("Buttons, menus, etc.:"),
1165 &(KOPrefs::instance()->mAppColor1),topFrame); 1180 &(KOPrefs::instance()->mAppColor1),topFrame);
1166 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1181 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1167 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1182 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1168 1183
1169 KPrefsDialogWidColor * workingHoursColor2 = 1184 KPrefsDialogWidColor * workingHoursColor2 =
1170 addWidColor(i18n("Frames, labels, etc.:"), 1185 addWidColor(i18n("Frames, labels, etc.:"),
1171 &(KOPrefs::instance()->mAppColor2),topFrame); 1186 &(KOPrefs::instance()->mAppColor2),topFrame);
1172 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1187 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1173 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1188 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1174 1189
1175 1190
1176 1191
1177} 1192}
1178 1193
1179void KOPrefsDialog::setCategoryColor() 1194void KOPrefsDialog::setCategoryColor()
1180{ 1195{
1181 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1196 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1182} 1197}
1183 1198
1184void KOPrefsDialog::updateCategoryColor() 1199void KOPrefsDialog::updateCategoryColor()
1185{ 1200{
1186 QString cat = mCategoryCombo->currentText(); 1201 QString cat = mCategoryCombo->currentText();
1187 QColor *color = mCategoryDict.find(cat); 1202 QColor *color = mCategoryDict.find(cat);
1188 if (!color) { 1203 if (!color) {
1189 color = KOPrefs::instance()->categoryColor(cat); 1204 color = KOPrefs::instance()->categoryColor(cat);
1190 } 1205 }
1191 if (color) { 1206 if (color) {
1192 mCategoryButton->setColor(*color); 1207 mCategoryButton->setColor(*color);
1193 } 1208 }
1194} 1209}
1195 1210
1196void KOPrefsDialog::setupPrinterTab() 1211void KOPrefsDialog::setupPrinterTab()
1197{ 1212{
1198 mPrinterTab = addPage(i18n("Printing"),0, 1213 mPrinterTab = addPage(i18n("Printing"),0,
1199 DesktopIcon("fileprint",KIcon::SizeMedium)); 1214 DesktopIcon("fileprint",KIcon::SizeMedium));
1200 1215
1201 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1216 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1202 topLayout->setSpacing(spacingHint()); 1217 topLayout->setSpacing(spacingHint());
1203 topLayout->setMargin(marginHint()); 1218 topLayout->setMargin(marginHint());
1204 1219
1205 topLayout->setRowStretch(4,1); 1220 topLayout->setRowStretch(4,1);
1206} 1221}
1207 1222
1208void KOPrefsDialog::setupGroupSchedulingTab() 1223void KOPrefsDialog::setupGroupSchedulingTab()
1209{ 1224{
1210#if 0 1225#if 0
1211 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1226 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1212 DesktopIcon("personal",KIcon::SizeMedium)); 1227 DesktopIcon("personal",KIcon::SizeMedium));
1213 1228
1214 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1229 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1215 topLayout->setSpacing(spacingHint()); 1230 topLayout->setSpacing(spacingHint());
1216 topLayout->setMargin(marginHint()); 1231 topLayout->setMargin(marginHint());
1217 1232
1218#if 0 1233#if 0
1219 KPrefsDialogWidRadios *schedulerGroup = 1234 KPrefsDialogWidRadios *schedulerGroup =
1220 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1235 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1221 topFrame); 1236 topFrame);
1222 schedulerGroup->addRadio("Dummy"); // Only for debugging 1237 schedulerGroup->addRadio("Dummy"); // Only for debugging
1223 schedulerGroup->addRadio(i18n("Mail client")); 1238 schedulerGroup->addRadio(i18n("Mail client"));
1224 1239
1225 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1240 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1226#endif 1241#endif
1227 1242
1228 KPrefsDialogWidRadios *sendGroup = 1243 KPrefsDialogWidRadios *sendGroup =
1229 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1244 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1230 topFrame); 1245 topFrame);
1231 sendGroup->addRadio(i18n("Send to outbox")); 1246 sendGroup->addRadio(i18n("Send to outbox"));
1232 sendGroup->addRadio(i18n("Send directly")); 1247 sendGroup->addRadio(i18n("Send directly"));
1233 1248
1234 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1249 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1235 1250
1236 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1251 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1237 mAMails = new QListView(topFrame); 1252 mAMails = new QListView(topFrame);
1238 mAMails->addColumn(i18n("Email"),300); 1253 mAMails->addColumn(i18n("Email"),300);
1239 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1254 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1240 1255
1241 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1256 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1242 aEmailsEdit = new QLineEdit(topFrame); 1257 aEmailsEdit = new QLineEdit(topFrame);
1243 aEmailsEdit->setEnabled(false); 1258 aEmailsEdit->setEnabled(false);
1244 topLayout->addWidget(aEmailsEdit,4,1); 1259 topLayout->addWidget(aEmailsEdit,4,1);
1245 1260
1246 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1261 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1247 topLayout->addWidget(add,5,0); 1262 topLayout->addWidget(add,5,0);
1248 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1263 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1249 topLayout->addWidget(del,5,1); 1264 topLayout->addWidget(del,5,1);
1250 1265
1251 //topLayout->setRowStretch(2,1); 1266 //topLayout->setRowStretch(2,1);
1252 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1267 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1253 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1268 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1254 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1269 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1255 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1270 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1256#endif 1271#endif
1257} 1272}
1258 1273
1259void KOPrefsDialog::setupGroupAutomationTab() 1274void KOPrefsDialog::setupGroupAutomationTab()
1260{ 1275{
1261 return; 1276 return;
1262 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1277 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1263 DesktopIcon("personal",KIcon::SizeMedium)); 1278 DesktopIcon("personal",KIcon::SizeMedium));
1264 1279
1265 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1280 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1266 topLayout->setSpacing(spacingHint()); 1281 topLayout->setSpacing(spacingHint());
1267 topLayout->setMargin(marginHint()); 1282 topLayout->setMargin(marginHint());
1268 1283
1269 KPrefsDialogWidRadios *autoRefreshGroup = 1284 KPrefsDialogWidRadios *autoRefreshGroup =
1270 addWidRadios(i18n("Auto Send Refresh"), 1285 addWidRadios(i18n("Auto Send Refresh"),
1271 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1286 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1272 autoRefreshGroup->addRadio(i18n("Never")); 1287 autoRefreshGroup->addRadio(i18n("Never"));
1273 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1288 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1274 //autoRefreshGroup->addRadio(i18n("selected emails")); 1289 //autoRefreshGroup->addRadio(i18n("selected emails"));
1275 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1290 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1276 1291
1277 KPrefsDialogWidRadios *autoInsertGroup = 1292 KPrefsDialogWidRadios *autoInsertGroup =
1278 addWidRadios(i18n("Auto Insert IMIP Replies"), 1293 addWidRadios(i18n("Auto Insert IMIP Replies"),
1279 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1294 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1280 autoInsertGroup->addRadio(i18n("Never")); 1295 autoInsertGroup->addRadio(i18n("Never"));
1281 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1296 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1282 //autoInsertGroup->addRadio(i18n("selected emails")); 1297 //autoInsertGroup->addRadio(i18n("selected emails"));
1283 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1298 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1284 1299
1285 KPrefsDialogWidRadios *autoRequestGroup = 1300 KPrefsDialogWidRadios *autoRequestGroup =
1286 addWidRadios(i18n("Auto Insert IMIP Requests"), 1301 addWidRadios(i18n("Auto Insert IMIP Requests"),
1287 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1302 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1288 autoRequestGroup->addRadio(i18n("Never")); 1303 autoRequestGroup->addRadio(i18n("Never"));
1289 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1304 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1290 //autoInsertGroup->addRadio(i18n("selected emails")); 1305 //autoInsertGroup->addRadio(i18n("selected emails"));
1291 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1306 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1292 1307
1293 KPrefsDialogWidRadios *autoFreeBusyGroup = 1308 KPrefsDialogWidRadios *autoFreeBusyGroup =
1294 addWidRadios(i18n("Auto Send FreeBusy Information"), 1309 addWidRadios(i18n("Auto Send FreeBusy Information"),
1295 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1310 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1296 autoFreeBusyGroup->addRadio(i18n("Never")); 1311 autoFreeBusyGroup->addRadio(i18n("Never"));
1297 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1312 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1298 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1313 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1299 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1314 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1300 1315
1301 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1316 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1302 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1317 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1303 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1318 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1304 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1319 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1305 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1320 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1306 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1321 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1307 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1322 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1308} 1323}
1309 1324
1310void KOPrefsDialog::showPrinterTab() 1325void KOPrefsDialog::showPrinterTab()
1311{ 1326{
1312 showPage(pageIndex(mPrinterTab)); 1327 showPage(pageIndex(mPrinterTab));
1313} 1328}
1314 1329
1315 1330
1316void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1331void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1317 const QStringList *tags) 1332 const QStringList *tags)
1318{ 1333{
1319 if (tags) { 1334 if (tags) {
1320 int i = tags->findIndex(text); 1335 int i = tags->findIndex(text);
1321 if (i > 0) combo->setCurrentItem(i); 1336 if (i > 0) combo->setCurrentItem(i);
1322 } else { 1337 } else {
1323 for(int i=0;i<combo->count();++i) { 1338 for(int i=0;i<combo->count();++i) {
1324 if (combo->text(i) == text) { 1339 if (combo->text(i) == text) {
1325 combo->setCurrentItem(i); 1340 combo->setCurrentItem(i);
1326 break; 1341 break;
1327 } 1342 }
1328 } 1343 }
1329 } 1344 }
1330} 1345}
1331 1346
1332void KOPrefsDialog::usrReadConfig() 1347void KOPrefsDialog::usrReadConfig()
1333{ 1348{
1334 kdelibcfg->readConfig(); 1349 kdelibcfg->readConfig();
1335 mNameEdit->setText(KOPrefs::instance()->fullName()); 1350 mNameEdit->setText(KOPrefs::instance()->fullName());
1336 mEmailEdit->setText(KOPrefs::instance()->email()); 1351 mEmailEdit->setText(KOPrefs::instance()->email());
1337 1352
1338 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1353 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1339 QDate current ( 2001, 1,1); 1354 // QDate current ( 2001, 1,1);
1340 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1355 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1341 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1356 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1342 setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); 1357 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
1343 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1358 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1344 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1359 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1345 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1360 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1346 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1361 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1347 // if (KOPrefs::instance()->mAllDaySize > 47 ) 1362 // if (KOPrefs::instance()->mAllDaySize > 47 )
1348 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; 1363 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
1349 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 1364 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
1350 1365
1351 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1366 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1352 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1367 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1353 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1368 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1354 // mAMails->clear(); 1369 // mAMails->clear();
1355 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1370 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1356// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1371// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1357// QListViewItem *item = new QListViewItem(mAMails); 1372// QListViewItem *item = new QListViewItem(mAMails);
1358// item->setText(0,*it); 1373// item->setText(0,*it);
1359// mAMails->insertItem(item); 1374// mAMails->insertItem(item);
1360// } 1375// }
1361 1376
1362 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); 1377 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
1363 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); 1378 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
1364 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); 1379 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
1365 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); 1380 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
1366 1381
1367 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1382 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1368 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1383 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1369 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1384 //QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1370 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 1385 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
1371 dummy = KOPrefs::instance()->mUserDateFormatShort; 1386 //dummy = KOPrefs::instance()->mUserDateFormatShort;
1372 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 1387 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
1373 updateCategories(); 1388 updateCategories();
1374 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1389 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1375 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1390 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1376 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1391 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1377 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1392 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1378} 1393}
1379 1394
1380 1395
1381void KOPrefsDialog::usrWriteConfig() 1396void KOPrefsDialog::usrWriteConfig()
1382{ 1397{
1383 1398
1384 kdelibcfg->writeConfig(); 1399 kdelibcfg->writeConfig();
1385 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); 1400 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
1386 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); 1401 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
1387 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); 1402 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
1388 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); 1403 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
1389 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); 1404 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
1390 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1405 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1391 1406
1392 KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 1407 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
1393 KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 1408 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
1394 KOPrefs::instance()->setFullName(mNameEdit->text()); 1409 KOPrefs::instance()->setFullName(mNameEdit->text());
1395 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1410 KOPrefs::instance()->setEmail(mEmailEdit->text());
1396 1411
1397 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1412 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1398 1413
1399 KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); 1414 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
1400 QDate date; 1415 //QDate date;
1401 date = mStartDateSavingEdit->date(); 1416 //date = mStartDateSavingEdit->date();
1402 int sub = 0; 1417 //int sub = 0;
1403 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1418 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1404 sub = 1; 1419 // sub = 1;
1405 KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; 1420// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
1406 date = mEndDateSavingEdit->date(); 1421// date = mEndDateSavingEdit->date();
1407 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1422// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1408 sub = 1; 1423// sub = 1;
1409 else 1424// else
1410 sub = 0; 1425// sub = 0;
1411 KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; 1426// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
1412 // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); 1427// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
1413 1428
1414 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1429 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1415 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1430 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1416 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1431 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1417 1432
1418 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 1433 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
1419 1434
1420 QDictIterator<QColor> it(mCategoryDict); 1435 QDictIterator<QColor> it(mCategoryDict);
1421 while (it.current()) { 1436 while (it.current()) {
1422 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1437 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1423 ++it; 1438 ++it;
1424 } 1439 }
1425 1440
1426 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1441 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1427 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1442 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1428 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1443 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1429 1444
1430 KOPrefs::instance()->mAdditionalMails.clear(); 1445 KOPrefs::instance()->mAdditionalMails.clear();
1431 // QListViewItem *item; 1446 // QListViewItem *item;
1432 // item = mAMails->firstChild(); 1447 // item = mAMails->firstChild();
1433 // while (item) 1448 // while (item)
1434 // { 1449 // {
1435 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1450 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1436 // item = item->nextSibling(); 1451 // item = item->nextSibling();
1437 // } 1452 // }
1438 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1453 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1439 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1454 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1440 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1455 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1441 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1456 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1442 1457
1443} 1458}
1444 1459
1445void KOPrefsDialog::updateCategories() 1460void KOPrefsDialog::updateCategories()
1446{ 1461{
1447 mCategoryCombo->clear(); 1462 mCategoryCombo->clear();
1448 mCategoryDict.clear(); 1463 mCategoryDict.clear();
1449 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1464 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1450 updateCategoryColor(); 1465 updateCategoryColor();
1451} 1466}
1452 1467
1453void KOPrefsDialog::warningGroupScheduling() 1468void KOPrefsDialog::warningGroupScheduling()
1454{ 1469{
1455 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); 1470 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked());
1456} 1471}
1457 1472
1458void KOPrefsDialog::warningProjectView() 1473void KOPrefsDialog::warningProjectView()
1459{ 1474{
1460 warningExperimental(mEnableProjectView->checkBox()->isChecked()); 1475 warningExperimental(mEnableProjectView->checkBox()->isChecked());
1461} 1476}
1462 1477
1463void KOPrefsDialog::warningExperimental(bool on) 1478void KOPrefsDialog::warningExperimental(bool on)
1464{ 1479{
1465 if (on) { 1480 if (on) {
1466 KMessageBox::information(this,i18n("This is an experimental feature. " 1481 KMessageBox::information(this,i18n("This is an experimental feature. "
1467 "It may not work, it may do nothing useful and it may cause data loss. " 1482 "It may not work, it may do nothing useful and it may cause data loss. "
1468 "Use with care.\n" 1483 "Use with care.\n"
1469 "You have to restart KOrganizer for this setting to take effect.")); 1484 "You have to restart KOrganizer for this setting to take effect."));
1470 } else { 1485 } else {
1471 KMessageBox::information(this, 1486 KMessageBox::information(this,
1472 i18n("You have to restart KOrganizer for this setting to take effect.")); 1487 i18n("You have to restart KOrganizer for this setting to take effect."));
1473 } 1488 }
1474} 1489}
1475 1490
1476void KOPrefsDialog::toggleEmailSettings(bool on) 1491void KOPrefsDialog::toggleEmailSettings(bool on)
1477{ 1492{
1478 if (on) { 1493 if (on) {
1479 mEmailEdit->setEnabled(false); 1494 mEmailEdit->setEnabled(false);
1480 mNameEdit->setEnabled(false); 1495 mNameEdit->setEnabled(false);
1481 mEmailLabel->setEnabled(false); 1496 mEmailLabel->setEnabled(false);
1482 mNameLabel->setEnabled(false); 1497 mNameLabel->setEnabled(false);
1483 1498
1484 KEMailSettings settings; 1499 KEMailSettings settings;
1485 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1500 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1486 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1501 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1487 } else { 1502 } else {
1488 mEmailEdit->setEnabled(true); 1503 mEmailEdit->setEnabled(true);
1489 mNameEdit->setEnabled(true); 1504 mNameEdit->setEnabled(true);
1490 mEmailLabel->setEnabled(true); 1505 mEmailLabel->setEnabled(true);
1491 mNameLabel->setEnabled(true); 1506 mNameLabel->setEnabled(true);
1492 } 1507 }
1493} 1508}
1494 1509
1495void KOPrefsDialog::addItem() 1510void KOPrefsDialog::addItem()
1496{ 1511{
1497 // aEmailsEdit->setEnabled(true); 1512 // aEmailsEdit->setEnabled(true);
1498// QListViewItem *item = new QListViewItem(mAMails); 1513// QListViewItem *item = new QListViewItem(mAMails);
1499// mAMails->insertItem(item); 1514// mAMails->insertItem(item);
1500// mAMails->setSelected(item,true); 1515// mAMails->setSelected(item,true);
1501// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1516// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1502} 1517}
1503 1518
1504void KOPrefsDialog::removeItem() 1519void KOPrefsDialog::removeItem()
1505{ 1520{
1506// QListViewItem *item; 1521// QListViewItem *item;
1507// item = mAMails->selectedItem(); 1522// item = mAMails->selectedItem();
1508// if (!item) return; 1523// if (!item) return;
1509// mAMails->takeItem(item); 1524// mAMails->takeItem(item);
1510// item = mAMails->selectedItem(); 1525// item = mAMails->selectedItem();
1511// if (!item) { 1526// if (!item) {
1512// aEmailsEdit->setText(""); 1527// aEmailsEdit->setText("");
1513// aEmailsEdit->setEnabled(false); 1528// aEmailsEdit->setEnabled(false);
1514// } 1529// }
1515// if (mAMails->childCount() == 0) { 1530// if (mAMails->childCount() == 0) {
1516// aEmailsEdit->setEnabled(false); 1531// aEmailsEdit->setEnabled(false);
1517// } 1532// }
1518} 1533}
1519 1534
1520void KOPrefsDialog::updateItem() 1535void KOPrefsDialog::updateItem()
1521{ 1536{
1522 // QListViewItem *item; 1537 // QListViewItem *item;
1523// item = mAMails->selectedItem(); 1538// item = mAMails->selectedItem();
1524// if (!item) return; 1539// if (!item) return;
1525// item->setText(0,aEmailsEdit->text()); 1540// item->setText(0,aEmailsEdit->text());
1526} 1541}
1527 1542
1528void KOPrefsDialog::updateInput() 1543void KOPrefsDialog::updateInput()
1529{ 1544{
1530// QListViewItem *item; 1545// QListViewItem *item;
1531// item = mAMails->selectedItem(); 1546// item = mAMails->selectedItem();
1532// if (!item) return; 1547// if (!item) return;
1533// aEmailsEdit->setEnabled(true); 1548// aEmailsEdit->setEnabled(true);
1534// aEmailsEdit->setText(item->text(0)); 1549// aEmailsEdit->setText(item->text(0));
1535} 1550}
1536void KOPrefsDialog::updateTimezoneOffset( int index ) 1551void KOPrefsDialog::updateTimezoneOffset( int index )
1537{ 1552{
1538 /* 1553 /*
1539 qDebug("updateTimezoneOffset %d ", index); 1554 qDebug("updateTimezoneOffset %d ", index);
1540 if ( index < 24 ) { 1555 if ( index < 24 ) {
1541 mTimezoneOffsetSpin->setEnabled ( false ); 1556 mTimezoneOffsetSpin->setEnabled ( false );
1542 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); 1557 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 );
1543 1558
1544 1559
1545 } else { 1560 } else {
1546 if ( index == 24 ) { 1561 if ( index == 24 ) {
1547 mTimezoneOffsetSpin->setEnabled ( true ); 1562 mTimezoneOffsetSpin->setEnabled ( true );
1548 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1563 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1549 1564
1550 } else { 1565 } else {
1551 mTimezoneOffsetSpin->setEnabled ( false ); 1566 mTimezoneOffsetSpin->setEnabled ( false );
1552 mTimezoneOffsetSpin->setValue( 0 ); 1567 mTimezoneOffsetSpin->setValue( 0 );
1553 } 1568 }
1554 } 1569 }
1555 */ 1570 */
1556} 1571}
1557 1572
1558void KOPrefsDialog::setupTimeZoneTab() 1573void KOPrefsDialog::setupTimeZoneTab()
1559{ 1574{
1575#if 0
1560 QFrame *topFrame = addPage(i18n("Time Zone"),0,0); 1576 QFrame *topFrame = addPage(i18n("Time Zone"),0,0);
1561 // DesktopIcon("clock",KIcon::SizeMedium)); 1577 // DesktopIcon("clock",KIcon::SizeMedium));
1562 1578
1563 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1579 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1564 topLayout->setSpacing(spacingHint()); 1580 topLayout->setSpacing(spacingHint());
1565 topLayout->setMargin(marginHint()); 1581 topLayout->setMargin(marginHint());
1566 1582
1567 QHBox *timeZoneBox = new QHBox( topFrame ); 1583 QHBox *timeZoneBox = new QHBox( topFrame );
1568 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 1584 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
1569 1585
1570 new QLabel( i18n("Timezone:"), timeZoneBox ); 1586 new QLabel( i18n("Timezone:"), timeZoneBox );
1571 mTimeZoneCombo = new QComboBox( timeZoneBox ); 1587 mTimeZoneCombo = new QComboBox( timeZoneBox );
1572 if ( QApplication::desktop()->width() < 300 ) { 1588 if ( QApplication::desktop()->width() < 300 ) {
1573 mTimeZoneCombo->setMaximumWidth(150); 1589 mTimeZoneCombo->setMaximumWidth(150);
1574 } 1590 }
1575 1591
1576 QStringList list; 1592 QStringList list;
1577 list = KGlobal::locale()->timeZoneList(); 1593 list = KGlobal::locale()->timeZoneList();
1578 mTimeZoneCombo->insertStringList(list); 1594 mTimeZoneCombo->insertStringList(list);
1579 1595
1580 // find the currently set time zone and select it 1596 // find the currently set time zone and select it
1581 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; 1597 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId;
1582 int nCurrentlySet = 11; 1598 int nCurrentlySet = 11;
1583 for (int i = 0; i < mTimeZoneCombo->count(); i++) 1599 for (int i = 0; i < mTimeZoneCombo->count(); i++)
1584 { 1600 {
1585 if (mTimeZoneCombo->text(i) == sCurrentlySet) 1601 if (mTimeZoneCombo->text(i) == sCurrentlySet)
1586 { 1602 {
1587 nCurrentlySet = i; 1603 nCurrentlySet = i;
1588 break; 1604 break;
1589 } 1605 }
1590 } 1606 }
1591 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 1607 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
1592 int iii = 1; 1608 int iii = 1;
1593 KPrefsDialogWidBool *sb = 1609 KPrefsDialogWidBool *sb =
1594 addWidBool(i18n("Timezone has daylight saving"), 1610 addWidBool(i18n("Timezone has daylight saving"),
1595 &(KOPrefs::instance()->mUseDaylightsaving),topFrame); 1611 &(KOPrefs::instance()->mUseDaylightsaving),topFrame);
1596 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 1612 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
1597 ++iii; 1613 ++iii;
1598 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 1614 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
1599 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1615 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1600 ++iii; 1616 ++iii;
1601 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 1617 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
1602 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1618 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1603 ++iii; 1619 ++iii;
1604 lab = new QLabel( i18n("Daylight start:"), topFrame ); 1620 lab = new QLabel( i18n("Daylight start:"), topFrame );
1605 topLayout->addWidget(lab, iii,0); 1621 topLayout->addWidget(lab, iii,0);
1606 mStartDateSavingEdit = new KDateEdit(topFrame); 1622 mStartDateSavingEdit = new KDateEdit(topFrame);
1607 topLayout->addWidget(mStartDateSavingEdit, iii,1); 1623 topLayout->addWidget(mStartDateSavingEdit, iii,1);
1608 ++iii; 1624 ++iii;
1609 1625
1610 lab = new QLabel( i18n("Daylight end:"), topFrame ); 1626 lab = new QLabel( i18n("Daylight end:"), topFrame );
1611 topLayout->addWidget(lab, iii,0); 1627 topLayout->addWidget(lab, iii,0);
1612 mEndDateSavingEdit = new KDateEdit(topFrame); 1628 mEndDateSavingEdit = new KDateEdit(topFrame);
1613 topLayout->addWidget(mEndDateSavingEdit, iii,1); 1629 topLayout->addWidget(mEndDateSavingEdit, iii,1);
1614 ++iii; 1630 ++iii;
1615 QDate current ( 2001, 1,1); 1631 QDate current ( 2001, 1,1);
1616 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1632 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1617 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1633 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1618 1634#endif
1619 1635
1620} 1636}
1621 1637
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b597a6a..1c4a186 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2134 +1,2136 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qapp.h> 11#include <qapp.h>
12#include <qfileinfo.h> 12#include <qfileinfo.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qmap.h> 14#include <qmap.h>
15#include <qwmatrix.h> 15#include <qwmatrix.h>
16#include <qtextbrowser.h> 16#include <qtextbrowser.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#ifndef DESKTOP_VERSION 18#ifndef DESKTOP_VERSION
19#include <qpe/global.h> 19#include <qpe/global.h>
20#include <qpe/qpemenubar.h> 20#include <qpe/qpemenubar.h>
21#include <qpe/qpetoolbar.h> 21#include <qpe/qpetoolbar.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qtopia/alarmserver.h> 24#include <qtopia/alarmserver.h>
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#else 26#else
27#include <qmenubar.h> 27#include <qmenubar.h>
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qapplication.h> 29#include <qapplication.h>
30//#include <resource.h> 30//#include <resource.h>
31 31
32#endif 32#endif
33#include <libkcal/calendarlocal.h> 33#include <libkcal/calendarlocal.h>
34#include <libkcal/todo.h> 34#include <libkcal/todo.h>
35#include <libkdepim/ksyncprofile.h> 35#include <libkdepim/ksyncprofile.h>
36#include <libkcal/kincidenceformatter.h> 36#include <libkcal/kincidenceformatter.h>
37#include <libkdepim/kpimglobalprefs.h>
37 38
38#include "calendarview.h" 39#include "calendarview.h"
39#include "koviewmanager.h" 40#include "koviewmanager.h"
40#include "datenavigator.h" 41#include "datenavigator.h"
41#include "koagendaview.h" 42#include "koagendaview.h"
42#include "koagenda.h" 43#include "koagenda.h"
43#include "kodialogmanager.h" 44#include "kodialogmanager.h"
44#include "kdialogbase.h" 45#include "kdialogbase.h"
45#include "kapplication.h" 46#include "kapplication.h"
46#include "kofilterview.h" 47#include "kofilterview.h"
47#include "kstandarddirs.h" 48#include "kstandarddirs.h"
48#include "koprefs.h" 49#include "koprefs.h"
49#include "kfiledialog.h" 50#include "kfiledialog.h"
50#include "koglobals.h" 51#include "koglobals.h"
51#include "kglobal.h" 52#include "kglobal.h"
52#include "klocale.h" 53#include "klocale.h"
53#include "kconfig.h" 54#include "kconfig.h"
54#include "simplealarmclient.h" 55#include "simplealarmclient.h"
55#include "externalapphandler.h" 56#include "externalapphandler.h"
56 57
57using namespace KCal; 58using namespace KCal;
58#ifndef _WIN32_ 59#ifndef _WIN32_
59#include <unistd.h> 60#include <unistd.h>
60#else 61#else
61#include "koimportoldialog.h" 62#include "koimportoldialog.h"
62#endif 63#endif
63#include "mainwindow.h" 64#include "mainwindow.h"
64 65
65int globalFlagBlockStartup; 66int globalFlagBlockStartup;
66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 67MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
67 QMainWindow( parent, name ) 68 QMainWindow( parent, name )
68{ 69{
69 70
70#ifdef DESKTOP_VERSION 71#ifdef DESKTOP_VERSION
71 setFont( QFont("Arial"), 14 ); 72 setFont( QFont("Arial"), 14 );
72#endif 73#endif
73 74
74 mClosed = false; 75 mClosed = false;
75 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 76 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
76 QString confFile = locateLocal("config","korganizerrc"); 77 QString confFile = locateLocal("config","korganizerrc");
77 QFileInfo finf ( confFile ); 78 QFileInfo finf ( confFile );
78 bool showWarning = !finf.exists(); 79 bool showWarning = !finf.exists();
79 setIcon(SmallIcon( "ko24" ) ); 80 setIcon(SmallIcon( "ko24" ) );
80 mBlockAtStartup = true; 81 mBlockAtStartup = true;
81 mFlagKeyPressed = false; 82 mFlagKeyPressed = false;
82 setCaption("KOrganizer/Pi"); 83 setCaption("KOrganizer/Pi");
83 KOPrefs *p = KOPrefs::instance(); 84 KOPrefs *p = KOPrefs::instance();
85 KPimGlobalPrefs::instance()->setGlobalConfig();
84 // if ( QApplication::desktop()->height() > 480 ) { 86 // if ( QApplication::desktop()->height() > 480 ) {
85// if ( p->mHourSize == 4 ) 87// if ( p->mHourSize == 4 )
86// p->mHourSize = 6; 88// p->mHourSize = 6;
87// } 89// }
88 if ( p->mHourSize > 18 ) 90 if ( p->mHourSize > 18 )
89 p->mHourSize = 18; 91 p->mHourSize = 18;
90 QMainWindow::ToolBarDock tbd; 92 QMainWindow::ToolBarDock tbd;
91 if ( p->mToolBarHor ) { 93 if ( p->mToolBarHor ) {
92 if ( p->mToolBarUp ) 94 if ( p->mToolBarUp )
93 tbd = Bottom; 95 tbd = Bottom;
94 else 96 else
95 tbd = Top; 97 tbd = Top;
96 } 98 }
97 else { 99 else {
98 if ( p->mToolBarUp ) 100 if ( p->mToolBarUp )
99 tbd = Right; 101 tbd = Right;
100 else 102 else
101 tbd = Left; 103 tbd = Left;
102 } 104 }
103 if ( KOPrefs::instance()->mUseAppColors ) 105 if ( KOPrefs::instance()->mUseAppColors )
104 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 106 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
105 globalFlagBlockStartup = 1; 107 globalFlagBlockStartup = 1;
106 iconToolBar = new QPEToolBar( this ); 108 iconToolBar = new QPEToolBar( this );
107 addToolBar (iconToolBar , tbd ); 109 addToolBar (iconToolBar , tbd );
108 mBlockSaveFlag = false; 110 mBlockSaveFlag = false;
109 mCalendarModifiedFlag = false; 111 mCalendarModifiedFlag = false;
110 112
111 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 113 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
112 splash->setAlignment ( AlignCenter ); 114 splash->setAlignment ( AlignCenter );
113 setCentralWidget( splash ); 115 setCentralWidget( splash );
114#ifndef DESKTOP_VERSION 116#ifndef DESKTOP_VERSION
115 showMaximized(); 117 showMaximized();
116#endif 118#endif
117 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 119 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
118 setDefaultPreferences(); 120 setDefaultPreferences();
119 mCalendar = new CalendarLocal(); 121 mCalendar = new CalendarLocal();
120 mView = new CalendarView( mCalendar, this,"mCalendar " ); 122 mView = new CalendarView( mCalendar, this,"mCalendar " );
121 mView->hide(); 123 mView->hide();
122 //mView->resize(splash->size() ); 124 //mView->resize(splash->size() );
123 initActions(); 125 initActions();
124#ifndef DESKTOP_VERSION 126#ifndef DESKTOP_VERSION
125 iconToolBar->show(); 127 iconToolBar->show();
126 qApp->processEvents(); 128 qApp->processEvents();
127#endif 129#endif
128 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 130 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
129 int vh = height() ; 131 int vh = height() ;
130 int vw = width(); 132 int vw = width();
131 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 133 //qDebug("Toolbar hei %d ",iconToolBar->height() );
132 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 134 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
133 vh -= iconToolBar->height(); 135 vh -= iconToolBar->height();
134 } else { 136 } else {
135 vw -= iconToolBar->height(); 137 vw -= iconToolBar->height();
136 } 138 }
137 //mView->setMaximumSize( splash->size() ); 139 //mView->setMaximumSize( splash->size() );
138 //mView->resize( splash->size() ); 140 //mView->resize( splash->size() );
139 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 141 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
140 mView->readSettings(); 142 mView->readSettings();
141 bool oldOpened = false; 143 bool oldOpened = false;
142 bool newFile = false; 144 bool newFile = false;
143 if( !QFile::exists( defaultFileName() ) ) { 145 if( !QFile::exists( defaultFileName() ) ) {
144 QFileInfo finfo ( defaultFileName() ); 146 QFileInfo finfo ( defaultFileName() );
145 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 147 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
146 qDebug("oldfile %s ", oldFile.latin1()); 148 qDebug("oldfile %s ", oldFile.latin1());
147 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 149 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
148 finfo.setFile( oldFile ); 150 finfo.setFile( oldFile );
149 if (finfo.exists() ) { 151 if (finfo.exists() ) {
150 KMessageBox::information( this, message); 152 KMessageBox::information( this, message);
151 mView->openCalendar( oldFile ); 153 mView->openCalendar( oldFile );
152 qApp->processEvents(); 154 qApp->processEvents();
153 } else { 155 } else {
154 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 156 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
155 finfo.setFile( oldFile ); 157 finfo.setFile( oldFile );
156 if (finfo.exists() ) { 158 if (finfo.exists() ) {
157 KMessageBox::information( this, message); 159 KMessageBox::information( this, message);
158 mView->openCalendar( oldFile ); 160 mView->openCalendar( oldFile );
159 qApp->processEvents(); 161 qApp->processEvents();
160 } 162 }
161 } 163 }
162 mView->saveCalendar( defaultFileName() ); 164 mView->saveCalendar( defaultFileName() );
163 newFile = true; 165 newFile = true;
164 } 166 }
165 167
166 QTime neededSaveTime = QDateTime::currentDateTime().time(); 168 QTime neededSaveTime = QDateTime::currentDateTime().time();
167 if ( ! oldOpened ) 169 if ( ! oldOpened )
168 mView->openCalendar( defaultFileName() ); 170 mView->openCalendar( defaultFileName() );
169 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 171 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
170 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 172 qDebug("KO: Calendar loading time: %d ms",msNeeded );
171 173
172 if ( KOPrefs::instance()->mLanguageChanged ) { 174 if ( KOPrefs::instance()->mLanguageChanged ) {
173 KOPrefs::instance()->setCategoryDefaults(); 175 KOPrefs::instance()->setCategoryDefaults();
174 int count = mView->addCategories(); 176 int count = mView->addCategories();
175 KOPrefs::instance()->mLanguageChanged = false; 177 KOPrefs::instance()->mLanguageChanged = false;
176 } 178 }
177 processIncidenceSelection( 0 ); 179 processIncidenceSelection( 0 );
178 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 180 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
179 SLOT( processIncidenceSelection( Incidence * ) ) ); 181 SLOT( processIncidenceSelection( Incidence * ) ) );
180 connect( mView, SIGNAL( modifiedChanged( bool ) ), 182 connect( mView, SIGNAL( modifiedChanged( bool ) ),
181 SLOT( slotModifiedChanged( bool ) ) ); 183 SLOT( slotModifiedChanged( bool ) ) );
182 184
183 185
184 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 186 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
185 mView->setModified( false ); 187 mView->setModified( false );
186 mBlockAtStartup = false; 188 mBlockAtStartup = false;
187 mView->setModified( false ); 189 mView->setModified( false );
188 setCentralWidget( mView ); 190 setCentralWidget( mView );
189 globalFlagBlockStartup = 0; 191 globalFlagBlockStartup = 0;
190 mView->show(); 192 mView->show();
191 delete splash; 193 delete splash;
192 if ( newFile ) 194 if ( newFile )
193 mView->updateConfig(); 195 mView->updateConfig();
194 // qApp->processEvents(); 196 // qApp->processEvents();
195 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
196 fillSyncMenu(); 198 fillSyncMenu();
197 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 199 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
198 if ( showWarning ) { 200 if ( showWarning ) {
199 KMessageBox::information( this, 201 KMessageBox::information( this,
200 "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"); 202 "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");
201 qApp->processEvents(); 203 qApp->processEvents();
202 mView->dialogManager()->showSyncOptions(); 204 mView->dialogManager()->showSyncOptions();
203 } 205 }
204 206
205 //US listen for result adressed from Ka/Pi 207 //US listen for result adressed from Ka/Pi
206#ifndef DESKTOP_VERSION 208#ifndef DESKTOP_VERSION
207 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 209 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
208#endif 210#endif
209} 211}
210MainWindow::~MainWindow() 212MainWindow::~MainWindow()
211{ 213{
212 //qDebug("MainWindow::~MainWindow() "); 214 //qDebug("MainWindow::~MainWindow() ");
213 //save toolbar location 215 //save toolbar location
214 216
215 delete mCalendar; 217 delete mCalendar;
216 delete KOPrefs::instance(); 218 delete KOPrefs::instance();
217 delete KIncidenceFormatter::instance(); 219 delete KIncidenceFormatter::instance();
218 220
219 221
220} 222}
221void MainWindow::showMaximized () 223void MainWindow::showMaximized ()
222{ 224{
223#ifndef DESKTOP_VERSION 225#ifndef DESKTOP_VERSION
224 if ( ! globalFlagBlockStartup ) 226 if ( ! globalFlagBlockStartup )
225 if ( mClosed ) 227 if ( mClosed )
226 mView->goToday(); 228 mView->goToday();
227#endif 229#endif
228 QWidget::showMaximized () ; 230 QWidget::showMaximized () ;
229 mClosed = false; 231 mClosed = false;
230} 232}
231void MainWindow::closeEvent( QCloseEvent* ce ) 233void MainWindow::closeEvent( QCloseEvent* ce )
232{ 234{
233 235
234 236
235 237
236 if ( ! KOPrefs::instance()->mAskForQuit ) { 238 if ( ! KOPrefs::instance()->mAskForQuit ) {
237 saveOnClose(); 239 saveOnClose();
238 mClosed = true; 240 mClosed = true;
239 ce->accept(); 241 ce->accept();
240 return; 242 return;
241 243
242 } 244 }
243 245
244 switch( QMessageBox::information( this, "KO/Pi", 246 switch( QMessageBox::information( this, "KO/Pi",
245 i18n("Do you really want\nto close KO/Pi?"), 247 i18n("Do you really want\nto close KO/Pi?"),
246 i18n("Close"), i18n("No"), 248 i18n("Close"), i18n("No"),
247 0, 0 ) ) { 249 0, 0 ) ) {
248 case 0: 250 case 0:
249 saveOnClose(); 251 saveOnClose();
250 mClosed = true; 252 mClosed = true;
251 ce->accept(); 253 ce->accept();
252 break; 254 break;
253 case 1: 255 case 1:
254 ce->ignore(); 256 ce->ignore();
255 break; 257 break;
256 case 2: 258 case 2:
257 259
258 default: 260 default:
259 break; 261 break;
260 } 262 }
261 263
262 264
263} 265}
264 266
265void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 267void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
266{ 268{
267 QDataStream stream( data, IO_ReadOnly ); 269 QDataStream stream( data, IO_ReadOnly );
268 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 270 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
269 //QString datamess; 271 //QString datamess;
270 //qDebug("message "); 272 //qDebug("message ");
271 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 273 qDebug("KO: QCOP message received: %s ", cmsg.data() );
272 274
273 if ( cmsg == "-writeFile" ) { 275 if ( cmsg == "-writeFile" ) {
274 // I made from the "-writeFile" an "-writeAlarm" 276 // I made from the "-writeFile" an "-writeAlarm"
275 mView->viewManager()->showWhatsNextView(); 277 mView->viewManager()->showWhatsNextView();
276 mCalendar->checkAlarmForIncidence( 0, true); 278 mCalendar->checkAlarmForIncidence( 0, true);
277 showMaximized(); 279 showMaximized();
278 raise(); 280 raise();
279 return; 281 return;
280 } 282 }
281 283
282 if ( cmsg == "-writeFile" ) { 284 if ( cmsg == "-writeFile" ) {
283 // I made from the "-writeFile" an "-writeAlarm" 285 // I made from the "-writeFile" an "-writeAlarm"
284 mView->viewManager()->showWhatsNextView(); 286 mView->viewManager()->showWhatsNextView();
285 mCalendar->checkAlarmForIncidence( 0, true); 287 mCalendar->checkAlarmForIncidence( 0, true);
286 showMaximized(); 288 showMaximized();
287 raise(); 289 raise();
288 return; 290 return;
289 291
290 } 292 }
291 if ( cmsg == "-writeFileSilent" ) { 293 if ( cmsg == "-writeFileSilent" ) {
292 // I made from the "-writeFile" an "-writeAlarm" 294 // I made from the "-writeFile" an "-writeAlarm"
293 // mView->viewManager()->showWhatsNextView(); 295 // mView->viewManager()->showWhatsNextView();
294 mCalendar->checkAlarmForIncidence( 0, true); 296 mCalendar->checkAlarmForIncidence( 0, true);
295 //showMaximized(); 297 //showMaximized();
296 //raise(); 298 //raise();
297 hide(); 299 hide();
298 return; 300 return;
299 } 301 }
300 if ( cmsg == "-newCountdown" ) { 302 if ( cmsg == "-newCountdown" ) {
301 qDebug("newCountdown "); 303 qDebug("newCountdown ");
302 304
303 } 305 }
304 QString msg ; 306 QString msg ;
305 QString allmsg = cmsg; 307 QString allmsg = cmsg;
306 while ( allmsg.length() > 0 ) { 308 while ( allmsg.length() > 0 ) {
307 int nextC = allmsg.find( "-", 1 ); 309 int nextC = allmsg.find( "-", 1 );
308 if ( nextC == -1 ) { 310 if ( nextC == -1 ) {
309 msg = allmsg; 311 msg = allmsg;
310 allmsg = ""; 312 allmsg = "";
311 } else{ 313 } else{
312 msg = allmsg.left( nextC ); 314 msg = allmsg.left( nextC );
313 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 315 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
314 } 316 }
315 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 317 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
316 if ( msg == "-newEvent" ) { 318 if ( msg == "-newEvent" ) {
317 mView->newEvent(); 319 mView->newEvent();
318 } 320 }
319 if ( msg == "-newTodo" ) { 321 if ( msg == "-newTodo" ) {
320 mView->newTodo(); 322 mView->newTodo();
321 323
322 } 324 }
323 if ( msg == "-showWN" ) { 325 if ( msg == "-showWN" ) {
324 mView->viewManager()->showWhatsNextView(); 326 mView->viewManager()->showWhatsNextView();
325 } 327 }
326 if ( msg == "-showTodo" ) { 328 if ( msg == "-showTodo" ) {
327 mView->viewManager()->showTodoView(); 329 mView->viewManager()->showTodoView();
328 } 330 }
329 if ( msg == "-showList" ) { 331 if ( msg == "-showList" ) {
330 mView->viewManager()->showListView(); 332 mView->viewManager()->showListView();
331 } 333 }
332 else if ( msg == "-showDay" ) { 334 else if ( msg == "-showDay" ) {
333 mView->viewManager()->showDayView(); 335 mView->viewManager()->showDayView();
334 } 336 }
335 else if ( msg == "-showWWeek" ) { 337 else if ( msg == "-showWWeek" ) {
336 mView->viewManager()->showWorkWeekView(); 338 mView->viewManager()->showWorkWeekView();
337 } 339 }
338 else if ( msg == "-ringSync" ) { 340 else if ( msg == "-ringSync" ) {
339 multiSync( false ); 341 multiSync( false );
340 } 342 }
341 else if ( msg == "-showWeek" ) { 343 else if ( msg == "-showWeek" ) {
342 mView->viewManager()->showWeekView(); 344 mView->viewManager()->showWeekView();
343 } 345 }
344 else if ( msg == "-showTodo" ) { 346 else if ( msg == "-showTodo" ) {
345 mView->viewManager()->showTodoView(); 347 mView->viewManager()->showTodoView();
346 } 348 }
347 else if ( msg == "-showJournal" ) { 349 else if ( msg == "-showJournal" ) {
348 mView->dateNavigator()->selectDates( 1 ); 350 mView->dateNavigator()->selectDates( 1 );
349 mView->dateNavigator()->selectToday(); 351 mView->dateNavigator()->selectToday();
350 mView->viewManager()->showJournalView(); 352 mView->viewManager()->showJournalView();
351 } 353 }
352 else if ( msg == "-showKO" ) { 354 else if ( msg == "-showKO" ) {
353 mView->viewManager()->showNextXView(); 355 mView->viewManager()->showNextXView();
354 } 356 }
355 else if ( msg == "-showWNext" || msg == "nextView()" ) { 357 else if ( msg == "-showWNext" || msg == "nextView()" ) {
356 mView->viewManager()->showWhatsNextView(); 358 mView->viewManager()->showWhatsNextView();
357 } 359 }
358 else if ( msg == "-showNextXView" ) { 360 else if ( msg == "-showNextXView" ) {
359 mView->viewManager()->showNextXView(); 361 mView->viewManager()->showNextXView();
360 } 362 }
361 363
362 364
363 } 365 }
364 366
365 showMaximized(); 367 showMaximized();
366 raise(); 368 raise();
367} 369}
368 370
369QPixmap MainWindow::loadPixmap( QString name ) 371QPixmap MainWindow::loadPixmap( QString name )
370{ 372{
371 return SmallIcon( name ); 373 return SmallIcon( name );
372 374
373} 375}
374void MainWindow::initActions() 376void MainWindow::initActions()
375{ 377{
376 //KOPrefs::instance()->mShowFullMenu 378 //KOPrefs::instance()->mShowFullMenu
377 iconToolBar->clear(); 379 iconToolBar->clear();
378 KOPrefs *p = KOPrefs::instance(); 380 KOPrefs *p = KOPrefs::instance();
379 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 381 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
380 382
381 QPopupMenu *viewMenu = new QPopupMenu( this ); 383 QPopupMenu *viewMenu = new QPopupMenu( this );
382 QPopupMenu *actionMenu = new QPopupMenu( this ); 384 QPopupMenu *actionMenu = new QPopupMenu( this );
383 QPopupMenu *importMenu = new QPopupMenu( this ); 385 QPopupMenu *importMenu = new QPopupMenu( this );
384 selectFilterMenu = new QPopupMenu( this ); 386 selectFilterMenu = new QPopupMenu( this );
385 selectFilterMenu->setCheckable( true ); 387 selectFilterMenu->setCheckable( true );
386 syncMenu = new QPopupMenu( this ); 388 syncMenu = new QPopupMenu( this );
387 configureAgendaMenu = new QPopupMenu( this ); 389 configureAgendaMenu = new QPopupMenu( this );
388 configureToolBarMenu = new QPopupMenu( this ); 390 configureToolBarMenu = new QPopupMenu( this );
389 QPopupMenu *helpMenu = new QPopupMenu( this ); 391 QPopupMenu *helpMenu = new QPopupMenu( this );
390 if ( KOPrefs::instance()->mShowFullMenu ) { 392 if ( KOPrefs::instance()->mShowFullMenu ) {
391 QMenuBar *menuBar1; 393 QMenuBar *menuBar1;
392 menuBar1 = menuBar(); 394 menuBar1 = menuBar();
393 menuBar1->insertItem( i18n("File"), importMenu ); 395 menuBar1->insertItem( i18n("File"), importMenu );
394 menuBar1->insertItem( i18n("View"), viewMenu ); 396 menuBar1->insertItem( i18n("View"), viewMenu );
395 menuBar1->insertItem( i18n("Actions"), actionMenu ); 397 menuBar1->insertItem( i18n("Actions"), actionMenu );
396 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 398 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
397 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 399 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
398 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 400 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
399 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 401 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
400 menuBar1->insertItem( i18n("Help"), helpMenu ); 402 menuBar1->insertItem( i18n("Help"), helpMenu );
401 } else { 403 } else {
402 QPEMenuBar *menuBar1; 404 QPEMenuBar *menuBar1;
403 menuBar1 = new QPEMenuBar( iconToolBar ); 405 menuBar1 = new QPEMenuBar( iconToolBar );
404 QPopupMenu *menuBar = new QPopupMenu( this ); 406 QPopupMenu *menuBar = new QPopupMenu( this );
405 menuBar1->insertItem( i18n("ME"), menuBar); 407 menuBar1->insertItem( i18n("ME"), menuBar);
406 menuBar->insertItem( i18n("File"), importMenu ); 408 menuBar->insertItem( i18n("File"), importMenu );
407 menuBar->insertItem( i18n("View"), viewMenu ); 409 menuBar->insertItem( i18n("View"), viewMenu );
408 menuBar->insertItem( i18n("Actions"), actionMenu ); 410 menuBar->insertItem( i18n("Actions"), actionMenu );
409 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 411 menuBar->insertItem( i18n("Synchronize"), syncMenu );
410 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 412 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
411 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 413 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
412 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 414 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
413 menuBar->insertItem( i18n("Help"), helpMenu ); 415 menuBar->insertItem( i18n("Help"), helpMenu );
414 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 416 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
415 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 417 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
416 } 418 }
417 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 419 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
418 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 420 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
419 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 421 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
420 422
421 // ****************** 423 // ******************
422 QAction *action; 424 QAction *action;
423 QIconSet icon; 425 QIconSet icon;
424 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 426 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
425 configureToolBarMenu->setCheckable( true ); 427 configureToolBarMenu->setCheckable( true );
426 428
427 QString pathString = ""; 429 QString pathString = "";
428 if ( !p->mToolBarMiniIcons ) { 430 if ( !p->mToolBarMiniIcons ) {
429 if ( QApplication::desktop()->width() < 480 ) 431 if ( QApplication::desktop()->width() < 480 )
430 pathString += "icons16/"; 432 pathString += "icons16/";
431 } else 433 } else
432 pathString += "iconsmini/"; 434 pathString += "iconsmini/";
433 configureAgendaMenu->setCheckable( true ); 435 configureAgendaMenu->setCheckable( true );
434 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 436 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
435 configureAgendaMenu->insertSeparator(); 437 configureAgendaMenu->insertSeparator();
436 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 438 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
437 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 439 configureAgendaMenu->insertItem(i18n("Small"), 6 );
438 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 440 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
439 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 441 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
440 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 442 configureAgendaMenu->insertItem(i18n("Large"), 12 );
441 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 443 configureAgendaMenu->insertItem(i18n("Big"), 14 );
442 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 444 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
443 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 445 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
444 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 446 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
445 447
446 icon = loadPixmap( pathString + "configure" ); 448 icon = loadPixmap( pathString + "configure" );
447 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 449 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
448 action->addTo( actionMenu ); 450 action->addTo( actionMenu );
449 connect( action, SIGNAL( activated() ), 451 connect( action, SIGNAL( activated() ),
450 mView, SLOT( edit_options() ) ); 452 mView, SLOT( edit_options() ) );
451 actionMenu->insertSeparator(); 453 actionMenu->insertSeparator();
452 icon = loadPixmap( pathString + "newevent" ); 454 icon = loadPixmap( pathString + "newevent" );
453 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 455 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
454 configureToolBarMenu->insertSeparator(); 456 configureToolBarMenu->insertSeparator();
455 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 457 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
456 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 458 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
457 ne_action->addTo( actionMenu ); 459 ne_action->addTo( actionMenu );
458 connect( ne_action, SIGNAL( activated() ), 460 connect( ne_action, SIGNAL( activated() ),
459 mView, SLOT( newEvent() ) ); 461 mView, SLOT( newEvent() ) );
460 icon = loadPixmap( pathString + "newtodo" ); 462 icon = loadPixmap( pathString + "newtodo" );
461 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 463 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
462 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 464 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
463 nt_action->addTo( actionMenu ); 465 nt_action->addTo( actionMenu );
464 connect( nt_action, SIGNAL( activated() ), 466 connect( nt_action, SIGNAL( activated() ),
465 mView, SLOT( newTodo() ) ); 467 mView, SLOT( newTodo() ) );
466 icon = loadPixmap( pathString + "navi" ); 468 icon = loadPixmap( pathString + "navi" );
467 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 469 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
468 action->addTo( viewMenu ); 470 action->addTo( viewMenu );
469 connect( action, SIGNAL( activated() ), 471 connect( action, SIGNAL( activated() ),
470 mView, SLOT( toggleDateNavigatorWidget() ) ); 472 mView, SLOT( toggleDateNavigatorWidget() ) );
471 icon = loadPixmap( pathString + "filter" ); 473 icon = loadPixmap( pathString + "filter" );
472 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 474 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
473 action->addTo( viewMenu ); 475 action->addTo( viewMenu );
474 connect( action, SIGNAL( activated() ), 476 connect( action, SIGNAL( activated() ),
475 mView, SLOT( toggleFilter() ) ); 477 mView, SLOT( toggleFilter() ) );
476 478
477 479
478 viewMenu->insertSeparator(); 480 viewMenu->insertSeparator();
479 icon = loadPixmap( pathString + "picker" ); 481 icon = loadPixmap( pathString + "picker" );
480 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 482 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
481 action->addTo( viewMenu ); 483 action->addTo( viewMenu );
482 connect( action, SIGNAL( activated() ), 484 connect( action, SIGNAL( activated() ),
483 mView, SLOT( showDatePicker() ) ); 485 mView, SLOT( showDatePicker() ) );
484 action->addTo( iconToolBar ); 486 action->addTo( iconToolBar );
485 viewMenu->insertSeparator(); 487 viewMenu->insertSeparator();
486 icon = loadPixmap( pathString + "list" ); 488 icon = loadPixmap( pathString + "list" );
487 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 489 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
488 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 490 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
489 showlist_action->addTo( viewMenu ); 491 showlist_action->addTo( viewMenu );
490 connect( showlist_action, SIGNAL( activated() ), 492 connect( showlist_action, SIGNAL( activated() ),
491 mView->viewManager(), SLOT( showListView() ) ); 493 mView->viewManager(), SLOT( showListView() ) );
492 494
493 495
494 icon = loadPixmap( pathString + "day" ); 496 icon = loadPixmap( pathString + "day" );
495 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 497 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
496 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 498 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
497 day1_action->addTo( viewMenu ); 499 day1_action->addTo( viewMenu );
498 // action->addTo( toolBar ); 500 // action->addTo( toolBar );
499 connect( day1_action, SIGNAL( activated() ), 501 connect( day1_action, SIGNAL( activated() ),
500 mView->viewManager(), SLOT( showDayView() ) ); 502 mView->viewManager(), SLOT( showDayView() ) );
501 503
502 icon = loadPixmap( pathString + "workweek" ); 504 icon = loadPixmap( pathString + "workweek" );
503 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 505 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
504 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 506 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
505 day5_action->addTo( viewMenu ); 507 day5_action->addTo( viewMenu );
506 connect( day5_action, SIGNAL( activated() ), 508 connect( day5_action, SIGNAL( activated() ),
507 mView->viewManager(), SLOT( showWorkWeekView() ) ); 509 mView->viewManager(), SLOT( showWorkWeekView() ) );
508 510
509 icon = loadPixmap( pathString + "week" ); 511 icon = loadPixmap( pathString + "week" );
510 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 512 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
511 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 513 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
512 day7_action->addTo( viewMenu ); 514 day7_action->addTo( viewMenu );
513 connect( day7_action, SIGNAL( activated() ), 515 connect( day7_action, SIGNAL( activated() ),
514 mView->viewManager(), SLOT( showWeekView() ) ); 516 mView->viewManager(), SLOT( showWeekView() ) );
515 517
516 icon = loadPixmap( pathString + "month" ); 518 icon = loadPixmap( pathString + "month" );
517 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 519 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
518 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 520 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
519 month_action->addTo( viewMenu ); 521 month_action->addTo( viewMenu );
520 connect( month_action, SIGNAL( activated() ), 522 connect( month_action, SIGNAL( activated() ),
521 mView->viewManager(), SLOT( showMonthView() ) ); 523 mView->viewManager(), SLOT( showMonthView() ) );
522 524
523 icon = loadPixmap( pathString + "todo" ); 525 icon = loadPixmap( pathString + "todo" );
524 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 526 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
525 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 527 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
526 todoview_action->addTo( viewMenu ); 528 todoview_action->addTo( viewMenu );
527 connect( todoview_action, SIGNAL( activated() ), 529 connect( todoview_action, SIGNAL( activated() ),
528 mView->viewManager(), SLOT( showTodoView() ) ); 530 mView->viewManager(), SLOT( showTodoView() ) );
529 531
530 icon = loadPixmap( pathString + "journal" ); 532 icon = loadPixmap( pathString + "journal" );
531 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 533 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
532 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 534 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
533 viewjournal_action->addTo( viewMenu ); 535 viewjournal_action->addTo( viewMenu );
534 connect( viewjournal_action, SIGNAL( activated() ), 536 connect( viewjournal_action, SIGNAL( activated() ),
535 mView->viewManager(), SLOT( showJournalView() ) ); 537 mView->viewManager(), SLOT( showJournalView() ) );
536 538
537 icon = loadPixmap( pathString + "xdays" ); 539 icon = loadPixmap( pathString + "xdays" );
538 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 540 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
539 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 541 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
540 xdays_action->addTo( viewMenu ); 542 xdays_action->addTo( viewMenu );
541 connect( xdays_action, SIGNAL( activated() ), 543 connect( xdays_action, SIGNAL( activated() ),
542 mView->viewManager(), SLOT( showNextXView() ) ); 544 mView->viewManager(), SLOT( showNextXView() ) );
543 545
544 icon = loadPixmap( pathString + "whatsnext" ); 546 icon = loadPixmap( pathString + "whatsnext" );
545 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 547 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
546 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 548 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
547 whatsnext_action->addTo( viewMenu ); 549 whatsnext_action->addTo( viewMenu );
548 connect( whatsnext_action, SIGNAL( activated() ), 550 connect( whatsnext_action, SIGNAL( activated() ),
549 mView->viewManager(), SLOT( showWhatsNextView() ) ); 551 mView->viewManager(), SLOT( showWhatsNextView() ) );
550 552
551#if 0 553#if 0
552 action = new QAction( "view_timespan", "Time Span", 0, this ); 554 action = new QAction( "view_timespan", "Time Span", 0, this );
553 action->addTo( viewMenu ); 555 action->addTo( viewMenu );
554 connect( action, SIGNAL( activated() ), 556 connect( action, SIGNAL( activated() ),
555 mView->viewManager(), SLOT( showTimeSpanView() ) ); 557 mView->viewManager(), SLOT( showTimeSpanView() ) );
556#endif 558#endif
557 559
558 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 560 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
559 this ); 561 this );
560 mNewSubTodoAction->addTo( actionMenu ); 562 mNewSubTodoAction->addTo( actionMenu );
561 connect( mNewSubTodoAction, SIGNAL( activated() ), 563 connect( mNewSubTodoAction, SIGNAL( activated() ),
562 mView, SLOT( newSubTodo() ) ); 564 mView, SLOT( newSubTodo() ) );
563 565
564 actionMenu->insertSeparator(); 566 actionMenu->insertSeparator();
565 567
566 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 568 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
567 mShowAction->addTo( actionMenu ); 569 mShowAction->addTo( actionMenu );
568 connect( mShowAction, SIGNAL( activated() ), 570 connect( mShowAction, SIGNAL( activated() ),
569 mView, SLOT( showIncidence() ) ); 571 mView, SLOT( showIncidence() ) );
570 572
571 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 573 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
572 mEditAction->addTo( actionMenu ); 574 mEditAction->addTo( actionMenu );
573 connect( mEditAction, SIGNAL( activated() ), 575 connect( mEditAction, SIGNAL( activated() ),
574 mView, SLOT( editIncidence() ) ); 576 mView, SLOT( editIncidence() ) );
575 577
576 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 578 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
577 mDeleteAction->addTo( actionMenu ); 579 mDeleteAction->addTo( actionMenu );
578 connect( mDeleteAction, SIGNAL( activated() ), 580 connect( mDeleteAction, SIGNAL( activated() ),
579 mView, SLOT( deleteIncidence() ) ); 581 mView, SLOT( deleteIncidence() ) );
580 582
581 actionMenu->insertSeparator(); 583 actionMenu->insertSeparator();
582 584
583 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 585 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
584 this ); 586 this );
585 action->addTo( actionMenu ); 587 action->addTo( actionMenu );
586 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 588 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
587 589
588 icon = loadPixmap( pathString + "search" ); 590 icon = loadPixmap( pathString + "search" );
589 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 591 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
590 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 592 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
591 search_action->addTo( actionMenu ); 593 search_action->addTo( actionMenu );
592 connect( search_action, SIGNAL( activated() ), 594 connect( search_action, SIGNAL( activated() ),
593 mView->dialogManager(), SLOT( showSearchDialog() ) ); 595 mView->dialogManager(), SLOT( showSearchDialog() ) );
594 596
595 icon = loadPixmap( pathString + "today" ); 597 icon = loadPixmap( pathString + "today" );
596 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 598 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
597 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 599 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
598 today_action->addTo( actionMenu ); 600 today_action->addTo( actionMenu );
599 connect( today_action, SIGNAL( activated() ), 601 connect( today_action, SIGNAL( activated() ),
600 mView, SLOT( goToday() ) ); 602 mView, SLOT( goToday() ) );
601 603
602 if ( KOPrefs::instance()->mShowFullMenu ) { 604 if ( KOPrefs::instance()->mShowFullMenu ) {
603 actionMenu->insertSeparator(); 605 actionMenu->insertSeparator();
604 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 606 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
605 607
606 } 608 }
607 // actionMenu->insertSeparator(); 609 // actionMenu->insertSeparator();
608 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 610 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
609 this ); 611 this );
610 action->addTo( importMenu ); 612 action->addTo( importMenu );
611 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 613 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
612 action = new QAction( "import_quick", i18n("Import last file"), 0, 614 action = new QAction( "import_quick", i18n("Import last file"), 0,
613 this ); 615 this );
614 action->addTo( importMenu ); 616 action->addTo( importMenu );
615 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 617 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
616 importMenu->insertSeparator(); 618 importMenu->insertSeparator();
617 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 619 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
618 this ); 620 this );
619 action->addTo( importMenu ); 621 action->addTo( importMenu );
620 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 622 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
621#ifndef DESKTOP_VERSION 623#ifndef DESKTOP_VERSION
622 importMenu->insertSeparator(); 624 importMenu->insertSeparator();
623 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 625 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
624 this ); 626 this );
625 action->addTo( importMenu ); 627 action->addTo( importMenu );
626 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 628 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
627#else 629#else
628#ifdef _WIN32_ 630#ifdef _WIN32_
629 importMenu->insertSeparator(); 631 importMenu->insertSeparator();
630 action = new QAction( "import_ol", i18n("Import from OL"), 0, 632 action = new QAction( "import_ol", i18n("Import from OL"), 0,
631 this ); 633 this );
632 action->addTo( importMenu ); 634 action->addTo( importMenu );
633 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 635 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
634#endif 636#endif
635#endif 637#endif
636 638
637 importMenu->insertSeparator(); 639 importMenu->insertSeparator();
638 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 640 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
639 this ); 641 this );
640 action->addTo( importMenu ); 642 action->addTo( importMenu );
641 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 643 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
642 644
643 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 645 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
644 this ); 646 this );
645 action->addTo( importMenu ); 647 action->addTo( importMenu );
646 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 648 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
647 649
648 importMenu->insertSeparator(); 650 importMenu->insertSeparator();
649 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 651 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
650 this ); 652 this );
651 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 653 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
652 importMenu->insertSeparator(); 654 importMenu->insertSeparator();
653 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 655 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
654 this ); 656 this );
655 action->addTo( importMenu ); 657 action->addTo( importMenu );
656 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 658 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
657#ifndef DESKTOP_VERSION 659#ifndef DESKTOP_VERSION
658 importMenu->insertSeparator(); 660 importMenu->insertSeparator();
659 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 661 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
660 this ); 662 this );
661 action->addTo( importMenu ); 663 action->addTo( importMenu );
662 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 664 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
663 665
664 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 666 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
665 this ); 667 this );
666 action->addTo( importMenu ); 668 action->addTo( importMenu );
667 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 669 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
668#else 670#else
669 importMenu->insertSeparator(); 671 importMenu->insertSeparator();
670 icon = loadPixmap( pathString + "print" ); 672 icon = loadPixmap( pathString + "print" );
671 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 673 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
672 action->addTo( importMenu ); 674 action->addTo( importMenu );
673 connect( action, SIGNAL( activated() ), 675 connect( action, SIGNAL( activated() ),
674 this, SLOT( printCal() ) ); 676 this, SLOT( printCal() ) );
675 677
676 icon = loadPixmap( pathString + "print" ); 678 icon = loadPixmap( pathString + "print" );
677 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 679 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
678 action->addTo( importMenu ); 680 action->addTo( importMenu );
679 connect( action, SIGNAL( activated() ), 681 connect( action, SIGNAL( activated() ),
680 this, SLOT( printSel() ) ); 682 this, SLOT( printSel() ) );
681#endif 683#endif
682 importMenu->insertSeparator(); 684 importMenu->insertSeparator();
683 action = new QAction( "beam all", i18n("Save"), 0, 685 action = new QAction( "beam all", i18n("Save"), 0,
684 this ); 686 this );
685 action->addTo( importMenu ); 687 action->addTo( importMenu );
686 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 688 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
687 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 689 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
688 this ); 690 this );
689 action->addTo( importMenu ); 691 action->addTo( importMenu );
690 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 692 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
691 693
692 //menuBar->insertItem( "Configure",configureMenu ); 694 //menuBar->insertItem( "Configure",configureMenu );
693 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 695 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
694 icon = loadPixmap( "korganizer/korganizer" ); 696 icon = loadPixmap( "korganizer/korganizer" );
695 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 697 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
696 action->addTo( helpMenu ); 698 action->addTo( helpMenu );
697 connect( action, SIGNAL( activated() ), 699 connect( action, SIGNAL( activated() ),
698 SLOT( keyBindings() ) ); 700 SLOT( keyBindings() ) );
699 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 701 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
700 action->addTo( helpMenu ); 702 action->addTo( helpMenu );
701 connect( action, SIGNAL( activated() ), 703 connect( action, SIGNAL( activated() ),
702 SLOT( features() ) ); 704 SLOT( features() ) );
703 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 705 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
704 action->addTo( helpMenu ); 706 action->addTo( helpMenu );
705 connect( action, SIGNAL( activated() ), 707 connect( action, SIGNAL( activated() ),
706 SLOT( aboutAutoSaving() ) ); 708 SLOT( aboutAutoSaving() ) );
707 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 709 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
708 action->addTo( helpMenu ); 710 action->addTo( helpMenu );
709 connect( action, SIGNAL( activated() ), 711 connect( action, SIGNAL( activated() ),
710 SLOT( aboutKnownBugs() ) ); 712 SLOT( aboutKnownBugs() ) );
711 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 713 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
712 action->addTo( helpMenu ); 714 action->addTo( helpMenu );
713 connect( action, SIGNAL( activated() ), 715 connect( action, SIGNAL( activated() ),
714 SLOT( usertrans() ) ); 716 SLOT( usertrans() ) );
715 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 717 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
716 action->addTo( helpMenu ); 718 action->addTo( helpMenu );
717 connect( action, SIGNAL( activated() ), 719 connect( action, SIGNAL( activated() ),
718 SLOT( synchowto() ) ); 720 SLOT( synchowto() ) );
719 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 721 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
720 action->addTo( helpMenu ); 722 action->addTo( helpMenu );
721 connect( action, SIGNAL( activated() ), 723 connect( action, SIGNAL( activated() ),
722 SLOT( whatsNew() ) ); 724 SLOT( whatsNew() ) );
723 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 725 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
724 action->addTo( helpMenu ); 726 action->addTo( helpMenu );
725 connect( action, SIGNAL( activated() ), 727 connect( action, SIGNAL( activated() ),
726 SLOT( faq() ) ); 728 SLOT( faq() ) );
727 729
728 730
729 action = new QAction( "about", i18n("About..."), 0, this ); 731 action = new QAction( "about", i18n("About..."), 0, this );
730 action->addTo( helpMenu ); 732 action->addTo( helpMenu );
731 connect( action, SIGNAL( activated() ), 733 connect( action, SIGNAL( activated() ),
732 SLOT( about() ) ); 734 SLOT( about() ) );
733 action = new QAction( "licence", i18n("Licence..."), 0, this ); 735 action = new QAction( "licence", i18n("Licence..."), 0, this );
734 action->addTo( helpMenu ); 736 action->addTo( helpMenu );
735 connect( action, SIGNAL( activated() ), 737 connect( action, SIGNAL( activated() ),
736 SLOT( licence() ) ); 738 SLOT( licence() ) );
737 //menuBar->insertSeparator(); 739 //menuBar->insertSeparator();
738 740
739 // ****************************************************** 741 // ******************************************************
740 // menubar icons 742 // menubar icons
741 743
742 744
743 iconToolBar->setHorizontalStretchable (true ); 745 iconToolBar->setHorizontalStretchable (true );
744 //menuBar->insertItem( iconToolBar ); 746 //menuBar->insertItem( iconToolBar );
745 //xdays_action 747 //xdays_action
746 if (p-> mShowIconNewEvent) 748 if (p-> mShowIconNewEvent)
747 ne_action->addTo( iconToolBar ); 749 ne_action->addTo( iconToolBar );
748 if (p->mShowIconNewTodo ) 750 if (p->mShowIconNewTodo )
749 nt_action->addTo( iconToolBar ); 751 nt_action->addTo( iconToolBar );
750 if (p-> mShowIconSearch) 752 if (p-> mShowIconSearch)
751 search_action->addTo( iconToolBar ); 753 search_action->addTo( iconToolBar );
752 if (p-> mShowIconNext) 754 if (p-> mShowIconNext)
753 whatsnext_action->addTo( iconToolBar ); 755 whatsnext_action->addTo( iconToolBar );
754 if (p-> mShowIconNextDays) 756 if (p-> mShowIconNextDays)
755 xdays_action->addTo( iconToolBar ); 757 xdays_action->addTo( iconToolBar );
756 if (p-> mShowIconList) 758 if (p-> mShowIconList)
757 showlist_action->addTo( iconToolBar ); 759 showlist_action->addTo( iconToolBar );
758 if (p-> mShowIconDay1) 760 if (p-> mShowIconDay1)
759 day1_action->addTo( iconToolBar ); 761 day1_action->addTo( iconToolBar );
760 if (p-> mShowIconDay5) 762 if (p-> mShowIconDay5)
761 day5_action->addTo( iconToolBar ); 763 day5_action->addTo( iconToolBar );
762 if (p-> mShowIconDay7) 764 if (p-> mShowIconDay7)
763 day7_action->addTo( iconToolBar ); 765 day7_action->addTo( iconToolBar );
764 if (p-> mShowIconMonth) 766 if (p-> mShowIconMonth)
765 month_action->addTo( iconToolBar ); 767 month_action->addTo( iconToolBar );
766 if (p-> mShowIconTodoview) 768 if (p-> mShowIconTodoview)
767 todoview_action->addTo( iconToolBar ); 769 todoview_action->addTo( iconToolBar );
768 if (p-> mShowIconJournal) 770 if (p-> mShowIconJournal)
769 viewjournal_action->addTo( iconToolBar ); 771 viewjournal_action->addTo( iconToolBar );
770 icon = loadPixmap( pathString + "2leftarrowB" ); 772 icon = loadPixmap( pathString + "2leftarrowB" );
771 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 773 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
772 if (p-> mShowIconBackFast) { 774 if (p-> mShowIconBackFast) {
773 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 775 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
774 connect( action, SIGNAL( activated() ), 776 connect( action, SIGNAL( activated() ),
775 mView, SLOT( goPreviousMonth() ) ); 777 mView, SLOT( goPreviousMonth() ) );
776 action->addTo( iconToolBar ); 778 action->addTo( iconToolBar );
777 } 779 }
778 icon = loadPixmap( pathString + "1leftarrowB" ); 780 icon = loadPixmap( pathString + "1leftarrowB" );
779 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 781 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
780 if (p-> mShowIconBack) { 782 if (p-> mShowIconBack) {
781 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 783 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
782 connect( action, SIGNAL( activated() ), 784 connect( action, SIGNAL( activated() ),
783 mView, SLOT( goPrevious() ) ); 785 mView, SLOT( goPrevious() ) );
784 action->addTo( iconToolBar ); 786 action->addTo( iconToolBar );
785 } 787 }
786 if (p-> mShowIconToday) 788 if (p-> mShowIconToday)
787 today_action->addTo( iconToolBar ); 789 today_action->addTo( iconToolBar );
788 icon = loadPixmap( pathString + "1rightarrowB" ); 790 icon = loadPixmap( pathString + "1rightarrowB" );
789 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 791 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
790 if (p-> mShowIconForward) { 792 if (p-> mShowIconForward) {
791 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 793 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
792 connect( action, SIGNAL( activated() ), 794 connect( action, SIGNAL( activated() ),
793 mView, SLOT( goNext() ) ); 795 mView, SLOT( goNext() ) );
794 action->addTo( iconToolBar ); 796 action->addTo( iconToolBar );
795 } 797 }
796 icon = loadPixmap( pathString + "2rightarrowB" ); 798 icon = loadPixmap( pathString + "2rightarrowB" );
797 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 799 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
798 if (p-> mShowIconForwardFast) { 800 if (p-> mShowIconForwardFast) {
799 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 801 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
800 connect( action, SIGNAL( activated() ), 802 connect( action, SIGNAL( activated() ),
801 mView, SLOT( goNextMonth() ) ); 803 mView, SLOT( goNextMonth() ) );
802 action->addTo( iconToolBar ); 804 action->addTo( iconToolBar );
803 } 805 }
804 806
805 807
806 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 808 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
807 809
808 if (p-> mShowIconNewEvent) 810 if (p-> mShowIconNewEvent)
809 configureToolBarMenu->setItemChecked( 10, true ); 811 configureToolBarMenu->setItemChecked( 10, true );
810 if (p->mShowIconNewTodo ) 812 if (p->mShowIconNewTodo )
811 configureToolBarMenu->setItemChecked( 20, true ); 813 configureToolBarMenu->setItemChecked( 20, true );
812 if (p-> mShowIconSearch) 814 if (p-> mShowIconSearch)
813 configureToolBarMenu->setItemChecked( 120, true ); 815 configureToolBarMenu->setItemChecked( 120, true );
814 if (p-> mShowIconList) 816 if (p-> mShowIconList)
815 configureToolBarMenu->setItemChecked( 30, true ); 817 configureToolBarMenu->setItemChecked( 30, true );
816 if (p-> mShowIconDay1) 818 if (p-> mShowIconDay1)
817 configureToolBarMenu->setItemChecked( 40, true ); 819 configureToolBarMenu->setItemChecked( 40, true );
818 if (p-> mShowIconDay5) 820 if (p-> mShowIconDay5)
819 configureToolBarMenu->setItemChecked( 50, true ); 821 configureToolBarMenu->setItemChecked( 50, true );
820 if (p-> mShowIconDay7) 822 if (p-> mShowIconDay7)
821 configureToolBarMenu->setItemChecked( 60, true ); 823 configureToolBarMenu->setItemChecked( 60, true );
822 if (p-> mShowIconMonth) 824 if (p-> mShowIconMonth)
823 configureToolBarMenu->setItemChecked( 70, true ); 825 configureToolBarMenu->setItemChecked( 70, true );
824 if (p-> mShowIconTodoview) 826 if (p-> mShowIconTodoview)
825 configureToolBarMenu->setItemChecked( 80, true ); 827 configureToolBarMenu->setItemChecked( 80, true );
826 if (p-> mShowIconBackFast) 828 if (p-> mShowIconBackFast)
827 configureToolBarMenu->setItemChecked( 200, true ); 829 configureToolBarMenu->setItemChecked( 200, true );
828 if (p-> mShowIconBack) 830 if (p-> mShowIconBack)
829 configureToolBarMenu->setItemChecked( 210, true ); 831 configureToolBarMenu->setItemChecked( 210, true );
830 if (p-> mShowIconToday) 832 if (p-> mShowIconToday)
831 configureToolBarMenu->setItemChecked( 130, true ); 833 configureToolBarMenu->setItemChecked( 130, true );
832 if (p-> mShowIconForward) 834 if (p-> mShowIconForward)
833 configureToolBarMenu->setItemChecked( 220, true ); 835 configureToolBarMenu->setItemChecked( 220, true );
834 if (p-> mShowIconForwardFast) 836 if (p-> mShowIconForwardFast)
835 configureToolBarMenu->setItemChecked( 230, true ); 837 configureToolBarMenu->setItemChecked( 230, true );
836 if (p-> mShowIconNextDays) 838 if (p-> mShowIconNextDays)
837 configureToolBarMenu->setItemChecked( 100, true ); 839 configureToolBarMenu->setItemChecked( 100, true );
838 if (p-> mShowIconNext) 840 if (p-> mShowIconNext)
839 configureToolBarMenu->setItemChecked( 110, true ); 841 configureToolBarMenu->setItemChecked( 110, true );
840 if (p-> mShowIconJournal) 842 if (p-> mShowIconJournal)
841 configureToolBarMenu->setItemChecked( 90, true ); 843 configureToolBarMenu->setItemChecked( 90, true );
842 if (p-> mShowIconWhatsThis) 844 if (p-> mShowIconWhatsThis)
843 configureToolBarMenu->setItemChecked( 300, true ); 845 configureToolBarMenu->setItemChecked( 300, true );
844 846
845 QLabel* dummy = new QLabel( iconToolBar ); 847 QLabel* dummy = new QLabel( iconToolBar );
846 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 848 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
847 if (!p-> mShowIconStretch) 849 if (!p-> mShowIconStretch)
848 iconToolBar->setStretchableWidget ( dummy ) ; 850 iconToolBar->setStretchableWidget ( dummy ) ;
849 else 851 else
850 configureToolBarMenu->setItemChecked( 5, true ); 852 configureToolBarMenu->setItemChecked( 5, true );
851 if (p-> mShowIconWhatsThis) 853 if (p-> mShowIconWhatsThis)
852 QWhatsThis::whatsThisButton ( iconToolBar ); 854 QWhatsThis::whatsThisButton ( iconToolBar );
853 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 855 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
854 configureAgenda( p->mHourSize ); 856 configureAgenda( p->mHourSize );
855 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 857 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
856} 858}
857void MainWindow::fillSyncMenu() 859void MainWindow::fillSyncMenu()
858{ 860{
859 if ( syncMenu->count() ) 861 if ( syncMenu->count() )
860 syncMenu->clear(); 862 syncMenu->clear();
861 syncMenu->insertItem( i18n("Configure..."), 0 ); 863 syncMenu->insertItem( i18n("Configure..."), 0 );
862 syncMenu->insertSeparator(); 864 syncMenu->insertSeparator();
863 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 865 syncMenu->insertItem( i18n("Multiple sync"), 1 );
864 syncMenu->insertSeparator(); 866 syncMenu->insertSeparator();
865 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 867 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
866 config.setGroup("General"); 868 config.setGroup("General");
867 QStringList prof = config.readListEntry("SyncProfileNames"); 869 QStringList prof = config.readListEntry("SyncProfileNames");
868 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 870 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
869 if ( prof.count() < 3 ) { 871 if ( prof.count() < 3 ) {
870 prof.clear(); 872 prof.clear();
871 prof << i18n("Sharp_DTM"); 873 prof << i18n("Sharp_DTM");
872 prof << i18n("Local_file"); 874 prof << i18n("Local_file");
873 prof << i18n("Last_file"); 875 prof << i18n("Last_file");
874 KSyncProfile* temp = new KSyncProfile (); 876 KSyncProfile* temp = new KSyncProfile ();
875 temp->setName( prof[0] ); 877 temp->setName( prof[0] );
876 temp->writeConfig(&config); 878 temp->writeConfig(&config);
877 temp->setName( prof[1] ); 879 temp->setName( prof[1] );
878 temp->writeConfig(&config); 880 temp->writeConfig(&config);
879 temp->setName( prof[2] ); 881 temp->setName( prof[2] );
880 temp->writeConfig(&config); 882 temp->writeConfig(&config);
881 config.setGroup("General"); 883 config.setGroup("General");
882 config.writeEntry("SyncProfileNames",prof); 884 config.writeEntry("SyncProfileNames",prof);
883 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 885 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
884 config.sync(); 886 config.sync();
885 delete temp; 887 delete temp;
886 } 888 }
887 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 889 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
888 KOPrefs::instance()->mSyncProfileNames = prof; 890 KOPrefs::instance()->mSyncProfileNames = prof;
889 int i; 891 int i;
890 for ( i = 0; i < prof.count(); ++i ) { 892 for ( i = 0; i < prof.count(); ++i ) {
891 893
892 syncMenu->insertItem( prof[i], 1000+i ); 894 syncMenu->insertItem( prof[i], 1000+i );
893 if ( i == 2 ) 895 if ( i == 2 )
894 syncMenu->insertSeparator(); 896 syncMenu->insertSeparator();
895 } 897 }
896 QDir app_dir; 898 QDir app_dir;
897 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 899 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
898 syncMenu->setItemEnabled( false , 1000 ); 900 syncMenu->setItemEnabled( false , 1000 );
899 } 901 }
900 mView->setupExternSyncProfiles(); 902 mView->setupExternSyncProfiles();
901} 903}
902 904
903int MainWindow::ringSync() 905int MainWindow::ringSync()
904{ 906{
905 int syncedProfiles = 0; 907 int syncedProfiles = 0;
906 int i; 908 int i;
907 QTime timer; 909 QTime timer;
908 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 910 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
909 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 911 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
910 KSyncProfile* temp = new KSyncProfile (); 912 KSyncProfile* temp = new KSyncProfile ();
911 KOPrefs::instance()->mAskForPreferences = false; 913 KOPrefs::instance()->mAskForPreferences = false;
912 for ( i = 0; i < syncProfileNames.count(); ++i ) { 914 for ( i = 0; i < syncProfileNames.count(); ++i ) {
913 mCurrentSyncProfile = i; 915 mCurrentSyncProfile = i;
914 temp->setName(syncProfileNames[mCurrentSyncProfile]); 916 temp->setName(syncProfileNames[mCurrentSyncProfile]);
915 temp->readConfig(&config); 917 temp->readConfig(&config);
916 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 918 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
917 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 919 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
918 ++syncedProfiles; 920 ++syncedProfiles;
919 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 921 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
920 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 922 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
921 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 923 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
922 KOPrefs::instance()->mWriteBackInFuture = 0; 924 KOPrefs::instance()->mWriteBackInFuture = 0;
923 if ( temp->getWriteBackFuture() ) 925 if ( temp->getWriteBackFuture() )
924 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 926 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
925 KOPrefs::instance()->mShowSyncSummary = false; 927 KOPrefs::instance()->mShowSyncSummary = false;
926 mView->setSyncDevice(syncProfileNames[i] ); 928 mView->setSyncDevice(syncProfileNames[i] );
927 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 929 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
928 if ( i == 0 ) { 930 if ( i == 0 ) {
929 syncSharp(); 931 syncSharp();
930 } else { 932 } else {
931 if ( temp->getIsLocalFileSync() ) { 933 if ( temp->getIsLocalFileSync() ) {
932 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 934 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
933 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 935 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
934 } else { 936 } else {
935 if ( temp->getIsPhoneSync() ) { 937 if ( temp->getIsPhoneSync() ) {
936 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 938 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
937 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 939 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
938 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 940 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
939 syncPhone(); 941 syncPhone();
940 } else 942 } else
941 syncRemote( temp, false ); 943 syncRemote( temp, false );
942 944
943 } 945 }
944 } 946 }
945 timer.start(); 947 timer.start();
946 setCaption(i18n("Multiple sync in progress ... please wait!") ); 948 setCaption(i18n("Multiple sync in progress ... please wait!") );
947 while ( timer.elapsed () < 2000 ) { 949 while ( timer.elapsed () < 2000 ) {
948 qApp->processEvents(); 950 qApp->processEvents();
949#ifndef _WIN32_ 951#ifndef _WIN32_
950 sleep (1); 952 sleep (1);
951#endif 953#endif
952 } 954 }
953 955
954 } 956 }
955 957
956 } 958 }
957 delete temp; 959 delete temp;
958 return syncedProfiles; 960 return syncedProfiles;
959} 961}
960 962
961void MainWindow::multiSync( bool askforPrefs ) 963void MainWindow::multiSync( bool askforPrefs )
962{ 964{
963 if (mBlockSaveFlag) 965 if (mBlockSaveFlag)
964 return; 966 return;
965 mBlockSaveFlag = true; 967 mBlockSaveFlag = true;
966 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 968 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
967 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 969 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
968 question, 970 question,
969 i18n("Yes"), i18n("No"), 971 i18n("Yes"), i18n("No"),
970 0, 0 ) != 0 ) { 972 0, 0 ) != 0 ) {
971 mBlockSaveFlag = false; 973 mBlockSaveFlag = false;
972 setCaption(i18n("Aborted! Nothing synced!")); 974 setCaption(i18n("Aborted! Nothing synced!"));
973 return; 975 return;
974 } 976 }
975 mView->setSyncDevice(i18n("Multiple profiles") ); 977 mView->setSyncDevice(i18n("Multiple profiles") );
976 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 978 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
977 if ( askforPrefs ) { 979 if ( askforPrefs ) {
978 mView->edit_sync_options(); 980 mView->edit_sync_options();
979 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 981 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
980 } 982 }
981 setCaption(i18n("Multiple sync started.") ); 983 setCaption(i18n("Multiple sync started.") );
982 qApp->processEvents(); 984 qApp->processEvents();
983 int num = ringSync() ; 985 int num = ringSync() ;
984 if ( num > 1 ) 986 if ( num > 1 )
985 ringSync(); 987 ringSync();
986 mBlockSaveFlag = false; 988 mBlockSaveFlag = false;
987 if ( num ) 989 if ( num )
988 save(); 990 save();
989 if ( num ) 991 if ( num )
990 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 992 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
991 else 993 else
992 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 994 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
993 return; 995 return;
994} 996}
995void MainWindow::slotSyncMenu( int action ) 997void MainWindow::slotSyncMenu( int action )
996{ 998{
997 //qDebug("syncaction %d ", action); 999 //qDebug("syncaction %d ", action);
998 if ( action == 0 ) { 1000 if ( action == 0 ) {
999 1001
1000 // seems to be a Qt2 event handling bug 1002 // seems to be a Qt2 event handling bug
1001 // syncmenu.clear causes a segfault at first time 1003 // syncmenu.clear causes a segfault at first time
1002 // when we call it after the main event loop, it is ok 1004 // when we call it after the main event loop, it is ok
1003 // same behaviour when calling OM/Pi via QCOP for the first time 1005 // same behaviour when calling OM/Pi via QCOP for the first time
1004 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 1006 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
1005 //confSync(); 1007 //confSync();
1006 1008
1007 return; 1009 return;
1008 } 1010 }
1009 if ( action == 1 ) { 1011 if ( action == 1 ) {
1010 multiSync( true ); 1012 multiSync( true );
1011 return; 1013 return;
1012 } 1014 }
1013 1015
1014 if (mBlockSaveFlag) 1016 if (mBlockSaveFlag)
1015 return; 1017 return;
1016 mBlockSaveFlag = true; 1018 mBlockSaveFlag = true;
1017 mCurrentSyncProfile = action - 1000 ; 1019 mCurrentSyncProfile = action - 1000 ;
1018 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 1020 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
1019 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 1021 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
1020 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 1022 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
1021 KSyncProfile* temp = new KSyncProfile (); 1023 KSyncProfile* temp = new KSyncProfile ();
1022 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1024 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1023 temp->readConfig(&config); 1025 temp->readConfig(&config);
1024 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 1026 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
1025 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 1027 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
1026 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 1028 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
1027 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 1029 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
1028 KOPrefs::instance()->mWriteBackInFuture = 0; 1030 KOPrefs::instance()->mWriteBackInFuture = 0;
1029 if ( temp->getWriteBackFuture() ) 1031 if ( temp->getWriteBackFuture() )
1030 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 1032 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
1031 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 1033 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
1032 if ( action == 1000 ) { 1034 if ( action == 1000 ) {
1033 syncSharp(); 1035 syncSharp();
1034 1036
1035 } else if ( action == 1001 ) { 1037 } else if ( action == 1001 ) {
1036 syncLocalFile(); 1038 syncLocalFile();
1037 1039
1038 } else if ( action == 1002 ) { 1040 } else if ( action == 1002 ) {
1039 quickSyncLocalFile(); 1041 quickSyncLocalFile();
1040 1042
1041 } else if ( action >= 1003 ) { 1043 } else if ( action >= 1003 ) {
1042 if ( temp->getIsLocalFileSync() ) { 1044 if ( temp->getIsLocalFileSync() ) {
1043 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 1045 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
1044 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 1046 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
1045 } else { 1047 } else {
1046 if ( temp->getIsPhoneSync() ) { 1048 if ( temp->getIsPhoneSync() ) {
1047 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 1049 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
1048 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 1050 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
1049 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 1051 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
1050 syncPhone(); 1052 syncPhone();
1051 } else 1053 } else
1052 syncRemote( temp ); 1054 syncRemote( temp );
1053 1055
1054 } 1056 }
1055 } 1057 }
1056 delete temp; 1058 delete temp;
1057 mBlockSaveFlag = false; 1059 mBlockSaveFlag = false;
1058} 1060}
1059void MainWindow::setDefaultPreferences() 1061void MainWindow::setDefaultPreferences()
1060{ 1062{
1061 KOPrefs *p = KOPrefs::instance(); 1063 KOPrefs *p = KOPrefs::instance();
1062 1064
1063 p->mCompactDialogs = true; 1065 p->mCompactDialogs = true;
1064 p->mConfirm = true; 1066 p->mConfirm = true;
1065 // p->mEnableQuickTodo = false; 1067 // p->mEnableQuickTodo = false;
1066} 1068}
1067 1069
1068QString MainWindow::resourcePath() 1070QString MainWindow::resourcePath()
1069{ 1071{
1070 return KGlobal::iconLoader()->iconPath(); 1072 return KGlobal::iconLoader()->iconPath();
1071} 1073}
1072 1074
1073void MainWindow::displayText( QString text ,QString cap ) 1075void MainWindow::displayText( QString text ,QString cap )
1074{ 1076{
1075 QDialog dia( this, "name", true ); ; 1077 QDialog dia( this, "name", true ); ;
1076 dia.setCaption( cap ); 1078 dia.setCaption( cap );
1077 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1079 QVBoxLayout* lay = new QVBoxLayout( &dia );
1078 lay->setSpacing( 3 ); 1080 lay->setSpacing( 3 );
1079 lay->setMargin( 3 ); 1081 lay->setMargin( 3 );
1080 QTextBrowser tb ( &dia ); 1082 QTextBrowser tb ( &dia );
1081 lay->addWidget( &tb ); 1083 lay->addWidget( &tb );
1082 tb.setText( text ); 1084 tb.setText( text );
1083#ifdef DESKTOP_VERSION 1085#ifdef DESKTOP_VERSION
1084 dia.resize( 640, 480); 1086 dia.resize( 640, 480);
1085#else 1087#else
1086 dia.showMaximized(); 1088 dia.showMaximized();
1087#endif 1089#endif
1088 dia.exec(); 1090 dia.exec();
1089} 1091}
1090void MainWindow::displayFile( QString fn, QString cap ) 1092void MainWindow::displayFile( QString fn, QString cap )
1091{ 1093{
1092 QString fileName = resourcePath() + fn; 1094 QString fileName = resourcePath() + fn;
1093 QString text; 1095 QString text;
1094 QFile file( fileName ); 1096 QFile file( fileName );
1095 if (!file.open( IO_ReadOnly ) ) { 1097 if (!file.open( IO_ReadOnly ) ) {
1096 return ; 1098 return ;
1097 1099
1098 } 1100 }
1099 QTextStream ts( &file ); 1101 QTextStream ts( &file );
1100 text = ts.read(); 1102 text = ts.read();
1101 file.close(); 1103 file.close();
1102 displayText( text, cap); 1104 displayText( text, cap);
1103} 1105}
1104void MainWindow::features() 1106void MainWindow::features()
1105{ 1107{
1106 1108
1107 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1109 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1108} 1110}
1109 1111
1110void MainWindow::usertrans() 1112void MainWindow::usertrans()
1111{ 1113{
1112 1114
1113 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1115 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1114} 1116}
1115#if 0 1117#if 0
1116#include <libkcal/vcalformat.h> 1118#include <libkcal/vcalformat.h>
1117#include <libkcal/event.h> 1119#include <libkcal/event.h>
1118#include <libkcal/todo.h> 1120#include <libkcal/todo.h>
1119#include <libkcal/incidence.h> 1121#include <libkcal/incidence.h>
1120#endif 1122#endif
1121void MainWindow::synchowto() 1123void MainWindow::synchowto()
1122{ 1124{
1123#if 0 1125#if 0
1124 QPtrList<Incidence> er = mCalendar->rawIncidences(); 1126 QPtrList<Incidence> er = mCalendar->rawIncidences();
1125 Incidence* inR = er.first(); 1127 Incidence* inR = er.first();
1126 VCalFormat vf; 1128 VCalFormat vf;
1127 QString strout; 1129 QString strout;
1128 while ( inR ) { 1130 while ( inR ) {
1129 if ( inR->type() == "Todo" ) 1131 if ( inR->type() == "Todo" )
1130 strout = vf.todoToString( (Todo *) inR ); 1132 strout = vf.todoToString( (Todo *) inR );
1131 if ( inR->type() == "Event" ) 1133 if ( inR->type() == "Event" )
1132 strout = vf.eventToString( (Event *) inR ); 1134 strout = vf.eventToString( (Event *) inR );
1133 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); 1135 qDebug("incidence: \n%s\n ente\n\n",strout.latin1() );
1134 inR = er.next(); 1136 inR = er.next();
1135 } 1137 }
1136#endif 1138#endif
1137 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); 1139 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
1138} 1140}
1139void MainWindow::faq() 1141void MainWindow::faq()
1140{ 1142{
1141 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1143 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1142 1144
1143} 1145}
1144void MainWindow::whatsNew() 1146void MainWindow::whatsNew()
1145{ 1147{
1146 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); 1148 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
1147 1149
1148} 1150}
1149void MainWindow::licence() 1151void MainWindow::licence()
1150{ 1152{
1151 KApplication::showLicence(); 1153 KApplication::showLicence();
1152 1154
1153} 1155}
1154void MainWindow::about() 1156void MainWindow::about()
1155{ 1157{
1156 QString version; 1158 QString version;
1157#include <../version> 1159#include <../version>
1158 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1160 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1159 i18n("KOrganizer/Platform-independent\n") + 1161 i18n("KOrganizer/Platform-independent\n") +
1160 "(KO/Pi) " + version + " - " + 1162 "(KO/Pi) " + version + " - " +
1161 1163
1162#ifdef DESKTOP_VERSION 1164#ifdef DESKTOP_VERSION
1163 i18n("Desktop Edition\n") + 1165 i18n("Desktop Edition\n") +
1164#else 1166#else
1165 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1167 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1166#endif 1168#endif
1167 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1169 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1168} 1170}
1169void MainWindow::keyBindings() 1171void MainWindow::keyBindings()
1170{ 1172{
1171 QString cap = i18n("Key bindings KOrganizer/Pi"); 1173 QString cap = i18n("Key bindings KOrganizer/Pi");
1172 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1174 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1173 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1175 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1174 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1176 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1175 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1177 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1176 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1178 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1177 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1179 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1178 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1180 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1179 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1181 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1180 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1182 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1181 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1183 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1182 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1184 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1183 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1185 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1184 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1186 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1185 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1187 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1186 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1188 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1187 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1189 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1188 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1190 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1189 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1191 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1190 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1192 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1191 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1193 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1192 i18n("<p><h3>In agenda view:</h3></p>\n") + 1194 i18n("<p><h3>In agenda view:</h3></p>\n") +
1193 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1195 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1194 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1196 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1195 i18n("<p><h3>In todo view:</h3></p>\n") + 1197 i18n("<p><h3>In todo view:</h3></p>\n") +
1196 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1198 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1197 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1199 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1198 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1200 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1199 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1201 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1200 i18n("<p><h3>In list view:</h3></p>\n") + 1202 i18n("<p><h3>In list view:</h3></p>\n") +
1201 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1203 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1202 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1204 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1203 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1205 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1204 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1206 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1205 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1207 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1206 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1208 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1207 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1209 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1208 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1210 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1209 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1211 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1210 i18n("<p><b>E</b>: Edit item</p>\n") + 1212 i18n("<p><b>E</b>: Edit item</p>\n") +
1211 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1213 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1212 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1214 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1213 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1215 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1214 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1216 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1215 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1217 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1216 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1218 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1217 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1219 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1218 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1220 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1219 i18n("<p><b>White</b>: Item readonly</p>\n"); 1221 i18n("<p><b>White</b>: Item readonly</p>\n");
1220 displayText( text, cap); 1222 displayText( text, cap);
1221 1223
1222} 1224}
1223void MainWindow::aboutAutoSaving() 1225void MainWindow::aboutAutoSaving()
1224{ 1226{
1225 QMessageBox* msg; 1227 QMessageBox* msg;
1226 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1228 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1227 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1229 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1228 QMessageBox::Ok, 1230 QMessageBox::Ok,
1229 QMessageBox::NoButton, 1231 QMessageBox::NoButton,
1230 QMessageBox::NoButton); 1232 QMessageBox::NoButton);
1231 msg->exec(); 1233 msg->exec();
1232 delete msg; 1234 delete msg;
1233 1235
1234 1236
1235} 1237}
1236void MainWindow::aboutKnownBugs() 1238void MainWindow::aboutKnownBugs()
1237{ 1239{
1238 QMessageBox* msg; 1240 QMessageBox* msg;
1239 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1241 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1240 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1242 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1241 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1243 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1242 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1244 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1243 i18n("\nor report them in the bugtracker on\n") + 1245 i18n("\nor report them in the bugtracker on\n") +
1244 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1246 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1245 QMessageBox::NoIcon, 1247 QMessageBox::NoIcon,
1246 QMessageBox::Ok, 1248 QMessageBox::Ok,
1247 QMessageBox::NoButton, 1249 QMessageBox::NoButton,
1248 QMessageBox::NoButton); 1250 QMessageBox::NoButton);
1249 msg->exec(); 1251 msg->exec();
1250 delete msg; 1252 delete msg;
1251 1253
1252} 1254}
1253 1255
1254QString MainWindow::defaultFileName() 1256QString MainWindow::defaultFileName()
1255{ 1257{
1256 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1258 return locateLocal( "data", "korganizer/mycalendar.ics" );
1257} 1259}
1258 1260
1259void MainWindow::processIncidenceSelection( Incidence *incidence ) 1261void MainWindow::processIncidenceSelection( Incidence *incidence )
1260{ 1262{
1261 if ( !incidence ) { 1263 if ( !incidence ) {
1262 enableIncidenceActions( false ); 1264 enableIncidenceActions( false );
1263 1265
1264 mNewSubTodoAction->setEnabled( false ); 1266 mNewSubTodoAction->setEnabled( false );
1265 setCaptionToDates(); 1267 setCaptionToDates();
1266 return; 1268 return;
1267 1269
1268 } 1270 }
1269 1271
1270 //KGlobal::locale()->formatDateTime(nextA, true); 1272 //KGlobal::locale()->formatDateTime(nextA, true);
1271 QString startString = ""; 1273 QString startString = "";
1272 if ( incidence->type() != "Todo" ) { 1274 if ( incidence->type() != "Todo" ) {
1273 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1275 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1274 if ( incidence->doesFloat() ) { 1276 if ( incidence->doesFloat() ) {
1275 startString += ": "+incidence->dtStartDateStr( true ); 1277 startString += ": "+incidence->dtStartDateStr( true );
1276 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1278 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1277 1279
1278 } else { 1280 } else {
1279 startString = ": "+incidence->dtStartStr(true); 1281 startString = ": "+incidence->dtStartStr(true);
1280 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1282 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1281 1283
1282 } 1284 }
1283 1285
1284 } else { 1286 } else {
1285 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1287 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1286 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1288 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1287 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1289 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1288 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1290 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1289 } 1291 }
1290 1292
1291 } 1293 }
1292 else 1294 else
1293 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1295 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1294 if ( !incidence->location().isEmpty() ) 1296 if ( !incidence->location().isEmpty() )
1295 startString += " (" +incidence->location()+")"; 1297 startString += " (" +incidence->location()+")";
1296 setCaption( incidence->summary()+startString); 1298 setCaption( incidence->summary()+startString);
1297 1299
1298 enableIncidenceActions( true ); 1300 enableIncidenceActions( true );
1299 1301
1300 if ( incidence->type() == "Event" ) { 1302 if ( incidence->type() == "Event" ) {
1301 mShowAction->setText( i18n("Show Event...") ); 1303 mShowAction->setText( i18n("Show Event...") );
1302 mEditAction->setText( i18n("Edit Event...") ); 1304 mEditAction->setText( i18n("Edit Event...") );
1303 mDeleteAction->setText( i18n("Delete Event...") ); 1305 mDeleteAction->setText( i18n("Delete Event...") );
1304 1306
1305 mNewSubTodoAction->setEnabled( false ); 1307 mNewSubTodoAction->setEnabled( false );
1306 } else if ( incidence->type() == "Todo" ) { 1308 } else if ( incidence->type() == "Todo" ) {
1307 mShowAction->setText( i18n("Show Todo...") ); 1309 mShowAction->setText( i18n("Show Todo...") );
1308 mEditAction->setText( i18n("Edit Todo...") ); 1310 mEditAction->setText( i18n("Edit Todo...") );
1309 mDeleteAction->setText( i18n("Delete Todo...") ); 1311 mDeleteAction->setText( i18n("Delete Todo...") );
1310 1312
1311 mNewSubTodoAction->setEnabled( true ); 1313 mNewSubTodoAction->setEnabled( true );
1312 } else { 1314 } else {
1313 mShowAction->setText( i18n("Show...") ); 1315 mShowAction->setText( i18n("Show...") );
1314 mShowAction->setText( i18n("Edit...") ); 1316 mShowAction->setText( i18n("Edit...") );
1315 mShowAction->setText( i18n("Delete...") ); 1317 mShowAction->setText( i18n("Delete...") );
1316 1318
1317 mNewSubTodoAction->setEnabled( false ); 1319 mNewSubTodoAction->setEnabled( false );
1318 } 1320 }
1319} 1321}
1320 1322
1321void MainWindow::enableIncidenceActions( bool enabled ) 1323void MainWindow::enableIncidenceActions( bool enabled )
1322{ 1324{
1323 mShowAction->setEnabled( enabled ); 1325 mShowAction->setEnabled( enabled );
1324 mEditAction->setEnabled( enabled ); 1326 mEditAction->setEnabled( enabled );
1325 mDeleteAction->setEnabled( enabled ); 1327 mDeleteAction->setEnabled( enabled );
1326} 1328}
1327 1329
1328void MainWindow::importOL() 1330void MainWindow::importOL()
1329{ 1331{
1330#ifdef _WIN32_ 1332#ifdef _WIN32_
1331 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1333 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1332 id->exec(); 1334 id->exec();
1333 delete id; 1335 delete id;
1334 mView->updateView(); 1336 mView->updateView();
1335#endif 1337#endif
1336} 1338}
1337void MainWindow::importBday() 1339void MainWindow::importBday()
1338{ 1340{
1339 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1341 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1340 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1342 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1341 i18n("Import!"), i18n("Cancel"), 0, 1343 i18n("Import!"), i18n("Cancel"), 0,
1342 0, 1 ); 1344 0, 1 );
1343 if ( result == 0 ) { 1345 if ( result == 0 ) {
1344 mView->importBday(); 1346 mView->importBday();
1345 1347
1346 } 1348 }
1347 1349
1348 1350
1349} 1351}
1350void MainWindow::importQtopia() 1352void MainWindow::importQtopia()
1351{ 1353{
1352#ifndef DESKTOP_VERSION 1354#ifndef DESKTOP_VERSION
1353 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1355 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1354 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1356 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1355 i18n("Import!"), i18n("Cancel"), 0, 1357 i18n("Import!"), i18n("Cancel"), 0,
1356 0, 1 ); 1358 0, 1 );
1357 if ( result == 0 ) { 1359 if ( result == 0 ) {
1358 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1360 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1359 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1361 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1360 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1362 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1361 mView->importQtopia( categories, datebook, todolist ); 1363 mView->importQtopia( categories, datebook, todolist );
1362 } 1364 }
1363#else 1365#else
1364 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1366 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1365 i18n("Not supported \non desktop!\n"), 1367 i18n("Not supported \non desktop!\n"),
1366 i18n("Ok"), i18n("Cancel"), 0, 1368 i18n("Ok"), i18n("Cancel"), 0,
1367 0, 1 ); 1369 0, 1 );
1368 1370
1369#endif 1371#endif
1370} 1372}
1371 1373
1372void MainWindow::saveOnClose() 1374void MainWindow::saveOnClose()
1373{ 1375{
1374 KOPrefs *p = KOPrefs::instance(); 1376 KOPrefs *p = KOPrefs::instance();
1375 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1377 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1376 p->mToolBarUp = iconToolBar->x() > width()/2 || 1378 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1377 iconToolBar->y() > height()/2; 1379 iconToolBar->y() > height()/2;
1378 mView->writeSettings(); 1380 mView->writeSettings();
1379 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1381 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1380 save(); 1382 save();
1381} 1383}
1382void MainWindow::slotModifiedChanged( bool changed ) 1384void MainWindow::slotModifiedChanged( bool changed )
1383{ 1385{
1384 if ( mBlockAtStartup ) 1386 if ( mBlockAtStartup )
1385 return; 1387 return;
1386 int msec; 1388 int msec;
1387 // we store the changes after 1 minute, 1389 // we store the changes after 1 minute,
1388 // and for safety reasons after 10 minutes again 1390 // and for safety reasons after 10 minutes again
1389 if ( !mBlockSaveFlag ) 1391 if ( !mBlockSaveFlag )
1390 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1392 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1391 else 1393 else
1392 msec = 1000 * 600; 1394 msec = 1000 * 600;
1393 mSaveTimer.start( msec, true ); // 1 minute 1395 mSaveTimer.start( msec, true ); // 1 minute
1394 qDebug("KO: Saving File in %d secs!", msec/1000); 1396 qDebug("KO: Saving File in %d secs!", msec/1000);
1395 mCalendarModifiedFlag = true; 1397 mCalendarModifiedFlag = true;
1396} 1398}
1397#include <qfileinfo.h> 1399#include <qfileinfo.h>
1398void MainWindow::save() 1400void MainWindow::save()
1399{ 1401{
1400 if ( mBlockSaveFlag ) 1402 if ( mBlockSaveFlag )
1401 return; 1403 return;
1402 bool store = mBlockSaveFlag; 1404 bool store = mBlockSaveFlag;
1403 mBlockSaveFlag = true; 1405 mBlockSaveFlag = true;
1404 if ( mView->checkFileVersion( defaultFileName()) ) { 1406 if ( mView->checkFileVersion( defaultFileName()) ) {
1405 1407
1406 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1408 QTime neededSaveTime = QDateTime::currentDateTime().time();
1407 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1409 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1408 qDebug("KO: Start saving data to file!"); 1410 qDebug("KO: Start saving data to file!");
1409 mView->saveCalendar( defaultFileName() ); 1411 mView->saveCalendar( defaultFileName() );
1410 1412
1411 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1413 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1412 mView->setLoadedFileVersion(QDateTime::currentDateTime()); 1414 mView->setLoadedFileVersion(QDateTime::currentDateTime());
1413 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1415 qDebug("KO: Needed %d ms for saving.",msNeeded );
1414 QString savemes; 1416 QString savemes;
1415 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1417 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1416 setCaption(savemes); 1418 setCaption(savemes);
1417 } else 1419 } else
1418 setCaption(i18n("Saving cancelled!")); 1420 setCaption(i18n("Saving cancelled!"));
1419 mCalendarModifiedFlag = false; 1421 mCalendarModifiedFlag = false;
1420 mBlockSaveFlag = store; 1422 mBlockSaveFlag = store;
1421} 1423}
1422 1424
1423void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1425void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1424{ 1426{
1425 if ( !e->isAutoRepeat() ) { 1427 if ( !e->isAutoRepeat() ) {
1426 mFlagKeyPressed = false; 1428 mFlagKeyPressed = false;
1427 } 1429 }
1428} 1430}
1429void MainWindow::keyPressEvent ( QKeyEvent * e ) 1431void MainWindow::keyPressEvent ( QKeyEvent * e )
1430{ 1432{
1431 qApp->processEvents(); 1433 qApp->processEvents();
1432 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1434 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1433 e->ignore(); 1435 e->ignore();
1434 // qDebug(" ignore %d",e->isAutoRepeat() ); 1436 // qDebug(" ignore %d",e->isAutoRepeat() );
1435 return; 1437 return;
1436 } 1438 }
1437 if (! e->isAutoRepeat() ) 1439 if (! e->isAutoRepeat() )
1438 mFlagKeyPressed = true; 1440 mFlagKeyPressed = true;
1439 KOPrefs *p = KOPrefs::instance(); 1441 KOPrefs *p = KOPrefs::instance();
1440 bool showSelectedDates = false; 1442 bool showSelectedDates = false;
1441 int size; 1443 int size;
1442 int pro = 0; 1444 int pro = 0;
1443 //qDebug("MainWindow::keyPressEvent "); 1445 //qDebug("MainWindow::keyPressEvent ");
1444 switch ( e->key() ) { 1446 switch ( e->key() ) {
1445 case Qt::Key_Right: 1447 case Qt::Key_Right:
1446 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1448 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1447 mView->goNextMonth(); 1449 mView->goNextMonth();
1448 else 1450 else
1449 mView->goNext(); 1451 mView->goNext();
1450 showSelectedDates = true; 1452 showSelectedDates = true;
1451 break; 1453 break;
1452 case Qt::Key_Left: 1454 case Qt::Key_Left:
1453 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1455 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1454 mView->goPreviousMonth(); 1456 mView->goPreviousMonth();
1455 else 1457 else
1456 mView->goPrevious(); 1458 mView->goPrevious();
1457 showSelectedDates = true; 1459 showSelectedDates = true;
1458 break; 1460 break;
1459 case Qt::Key_Down: 1461 case Qt::Key_Down:
1460 mView->viewManager()->agendaView()->scrollOneHourDown(); 1462 mView->viewManager()->agendaView()->scrollOneHourDown();
1461 break; 1463 break;
1462 case Qt::Key_Up: 1464 case Qt::Key_Up:
1463 mView->viewManager()->agendaView()->scrollOneHourUp(); 1465 mView->viewManager()->agendaView()->scrollOneHourUp();
1464 break; 1466 break;
1465 case Qt::Key_I: 1467 case Qt::Key_I:
1466 mView->showIncidence(); 1468 mView->showIncidence();
1467 break; 1469 break;
1468 case Qt::Key_Delete: 1470 case Qt::Key_Delete:
1469 case Qt::Key_Backspace: 1471 case Qt::Key_Backspace:
1470 mView->deleteIncidence(); 1472 mView->deleteIncidence();
1471 break; 1473 break;
1472 case Qt::Key_D: 1474 case Qt::Key_D:
1473 mView->viewManager()->showDayView(); 1475 mView->viewManager()->showDayView();
1474 showSelectedDates = true; 1476 showSelectedDates = true;
1475 break; 1477 break;
1476 case Qt::Key_O: 1478 case Qt::Key_O:
1477 mView->toggleFilerEnabled( ); 1479 mView->toggleFilerEnabled( );
1478 break; 1480 break;
1479 case Qt::Key_0: 1481 case Qt::Key_0:
1480 case Qt::Key_1: 1482 case Qt::Key_1:
1481 case Qt::Key_2: 1483 case Qt::Key_2:
1482 case Qt::Key_3: 1484 case Qt::Key_3:
1483 case Qt::Key_4: 1485 case Qt::Key_4:
1484 case Qt::Key_5: 1486 case Qt::Key_5:
1485 case Qt::Key_6: 1487 case Qt::Key_6:
1486 case Qt::Key_7: 1488 case Qt::Key_7:
1487 case Qt::Key_8: 1489 case Qt::Key_8:
1488 case Qt::Key_9: 1490 case Qt::Key_9:
1489 pro = e->key()-48; 1491 pro = e->key()-48;
1490 if ( pro == 0 ) 1492 if ( pro == 0 )
1491 pro = 10; 1493 pro = 10;
1492 if ( e->state() == Qt::ControlButton) 1494 if ( e->state() == Qt::ControlButton)
1493 pro += 10; 1495 pro += 10;
1494 break; 1496 break;
1495 case Qt::Key_M: 1497 case Qt::Key_M:
1496 mView->viewManager()->showMonthView(); 1498 mView->viewManager()->showMonthView();
1497 showSelectedDates = true; 1499 showSelectedDates = true;
1498 break; 1500 break;
1499 case Qt::Key_Insert: 1501 case Qt::Key_Insert:
1500 mView->newEvent(); 1502 mView->newEvent();
1501 break; 1503 break;
1502 case Qt::Key_S : 1504 case Qt::Key_S :
1503 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1505 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1504 mView->newSubTodo(); 1506 mView->newSubTodo();
1505 else 1507 else
1506 mView->dialogManager()->showSearchDialog(); 1508 mView->dialogManager()->showSearchDialog();
1507 break; 1509 break;
1508 case Qt::Key_Y : 1510 case Qt::Key_Y :
1509 case Qt::Key_Z : 1511 case Qt::Key_Z :
1510 mView->viewManager()->showWorkWeekView(); 1512 mView->viewManager()->showWorkWeekView();
1511 showSelectedDates = true; 1513 showSelectedDates = true;
1512 break; 1514 break;
1513 case Qt::Key_U : 1515 case Qt::Key_U :
1514 mView->viewManager()->showWeekView(); 1516 mView->viewManager()->showWeekView();
1515 showSelectedDates = true; 1517 showSelectedDates = true;
1516 break; 1518 break;
1517 case Qt::Key_H : 1519 case Qt::Key_H :
1518 keyBindings(); 1520 keyBindings();
1519 break; 1521 break;
1520 case Qt::Key_W: 1522 case Qt::Key_W:
1521 mView->viewManager()->showWhatsNextView(); 1523 mView->viewManager()->showWhatsNextView();
1522 break; 1524 break;
1523 case Qt::Key_L: 1525 case Qt::Key_L:
1524 mView->viewManager()->showListView(); 1526 mView->viewManager()->showListView();
1525 break; 1527 break;
1526 case Qt::Key_N: 1528 case Qt::Key_N:
1527 mView->viewManager()->showNextXView(); 1529 mView->viewManager()->showNextXView();
1528 showSelectedDates = true; 1530 showSelectedDates = true;
1529 break; 1531 break;
1530 case Qt::Key_V: 1532 case Qt::Key_V:
1531 mView->viewManager()->showTodoView(); 1533 mView->viewManager()->showTodoView();
1532 break; 1534 break;
1533 case Qt::Key_C: 1535 case Qt::Key_C:
1534 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1536 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1535 break; 1537 break;
1536 case Qt::Key_P: 1538 case Qt::Key_P:
1537 mView->showDatePicker( ); 1539 mView->showDatePicker( );
1538 break; 1540 break;
1539 case Qt::Key_F: 1541 case Qt::Key_F:
1540 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1542 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1541 mView->editFilters(); 1543 mView->editFilters();
1542 else 1544 else
1543 mView->toggleFilter(); 1545 mView->toggleFilter();
1544 break; 1546 break;
1545 case Qt::Key_X: 1547 case Qt::Key_X:
1546 mView->toggleDateNavigatorWidget(); 1548 mView->toggleDateNavigatorWidget();
1547 break; 1549 break;
1548 case Qt::Key_Space: 1550 case Qt::Key_Space:
1549 mView->toggleExpand(); 1551 mView->toggleExpand();
1550 break; 1552 break;
1551 case Qt::Key_A: 1553 case Qt::Key_A:
1552 mView->toggleAllDaySize(); 1554 mView->toggleAllDaySize();
1553 break; 1555 break;
1554 case Qt::Key_T: 1556 case Qt::Key_T:
1555 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1557 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1556 mView->newTodo(); 1558 mView->newTodo();
1557 else { 1559 else {
1558 mView->goToday(); 1560 mView->goToday();
1559 showSelectedDates = true; 1561 showSelectedDates = true;
1560 } 1562 }
1561 break; 1563 break;
1562 case Qt::Key_J: 1564 case Qt::Key_J:
1563 mView->viewManager()->showJournalView(); 1565 mView->viewManager()->showJournalView();
1564 break; 1566 break;
1565 case Qt::Key_B: 1567 case Qt::Key_B:
1566 mView->editIncidenceDescription();; 1568 mView->editIncidenceDescription();;
1567 break; 1569 break;
1568 // case Qt::Key_Return: 1570 // case Qt::Key_Return:
1569 case Qt::Key_E: 1571 case Qt::Key_E:
1570 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1572 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1571 mView->newEvent(); 1573 mView->newEvent();
1572 else 1574 else
1573 mView->editIncidence(); 1575 mView->editIncidence();
1574 break; 1576 break;
1575 case Qt::Key_Plus: 1577 case Qt::Key_Plus:
1576 size = p->mHourSize +2; 1578 size = p->mHourSize +2;
1577 if ( size <= 18 ) 1579 if ( size <= 18 )
1578 configureAgenda( size ); 1580 configureAgenda( size );
1579 break; 1581 break;
1580 case Qt::Key_Minus: 1582 case Qt::Key_Minus:
1581 size = p->mHourSize - 2; 1583 size = p->mHourSize - 2;
1582 if ( size >= 4 ) 1584 if ( size >= 4 )
1583 configureAgenda( size ); 1585 configureAgenda( size );
1584 break; 1586 break;
1585 1587
1586 1588
1587 default: 1589 default:
1588 e->ignore(); 1590 e->ignore();
1589 } 1591 }
1590 if ( pro > 0 ) { 1592 if ( pro > 0 ) {
1591 mView->selectFilter( pro-1 ); 1593 mView->selectFilter( pro-1 );
1592 } 1594 }
1593 if ( showSelectedDates ) { 1595 if ( showSelectedDates ) {
1594 ;// setCaptionToDates(); 1596 ;// setCaptionToDates();
1595 } 1597 }
1596 1598
1597} 1599}
1598 1600
1599void MainWindow::fillFilterMenu() 1601void MainWindow::fillFilterMenu()
1600{ 1602{
1601 selectFilterMenu->clear(); 1603 selectFilterMenu->clear();
1602 bool disable = false; 1604 bool disable = false;
1603 if ( mView->filterView()->filtersEnabled() ) { 1605 if ( mView->filterView()->filtersEnabled() ) {
1604 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1606 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1605 } 1607 }
1606 else { 1608 else {
1607 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1609 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1608 disable = true; 1610 disable = true;
1609 } 1611 }
1610 selectFilterMenu->insertSeparator(); 1612 selectFilterMenu->insertSeparator();
1611 QPtrList<CalFilter> fili = mView->filters(); 1613 QPtrList<CalFilter> fili = mView->filters();
1612 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1614 CalFilter *curfilter = mView->filterView()->selectedFilter();
1613 CalFilter *filter = fili.first(); 1615 CalFilter *filter = fili.first();
1614 int iii = 1; 1616 int iii = 1;
1615 while(filter) { 1617 while(filter) {
1616 selectFilterMenu->insertItem( filter->name(), iii ); 1618 selectFilterMenu->insertItem( filter->name(), iii );
1617 if ( filter == curfilter) 1619 if ( filter == curfilter)
1618 selectFilterMenu->setItemChecked( iii, true ); 1620 selectFilterMenu->setItemChecked( iii, true );
1619 if ( disable ) 1621 if ( disable )
1620 selectFilterMenu->setItemEnabled( iii, false ); 1622 selectFilterMenu->setItemEnabled( iii, false );
1621 filter = fili.next(); 1623 filter = fili.next();
1622 ++iii; 1624 ++iii;
1623 } 1625 }
1624} 1626}
1625void MainWindow::selectFilter( int fil ) 1627void MainWindow::selectFilter( int fil )
1626{ 1628{
1627 if ( fil == 0 ) { 1629 if ( fil == 0 ) {
1628 mView->toggleFilerEnabled( ); 1630 mView->toggleFilerEnabled( );
1629 } else { 1631 } else {
1630 mView->selectFilter( fil-1 ); 1632 mView->selectFilter( fil-1 );
1631 } 1633 }
1632} 1634}
1633void MainWindow::configureToolBar( int item ) 1635void MainWindow::configureToolBar( int item )
1634{ 1636{
1635 1637
1636 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1638 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1637 KOPrefs *p = KOPrefs::instance(); 1639 KOPrefs *p = KOPrefs::instance();
1638 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1640 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1639 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1641 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1640 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1642 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1641 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1643 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1642 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1644 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1643 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1645 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1644 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1646 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1645 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1647 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1646 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1648 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1647 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1649 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1648 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1650 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1649 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1651 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1650 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1652 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1651 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1653 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1652 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1654 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1653 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1655 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1654 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1656 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1655 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1657 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1656 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1658 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1657 // initActions(); 1659 // initActions();
1658} 1660}
1659 1661
1660void MainWindow::setCaptionToDates() 1662void MainWindow::setCaptionToDates()
1661{ 1663{
1662 QString selDates; 1664 QString selDates;
1663 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1665 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1664 if (mView->startDate() < mView->endDate() ) 1666 if (mView->startDate() < mView->endDate() )
1665 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1667 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1666 setCaption( i18n("Dates: ") + selDates ); 1668 setCaption( i18n("Dates: ") + selDates );
1667 1669
1668} 1670}
1669// parameter item == 0: reinit 1671// parameter item == 0: reinit
1670void MainWindow::configureAgenda( int item ) 1672void MainWindow::configureAgenda( int item )
1671{ 1673{
1672 1674
1673 KOPrefs *p = KOPrefs::instance(); 1675 KOPrefs *p = KOPrefs::instance();
1674 1676
1675 int i; 1677 int i;
1676 if ( item == 1 ) { 1678 if ( item == 1 ) {
1677 mView->toggleAllDaySize(); 1679 mView->toggleAllDaySize();
1678 return; 1680 return;
1679 } 1681 }
1680 // do not allow 4 for widgets higher than 480 1682 // do not allow 4 for widgets higher than 480
1681 // if ( QApplication::desktop()->height() > 480 ) { 1683 // if ( QApplication::desktop()->height() > 480 ) {
1682// if ( item == 4 ) 1684// if ( item == 4 )
1683// item = 6; 1685// item = 6;
1684// } 1686// }
1685 for ( i = 4; i <= 18; i= i+2 ) 1687 for ( i = 4; i <= 18; i= i+2 )
1686 configureAgendaMenu->setItemChecked( i, false ); 1688 configureAgendaMenu->setItemChecked( i, false );
1687 configureAgendaMenu->setItemChecked( item, true ); 1689 configureAgendaMenu->setItemChecked( item, true );
1688 if ( p->mHourSize == item ) 1690 if ( p->mHourSize == item )
1689 return; 1691 return;
1690 p->mHourSize=item; 1692 p->mHourSize=item;
1691 mView->viewManager()->agendaView()->updateConfig(); 1693 mView->viewManager()->agendaView()->updateConfig();
1692} 1694}
1693 1695
1694void MainWindow::saveCalendar() 1696void MainWindow::saveCalendar()
1695{ 1697{
1696 QString fn = KOPrefs::instance()->mLastSaveFile; 1698 QString fn = KOPrefs::instance()->mLastSaveFile;
1697 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1699 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1698 1700
1699 if ( fn == "" ) 1701 if ( fn == "" )
1700 return; 1702 return;
1701 QFileInfo info; 1703 QFileInfo info;
1702 info.setFile( fn ); 1704 info.setFile( fn );
1703 QString mes; 1705 QString mes;
1704 bool createbup = true; 1706 bool createbup = true;
1705 if ( info. exists() ) { 1707 if ( info. exists() ) {
1706 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1708 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1707 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1709 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1708 i18n("Overwrite!"), i18n("Cancel"), 0, 1710 i18n("Overwrite!"), i18n("Cancel"), 0,
1709 0, 1 ); 1711 0, 1 );
1710 if ( result != 0 ) { 1712 if ( result != 0 ) {
1711 createbup = false; 1713 createbup = false;
1712 } 1714 }
1713 } 1715 }
1714 if ( createbup ) { 1716 if ( createbup ) {
1715 mView->saveCalendar( fn ); 1717 mView->saveCalendar( fn );
1716 mes = i18n("KO/Pi:Saved %1").arg(fn); 1718 mes = i18n("KO/Pi:Saved %1").arg(fn);
1717 KOPrefs::instance()->mLastSaveFile = fn; 1719 KOPrefs::instance()->mLastSaveFile = fn;
1718 setCaption(mes); 1720 setCaption(mes);
1719 } 1721 }
1720} 1722}
1721void MainWindow::loadCalendar() 1723void MainWindow::loadCalendar()
1722{ 1724{
1723 1725
1724 QString fn = KOPrefs::instance()->mLastLoadFile; 1726 QString fn = KOPrefs::instance()->mLastLoadFile;
1725 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1727 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1726 1728
1727 if ( fn == "" ) 1729 if ( fn == "" )
1728 return; 1730 return;
1729 QFileInfo info; 1731 QFileInfo info;
1730 info.setFile( fn ); 1732 info.setFile( fn );
1731 QString mess; 1733 QString mess;
1732 bool loadbup = true; 1734 bool loadbup = true;
1733 if ( info. exists() ) { 1735 if ( info. exists() ) {
1734 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1736 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1735 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1737 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1736 mess, 1738 mess,
1737 i18n("Load!"), i18n("Cancel"), 0, 1739 i18n("Load!"), i18n("Cancel"), 0,
1738 0, 1 ); 1740 0, 1 );
1739 if ( result != 0 ) { 1741 if ( result != 0 ) {
1740 loadbup = false; 1742 loadbup = false;
1741 } 1743 }
1742 } else { 1744 } else {
1743 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1745 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1744 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1746 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1745 0, 1 ); 1747 0, 1 );
1746 1748
1747 return; 1749 return;
1748 } 1750 }
1749 if ( loadbup ) { 1751 if ( loadbup ) {
1750 mView->openCalendar( fn ); 1752 mView->openCalendar( fn );
1751 KOPrefs::instance()->mLastLoadFile = fn; 1753 KOPrefs::instance()->mLastLoadFile = fn;
1752 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1754 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1753 setCaption(mess); 1755 setCaption(mess);
1754 } 1756 }
1755 1757
1756} 1758}
1757void MainWindow::quickImportIcal() 1759void MainWindow::quickImportIcal()
1758{ 1760{
1759 importFile( KOPrefs::instance()->mLastImportFile, false ); 1761 importFile( KOPrefs::instance()->mLastImportFile, false );
1760} 1762}
1761void MainWindow::importFile( QString fn, bool quick ) 1763void MainWindow::importFile( QString fn, bool quick )
1762{ 1764{
1763 QFileInfo info; 1765 QFileInfo info;
1764 info.setFile( fn ); 1766 info.setFile( fn );
1765 QString mess; 1767 QString mess;
1766 bool loadbup = true; 1768 bool loadbup = true;
1767 if ( !info. exists() ) { 1769 if ( !info. exists() ) {
1768 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1770 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1769 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1771 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1770 mess ); 1772 mess );
1771 return; 1773 return;
1772 } 1774 }
1773 int result = 0; 1775 int result = 0;
1774 if ( !quick ) { 1776 if ( !quick ) {
1775 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1777 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1776 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1778 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1777 mess, 1779 mess,
1778 "Import", "Cancel", 0, 1780 "Import", "Cancel", 0,
1779 0, 1 ); 1781 0, 1 );
1780 } 1782 }
1781 if ( result == 0 ) { 1783 if ( result == 0 ) {
1782 if ( mView->openCalendar( fn, true )) { 1784 if ( mView->openCalendar( fn, true )) {
1783 KOPrefs::instance()->mLastImportFile = fn; 1785 KOPrefs::instance()->mLastImportFile = fn;
1784 setCaption(i18n("Imported file successfully")); 1786 setCaption(i18n("Imported file successfully"));
1785 } else { 1787 } else {
1786 setCaption(i18n("Error importing file")); 1788 setCaption(i18n("Error importing file"));
1787 } 1789 }
1788 } 1790 }
1789} 1791}
1790 1792
1791void MainWindow::importIcal() 1793void MainWindow::importIcal()
1792{ 1794{
1793 1795
1794 QString fn =KOPrefs::instance()->mLastImportFile; 1796 QString fn =KOPrefs::instance()->mLastImportFile;
1795 1797
1796 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1798 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1797 if ( fn == "" ) 1799 if ( fn == "" )
1798 return; 1800 return;
1799 importFile( fn, true ); 1801 importFile( fn, true );
1800 1802
1801} 1803}
1802 1804
1803void MainWindow::exportVCalendar() 1805void MainWindow::exportVCalendar()
1804{ 1806{
1805 QString fn = KOPrefs::instance()->mLastVcalFile; 1807 QString fn = KOPrefs::instance()->mLastVcalFile;
1806 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1808 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1807 if ( fn == "" ) 1809 if ( fn == "" )
1808 return; 1810 return;
1809 QFileInfo info; 1811 QFileInfo info;
1810 info.setFile( fn ); 1812 info.setFile( fn );
1811 QString mes; 1813 QString mes;
1812 bool createbup = true; 1814 bool createbup = true;
1813 if ( info. exists() ) { 1815 if ( info. exists() ) {
1814 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1816 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1815 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1817 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1816 i18n("Overwrite!"), i18n("Cancel"), 0, 1818 i18n("Overwrite!"), i18n("Cancel"), 0,
1817 0, 1 ); 1819 0, 1 );
1818 if ( result != 0 ) { 1820 if ( result != 0 ) {
1819 createbup = false; 1821 createbup = false;
1820 } 1822 }
1821 } 1823 }
1822 if ( createbup ) { 1824 if ( createbup ) {
1823 if ( mView->exportVCalendar( fn ) ) { 1825 if ( mView->exportVCalendar( fn ) ) {
1824 KOPrefs::instance()->mLastVcalFile = fn; 1826 KOPrefs::instance()->mLastVcalFile = fn;
1825 if ( fn.length() > 20 ) 1827 if ( fn.length() > 20 )
1826 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1828 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1827 else 1829 else
1828 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1830 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1829 setCaption(mes); 1831 setCaption(mes);
1830 } 1832 }
1831 } 1833 }
1832 1834
1833} 1835}
1834#include <qpushbutton.h> 1836#include <qpushbutton.h>
1835QString MainWindow::getPassword( ) 1837QString MainWindow::getPassword( )
1836{ 1838{
1837 QString retfile = ""; 1839 QString retfile = "";
1838 QDialog dia ( this, "input-dialog", true ); 1840 QDialog dia ( this, "input-dialog", true );
1839 QLineEdit lab ( &dia ); 1841 QLineEdit lab ( &dia );
1840 lab.setEchoMode( QLineEdit::Password ); 1842 lab.setEchoMode( QLineEdit::Password );
1841 QVBoxLayout lay( &dia ); 1843 QVBoxLayout lay( &dia );
1842 lay.setMargin(7); 1844 lay.setMargin(7);
1843 lay.setSpacing(7); 1845 lay.setSpacing(7);
1844 lay.addWidget( &lab); 1846 lay.addWidget( &lab);
1845 dia.setFixedSize( 230,50 ); 1847 dia.setFixedSize( 230,50 );
1846 dia.setCaption( i18n("Enter password") ); 1848 dia.setCaption( i18n("Enter password") );
1847 QPushButton pb ( "OK", &dia); 1849 QPushButton pb ( "OK", &dia);
1848 lay.addWidget( &pb ); 1850 lay.addWidget( &pb );
1849 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1851 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1850 dia.show(); 1852 dia.show();
1851 int res = dia.exec(); 1853 int res = dia.exec();
1852 if ( res ) 1854 if ( res )
1853 retfile = lab.text(); 1855 retfile = lab.text();
1854 dia.hide(); 1856 dia.hide();
1855 qApp->processEvents(); 1857 qApp->processEvents();
1856 return retfile; 1858 return retfile;
1857 1859
1858} 1860}
1859 1861
1860void MainWindow::syncLocalFile() 1862void MainWindow::syncLocalFile()
1861{ 1863{
1862 1864
1863 QString fn =KOPrefs::instance()->mLastSyncedLocalFile; 1865 QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
1864 1866
1865 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 1867 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
1866 if ( fn == "" ) 1868 if ( fn == "" )
1867 return; 1869 return;
1868 //mView->setSyncDevice("local-file" ); 1870 //mView->setSyncDevice("local-file" );
1869 if ( syncWithFile( fn, false ) ) { 1871 if ( syncWithFile( fn, false ) ) {
1870 // Event* e = mView->getLastSyncEvent(); 1872 // Event* e = mView->getLastSyncEvent();
1871// e->setReadOnly( false ); 1873// e->setReadOnly( false );
1872// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 1874// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
1873// e->setReadOnly( true ); 1875// e->setReadOnly( true );
1874 } 1876 }
1875 1877
1876} 1878}
1877 1879
1878bool MainWindow::syncWithFile( QString fn , bool quick ) 1880bool MainWindow::syncWithFile( QString fn , bool quick )
1879{ 1881{
1880 bool ret = false; 1882 bool ret = false;
1881 QFileInfo info; 1883 QFileInfo info;
1882 info.setFile( fn ); 1884 info.setFile( fn );
1883 QString mess; 1885 QString mess;
1884 bool loadbup = true; 1886 bool loadbup = true;
1885 if ( !info. exists() ) { 1887 if ( !info. exists() ) {
1886 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 1888 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
1887 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1889 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1888 mess ); 1890 mess );
1889 return ret; 1891 return ret;
1890 } 1892 }
1891 int result = 0; 1893 int result = 0;
1892 if ( !quick ) { 1894 if ( !quick ) {
1893 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1895 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1894 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1896 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1895 mess, 1897 mess,
1896 i18n("Sync"), i18n("Cancel"), 0, 1898 i18n("Sync"), i18n("Cancel"), 0,
1897 0, 1 ); 1899 0, 1 );
1898 if ( result ) 1900 if ( result )
1899 return false; 1901 return false;
1900 } 1902 }
1901 if ( KOPrefs::instance()->mAskForPreferences ) 1903 if ( KOPrefs::instance()->mAskForPreferences )
1902 mView->edit_sync_options(); 1904 mView->edit_sync_options();
1903 if ( result == 0 ) { 1905 if ( result == 0 ) {
1904 //qDebug("Now sycing ... "); 1906 //qDebug("Now sycing ... ");
1905 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) 1907 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) )
1906 setCaption( i18n("Synchronization successful") ); 1908 setCaption( i18n("Synchronization successful") );
1907 else 1909 else
1908 setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 1910 setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
1909 if ( ! quick ) 1911 if ( ! quick )
1910 KOPrefs::instance()->mLastSyncedLocalFile = fn; 1912 KOPrefs::instance()->mLastSyncedLocalFile = fn;
1911 slotModifiedChanged( true ); 1913 slotModifiedChanged( true );
1912 } 1914 }
1913 return ret; 1915 return ret;
1914} 1916}
1915void MainWindow::quickSyncLocalFile() 1917void MainWindow::quickSyncLocalFile()
1916{ 1918{
1917 //mView->setSyncDevice("local-file" ); 1919 //mView->setSyncDevice("local-file" );
1918 //qDebug("quickSyncLocalFile() "); 1920 //qDebug("quickSyncLocalFile() ");
1919 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { 1921 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
1920 // Event* e = mView->getLastSyncEvent(); 1922 // Event* e = mView->getLastSyncEvent();
1921// e->setReadOnly( false ); 1923// e->setReadOnly( false );
1922// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 1924// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
1923// e->setReadOnly( true ); 1925// e->setReadOnly( true );
1924 1926
1925 } 1927 }
1926} 1928}
1927 1929
1928void MainWindow::confSync() 1930void MainWindow::confSync()
1929{ 1931{
1930 mView->confSync(); 1932 mView->confSync();
1931 fillSyncMenu(); 1933 fillSyncMenu();
1932} 1934}
1933void MainWindow::syncRemote( KSyncProfile* prof, bool ask) 1935void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
1934{ 1936{
1935 QString question; 1937 QString question;
1936 if ( ask ) { 1938 if ( ask ) {
1937 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 1939 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
1938 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1940 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1939 question, 1941 question,
1940 i18n("Yes"), i18n("No"), 1942 i18n("Yes"), i18n("No"),
1941 0, 0 ) != 0 ) 1943 0, 0 ) != 0 )
1942 return; 1944 return;
1943 } 1945 }
1944 QString command = prof->getPreSyncCommand(); 1946 QString command = prof->getPreSyncCommand();
1945 int fi; 1947 int fi;
1946 if ( (fi = command.find("$PWD$")) > 0 ) { 1948 if ( (fi = command.find("$PWD$")) > 0 ) {
1947 QString pwd = getPassword(); 1949 QString pwd = getPassword();
1948 command = command.left( fi )+ pwd + command.mid( fi+5 ); 1950 command = command.left( fi )+ pwd + command.mid( fi+5 );
1949 1951
1950 } 1952 }
1951 int maxlen = 30; 1953 int maxlen = 30;
1952 if ( QApplication::desktop()->width() > 320 ) 1954 if ( QApplication::desktop()->width() > 320 )
1953 maxlen += 25; 1955 maxlen += 25;
1954 setCaption ( i18n( "Copy remote file to local machine..." ) ); 1956 setCaption ( i18n( "Copy remote file to local machine..." ) );
1955 int fileSize = 0; 1957 int fileSize = 0;
1956 int result = system ( command ); 1958 int result = system ( command );
1957 // 0 : okay 1959 // 0 : okay
1958 // 256: no such file or dir 1960 // 256: no such file or dir
1959 // 1961 //
1960 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 1962 qDebug("KO: Remote copy result(0 = okay): %d ",result );
1961 if ( result != 0 ) { 1963 if ( result != 0 ) {
1962 int len = maxlen; 1964 int len = maxlen;
1963 while ( len < command.length() ) { 1965 while ( len < command.length() ) {
1964 command.insert( len , "\n" ); 1966 command.insert( len , "\n" );
1965 len += maxlen +2; 1967 len += maxlen +2;
1966 } 1968 }
1967 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) ; 1969 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) ;
1968 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 1970 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
1969 question, 1971 question,
1970 i18n("Okay!")) ; 1972 i18n("Okay!")) ;
1971 setCaption ("KO/Pi"); 1973 setCaption ("KO/Pi");
1972 return; 1974 return;
1973 } 1975 }
1974 setCaption ( i18n( "Copying succeed." ) ); 1976 setCaption ( i18n( "Copying succeed." ) );
1975 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 1977 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
1976 if ( syncWithFile( prof->getLocalTempFile(), true ) ) { 1978 if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
1977// Event* e = mView->getLastSyncEvent(); 1979// Event* e = mView->getLastSyncEvent();
1978// e->setReadOnly( false ); 1980// e->setReadOnly( false );
1979// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1981// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1980// e->setReadOnly( true ); 1982// e->setReadOnly( true );
1981 if ( KOPrefs::instance()->mWriteBackFile ) { 1983 if ( KOPrefs::instance()->mWriteBackFile ) {
1982 command = prof->getPostSyncCommand(); 1984 command = prof->getPostSyncCommand();
1983 int fi; 1985 int fi;
1984 if ( (fi = command.find("$PWD$")) > 0 ) { 1986 if ( (fi = command.find("$PWD$")) > 0 ) {
1985 QString pwd = getPassword(); 1987 QString pwd = getPassword();
1986 command = command.left( fi )+ pwd + command.mid( fi+5 ); 1988 command = command.left( fi )+ pwd + command.mid( fi+5 );
1987 1989
1988 } 1990 }
1989 setCaption ( i18n( "Writing back file ..." ) ); 1991 setCaption ( i18n( "Writing back file ..." ) );
1990 result = system ( command ); 1992 result = system ( command );
1991 qDebug("KO: Writing back file result: %d ", result); 1993 qDebug("KO: Writing back file result: %d ", result);
1992 if ( result != 0 ) { 1994 if ( result != 0 ) {
1993 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 1995 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
1994 return; 1996 return;
1995 } else { 1997 } else {
1996 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 1998 setCaption ( i18n( "Syncronization sucessfully completed" ) );
1997 } 1999 }
1998 } 2000 }
1999 } 2001 }
2000 return; 2002 return;
2001} 2003}
2002void MainWindow::syncSSH() 2004void MainWindow::syncSSH()
2003{ 2005{
2004 // not used anymore 2006 // not used anymore
2005 QTime timer; 2007 QTime timer;
2006 timer.start(); 2008 timer.start();
2007 //qDebug("MainWindow::syncssh() "); 2009 //qDebug("MainWindow::syncssh() ");
2008 KOPrefs *p = KOPrefs::instance(); 2010 KOPrefs *p = KOPrefs::instance();
2009 QString localFile = p->mLocalTempFile; 2011 QString localFile = p->mLocalTempFile;
2010 QString remoteIP = p->mRemoteIP; 2012 QString remoteIP = p->mRemoteIP;
2011 QString remoteUser = p->mRemoteUser; 2013 QString remoteUser = p->mRemoteUser;
2012 QString remoteFile = p->mRemoteFile; 2014 QString remoteFile = p->mRemoteFile;
2013 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) 2015 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 )
2014 remoteUser += ":" + p->mRemotePassWd; 2016 remoteUser += ":" + p->mRemotePassWd;
2015 2017
2016 QString question = i18n("Do you really want\nto remote sync?\n \n") + 2018 QString question = i18n("Do you really want\nto remote sync?\n \n") +
2017 i18n("IP: " ) +remoteIP +"\n" + 2019 i18n("IP: " ) +remoteIP +"\n" +
2018 i18n("User: " ) + remoteUser +"\n" ; 2020 i18n("User: " ) + remoteUser +"\n" ;
2019 int maxlen = 30; 2021 int maxlen = 30;
2020 if ( QApplication::desktop()->width() > 320 ) 2022 if ( QApplication::desktop()->width() > 320 )
2021 maxlen += 25; 2023 maxlen += 25;
2022 if ( remoteFile.length() > maxlen ) 2024 if ( remoteFile.length() > maxlen )
2023 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; 2025 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n";
2024 else 2026 else
2025 question += i18n("Remote file:\n " ) + remoteFile +"\n"; 2027 question += i18n("Remote file:\n " ) + remoteFile +"\n";
2026 if ( localFile.length() > maxlen ) 2028 if ( localFile.length() > maxlen )
2027 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; 2029 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n";
2028 else 2030 else
2029 question += i18n("Local temp file:\n " ) + localFile +"\n"; 2031 question += i18n("Local temp file:\n " ) + localFile +"\n";
2030 2032
2031 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 2033 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2032 question, 2034 question,
2033 i18n("Yes"), i18n("No"), 2035 i18n("Yes"), i18n("No"),
2034 0, 0 ) != 0 ) 2036 0, 0 ) != 0 )
2035 return; 2037 return;
2036 // if ( !p->mUsePassWd ) { 2038 // if ( !p->mUsePassWd ) {
2037 // QString pass = getPassword(); 2039 // QString pass = getPassword();
2038 // if ( pass.length() > 0 ) 2040 // if ( pass.length() > 0 )
2039 // remoteUser += ":" + pass; 2041 // remoteUser += ":" + pass;
2040 // } 2042 // }
2041 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; 2043 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile;
2042 setCaption ( i18n( "Copy remote file to local machine..." ) ); 2044 setCaption ( i18n( "Copy remote file to local machine..." ) );
2043 int fileSize = 0; 2045 int fileSize = 0;
2044 int result = system ( command ); 2046 int result = system ( command );
2045 // 0 : okay 2047 // 0 : okay
2046 // 256: no such file or dir 2048 // 256: no such file or dir
2047 // 2049 //
2048 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 2050 qDebug("KO: Remote copy result(0 = okay): %d ",result );
2049 if ( result != 0 ) { 2051 if ( result != 0 ) {
2050 int len = maxlen; 2052 int len = maxlen;
2051 while ( len < command.length() ) { 2053 while ( len < command.length() ) {
2052 command.insert( len , "\n" ); 2054 command.insert( len , "\n" );
2053 len += maxlen +2; 2055 len += maxlen +2;
2054 } 2056 }
2055 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) ; 2057 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) ;
2056 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2058 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2057 question, 2059 question,
2058 i18n("Okay!")) ; 2060 i18n("Okay!")) ;
2059 setCaption ("KO/Pi"); 2061 setCaption ("KO/Pi");
2060 return; 2062 return;
2061 } 2063 }
2062 2064
2063 2065
2064 setCaption ( i18n( "Copying succeed." ) ); 2066 setCaption ( i18n( "Copying succeed." ) );
2065 //mView->setSyncDevice("ssh-scp" ); 2067 //mView->setSyncDevice("ssh-scp" );
2066 if ( syncWithFile(localFile , true ) ) { 2068 if ( syncWithFile(localFile , true ) ) {
2067// Event* e = mView->getLastSyncEvent(); 2069// Event* e = mView->getLastSyncEvent();
2068// e->setReadOnly( false ); 2070// e->setReadOnly( false );
2069// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 2071// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2070// e->setReadOnly( true ); 2072// e->setReadOnly( true );
2071 if ( KOPrefs::instance()->mWriteBackFile ) { 2073 if ( KOPrefs::instance()->mWriteBackFile ) {
2072 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; 2074 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ;
2073 setCaption ( i18n( "Writing back file ..." ) ); 2075 setCaption ( i18n( "Writing back file ..." ) );
2074 result = system ( command ); 2076 result = system ( command );
2075 if ( result != 0 ) { 2077 if ( result != 0 ) {
2076 int len = maxlen; 2078 int len = maxlen;
2077 while ( len < command.length() ) { 2079 while ( len < command.length() ) {
2078 command.insert( len , "\n" ); 2080 command.insert( len , "\n" );
2079 len += maxlen +2; 2081 len += maxlen +2;
2080 } 2082 }
2081 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 2083 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
2082 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2084 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2083 question, 2085 question,
2084 i18n("Okay!")) ; 2086 i18n("Okay!")) ;
2085 setCaption ("KO/Pi"); 2087 setCaption ("KO/Pi");
2086 return; 2088 return;
2087 } else { 2089 } else {
2088 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 2090 setCaption ( i18n( "Syncronization sucessfully completed" ) );
2089 } 2091 }
2090 } 2092 }
2091 } 2093 }
2092 return; 2094 return;
2093#if 0 2095#if 0
2094 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); 2096 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics");
2095 while ( timer.elapsed() < 5000 ) 2097 while ( timer.elapsed() < 5000 )
2096 qApp->processEvents(); 2098 qApp->processEvents();
2097 2099
2098 qDebug("MainWindow::merging) "); 2100 qDebug("MainWindow::merging) ");
2099 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); 2101 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 );
2100 while ( mBlockSaveFlag ) 2102 while ( mBlockSaveFlag )
2101 qApp->processEvents(); 2103 qApp->processEvents();
2102 save(); 2104 save();
2103 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); 2105 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics");
2104#endif 2106#endif
2105 2107
2106} 2108}
2107 2109
2108 2110
2109void MainWindow::syncSharp() 2111void MainWindow::syncSharp()
2110{ 2112{
2111 if ( mCalendarModifiedFlag ) 2113 if ( mCalendarModifiedFlag )
2112 save(); 2114 save();
2113 mView->syncSharp(); 2115 mView->syncSharp();
2114 slotModifiedChanged( true ); 2116 slotModifiedChanged( true );
2115 2117
2116} 2118}
2117void MainWindow::syncPhone() 2119void MainWindow::syncPhone()
2118{ 2120{
2119 if ( mCalendarModifiedFlag ) 2121 if ( mCalendarModifiedFlag )
2120 save(); 2122 save();
2121 mView->syncPhone(); 2123 mView->syncPhone();
2122 slotModifiedChanged( true ); 2124 slotModifiedChanged( true );
2123 2125
2124} 2126}
2125 2127
2126void MainWindow::printSel( ) 2128void MainWindow::printSel( )
2127{ 2129{
2128 mView->viewManager()->agendaView()->agenda()->printSelection(); 2130 mView->viewManager()->agendaView()->agenda()->printSelection();
2129} 2131}
2130 2132
2131void MainWindow::printCal() 2133void MainWindow::printCal()
2132{ 2134{
2133 mView->print();//mCp->showDialog(); 2135 mView->print();//mCp->showDialog();
2134} 2136}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 00a07d9..2819ab1 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,771 +1,771 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qbuttongroup.h> 37#include <qbuttongroup.h>
38#include <qfile.h> 38#include <qfile.h>
39 39
40#include <kdialog.h> 40#include <kdialog.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdateedit.h> 42#include <kdateedit.h>
43#include <kglobal.h> 43#include <kglobal.h>
44#include <stdlib.h> 44#include <stdlib.h>
45 45
46/*US 46/*US
47#include <qcheckbox.h> 47#include <qcheckbox.h>
48#include <qframe.h> 48#include <qframe.h>
49#include <qpushbutton.h> 49#include <qpushbutton.h>
50#include <qcombobox.h> 50#include <qcombobox.h>
51#include <qlineedit.h> 51#include <qlineedit.h>
52#include <qlabel.h> 52#include <qlabel.h>
53#include <qfile.h> 53#include <qfile.h>
54 54
55#include <kconfig.h> 55#include <kconfig.h>
56#include <kdebug.h> 56#include <kdebug.h>
57#include <kdialog.h> 57#include <kdialog.h>
58#include <klistview.h> 58#include <klistview.h>
59#include <klocale.h> 59#include <klocale.h>
60#include <kglobal.h> 60#include <kglobal.h>
61#include <kmessagebox.h> 61#include <kmessagebox.h>
62#include <kstandarddirs.h> 62#include <kstandarddirs.h>
63 63
64#ifndef KAB_EMBEDDED 64#ifndef KAB_EMBEDDED
65#include <ktrader.h> 65#include <ktrader.h>
66#else // KAB_EMBEDDED 66#else // KAB_EMBEDDED
67#include <mergewidget.h> 67#include <mergewidget.h>
68#include <distributionlistwidget.h> 68#include <distributionlistwidget.h>
69#endif // KAB_EMBEDDED 69#endif // KAB_EMBEDDED
70 70
71#include "addresseewidget.h" 71#include "addresseewidget.h"
72#include "extensionconfigdialog.h" 72#include "extensionconfigdialog.h"
73#include "extensionwidget.h" 73#include "extensionwidget.h"
74*/ 74*/
75 75
76#include "qapplication.h" 76#include "qapplication.h"
77 77
78#include "kpimglobalprefs.h" 78#include "kpimglobalprefs.h"
79 79
80#include "kdepimconfigwidget.h" 80#include "kdepimconfigwidget.h"
81 81
82 82
83KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 83KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
84 : KPrefsWidget(prefs, parent, name ) 84 : KPrefsWidget(prefs, parent, name )
85{ 85{
86 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 86 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
87 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 87 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
88 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 88 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
89 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 89 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
90 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 90 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
91 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 91 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
92 92
93 93
94 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 94 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
95 KDialog::spacingHint() ); 95 KDialog::spacingHint() );
96 96
97 tabWidget = new QTabWidget( this ); 97 tabWidget = new QTabWidget( this );
98 topLayout->addWidget( tabWidget ); 98 topLayout->addWidget( tabWidget );
99 99
100 100
101 setupLocaleTab(); 101 setupLocaleTab();
102 setupLocaleDateTab(); 102 setupLocaleDateTab();
103 setupTimeZoneTab(); 103 setupTimeZoneTab();
104 setupExternalAppTab(); 104 setupExternalAppTab();
105 105
106} 106}
107 107
108void KDEPIMConfigWidget::setupExternalAppTab() 108void KDEPIMConfigWidget::setupExternalAppTab()
109{ 109{
110 QWidget *externalAppsPage = new QWidget( this ); 110 QWidget *externalAppsPage = new QWidget( this );
111 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 111 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
112 KDialog::spacingHintSmall() ); 112 KDialog::spacingHintSmall() );
113 113
114 mExternalApps = new QComboBox( externalAppsPage ); 114 mExternalApps = new QComboBox( externalAppsPage );
115 115
116 QMap<ExternalAppHandler::Types, QString>::Iterator it; 116 QMap<ExternalAppHandler::Types, QString>::Iterator it;
117 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 117 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
118 mExternalApps->insertItem( it.data(), it.key() ); 118 mExternalApps->insertItem( it.data(), it.key() );
119 119
120 layout->addWidget( mExternalApps ); 120 layout->addWidget( mExternalApps );
121 121
122 connect( mExternalApps, SIGNAL( activated( int ) ), 122 connect( mExternalApps, SIGNAL( activated( int ) ),
123 this, SLOT (externalapp_changed( int ) ) ); 123 this, SLOT (externalapp_changed( int ) ) );
124 124
125 125
126 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 126 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
127 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 127 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
128 128
129 129
130 mClient = new QComboBox( mExternalAppGroupBox ); 130 mClient = new QComboBox( mExternalAppGroupBox );
131 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 131 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
132 132
133 connect( mClient, SIGNAL( activated( int ) ), 133 connect( mClient, SIGNAL( activated( int ) ),
134 this, SLOT (client_changed( int ) ) ); 134 this, SLOT (client_changed( int ) ) );
135 135
136 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 136 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
137 boxLayout->addWidget( lab, 1, 0 ); 137 boxLayout->addWidget( lab, 1, 0 );
138 mChannel = new QLineEdit(mExternalAppGroupBox); 138 mChannel = new QLineEdit(mExternalAppGroupBox);
139 mChannel->setReadOnly(true); 139 mChannel->setReadOnly(true);
140 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 140 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
141 141
142 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 142 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
143 boxLayout->addWidget( lab, 3, 0 ); 143 boxLayout->addWidget( lab, 3, 0 );
144 mMessage = new QLineEdit(mExternalAppGroupBox); 144 mMessage = new QLineEdit(mExternalAppGroupBox);
145 mMessage->setReadOnly(true); 145 mMessage->setReadOnly(true);
146 boxLayout->addWidget( mMessage , 4, 0); 146 boxLayout->addWidget( mMessage , 4, 0);
147 147
148 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 148 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
149 boxLayout->addWidget( lab, 3, 1 ); 149 boxLayout->addWidget( lab, 3, 1 );
150 mParameters = new QLineEdit(mExternalAppGroupBox); 150 mParameters = new QLineEdit(mExternalAppGroupBox);
151 mParameters->setReadOnly(true); 151 mParameters->setReadOnly(true);
152 boxLayout->addWidget( mParameters, 4, 1 ); 152 boxLayout->addWidget( mParameters, 4, 1 );
153 153
154 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 154 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
155 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 155 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
156 156
157 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 157 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
158 boxLayout->addWidget( lab, 6, 0 ); 158 boxLayout->addWidget( lab, 6, 0 );
159 mMessage2 = new QLineEdit(mExternalAppGroupBox); 159 mMessage2 = new QLineEdit(mExternalAppGroupBox);
160 mMessage2->setReadOnly(true); 160 mMessage2->setReadOnly(true);
161 boxLayout->addWidget( mMessage2 , 7, 0); 161 boxLayout->addWidget( mMessage2 , 7, 0);
162 162
163 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 163 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
164 boxLayout->addWidget( lab, 6, 1 ); 164 boxLayout->addWidget( lab, 6, 1 );
165 mParameters2 = new QLineEdit(mExternalAppGroupBox); 165 mParameters2 = new QLineEdit(mExternalAppGroupBox);
166 mParameters2->setReadOnly(true); 166 mParameters2->setReadOnly(true);
167 boxLayout->addWidget( mParameters2, 7, 1 ); 167 boxLayout->addWidget( mParameters2, 7, 1 );
168 168
169 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 169 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
170 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 170 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
171 171
172 172
173 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 173 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
174 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 174 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
175 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 175 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
176 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 176 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
177 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 177 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
178 178
179 179
180 layout->addWidget( mExternalAppGroupBox ); 180 layout->addWidget( mExternalAppGroupBox );
181 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 181 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
182 182
183} 183}
184 184
185 185
186void KDEPIMConfigWidget::setupLocaleDateTab() 186void KDEPIMConfigWidget::setupLocaleDateTab()
187{ 187{
188 QWidget *topFrame = new QWidget( this ); 188 QWidget *topFrame = new QWidget( this );
189 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); 189 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
190 190
191 topLayout->setSpacing(KDialog::spacingHint()); 191 topLayout->setSpacing(KDialog::spacingHint());
192 topLayout->setMargin(KDialog::marginHint()); 192 topLayout->setMargin(KDialog::marginHint());
193 int iii = 0; 193 int iii = 0;
194 194
195 195
196 KPrefsWidRadios *syncPrefsGroup = 196 KPrefsWidRadios *syncPrefsGroup =
197 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); 197 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
198 QString format; 198 QString format;
199 if ( QApplication::desktop()->width() < 480 ) 199 if ( QApplication::desktop()->width() < 480 )
200 format = "(%d.%m.%Y)"; 200 format = "(%d.%m.%Y)";
201 else 201 else
202 format = "(%d.%m.%Y|%A %d %B %Y)"; 202 format = "(%d.%m.%Y|%A %d %B %Y)";
203 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 203 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
204 if ( QApplication::desktop()->width() < 480 ) 204 if ( QApplication::desktop()->width() < 480 )
205 format = "(%m.%d.%Y)"; 205 format = "(%m.%d.%Y)";
206 else 206 else
207 format = "(%m.%d.%Y|%A %B %d %Y)"; 207 format = "(%m.%d.%Y|%A %B %d %Y)";
208 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 208 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
209 if ( QApplication::desktop()->width() < 480 ) 209 if ( QApplication::desktop()->width() < 480 )
210 format = "(%Y-%m-%d)"; 210 format = "(%Y-%m-%d)";
211 else 211 else
212 format = "(%Y-%m-%d|%A %Y %B %d)"; 212 format = "(%Y-%m-%d|%A %Y %B %d)";
213 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 213 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
214 syncPrefsGroup->addRadio(i18n("User defined")); 214 syncPrefsGroup->addRadio(i18n("User defined"));
215 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 215 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
216 ++iii; 216 ++iii;
217 ++iii; 217 ++iii;
218 QLabel * lab; 218 QLabel * lab;
219 mUserDateFormatLong = new QLineEdit(topFrame); 219 mUserDateFormatLong = new QLineEdit(topFrame);
220 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 220 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
221 topLayout->addWidget(lab ,iii,0); 221 topLayout->addWidget(lab ,iii,0);
222 topLayout->addWidget(mUserDateFormatLong,iii,1); 222 topLayout->addWidget(mUserDateFormatLong,iii,1);
223 ++iii; 223 ++iii;
224 mUserDateFormatShort = new QLineEdit(topFrame); 224 mUserDateFormatShort = new QLineEdit(topFrame);
225 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 225 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
226 topLayout->addWidget(lab ,iii,0); 226 topLayout->addWidget(lab ,iii,0);
227 topLayout->addWidget(mUserDateFormatShort,iii,1); 227 topLayout->addWidget(mUserDateFormatShort,iii,1);
228 ++iii; 228 ++iii;
229 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 229 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
230 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 230 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
231 ++iii; 231 ++iii;
232 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 232 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
233 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 233 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
234 ++iii; 234 ++iii;
235 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 235 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
236 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 236 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
237 ++iii; 237 ++iii;
238 238
239 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 239 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
240 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 240 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
241 241
242 242
243 tabWidget->addTab( topFrame, i18n( "Date Format" ) ); 243 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
244} 244}
245 245
246void KDEPIMConfigWidget::setupLocaleTab() 246void KDEPIMConfigWidget::setupLocaleTab()
247{ 247{
248 248
249 QWidget *topFrame = new QWidget( this ); 249 QWidget *topFrame = new QWidget( this );
250 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 250 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
251 251
252 topLayout->setSpacing(KDialog::spacingHint()); 252 topLayout->setSpacing(KDialog::spacingHint());
253 topLayout->setMargin(KDialog::marginHint()); 253 topLayout->setMargin(KDialog::marginHint());
254 int iii = 0; 254 int iii = 0;
255 KPrefsWidRadios *syncPrefsGroup = 255 KPrefsWidRadios *syncPrefsGroup =
256 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); 256 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
257 syncPrefsGroup->addRadio(i18n("English")); 257 syncPrefsGroup->addRadio(i18n("English"));
258 syncPrefsGroup->addRadio(i18n("German")); 258 syncPrefsGroup->addRadio(i18n("German"));
259 syncPrefsGroup->addRadio(i18n("French")); 259 syncPrefsGroup->addRadio(i18n("French"));
260 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 260 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
261 if ( QApplication::desktop()->width() < 300 ) 261 if ( QApplication::desktop()->width() < 300 )
262 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 262 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
263 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); 263 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
264 ++iii; 264 ++iii;
265 265
266 syncPrefsGroup = 266 syncPrefsGroup =
267 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); 267 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
268 if ( QApplication::desktop()->width() > 300 ) 268 if ( QApplication::desktop()->width() > 300 )
269 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 269 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
270 syncPrefsGroup->addRadio(i18n("24:00")); 270 syncPrefsGroup->addRadio(i18n("24:00"));
271 syncPrefsGroup->addRadio(i18n("12:00am")); 271 syncPrefsGroup->addRadio(i18n("12:00am"));
272 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); 272 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
273 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 273 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
274 ++iii; 274 ++iii;
275 275
276 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), 276 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
277 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); 277 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
278 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 278 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
279 ++iii; 279 ++iii;
280 280
281 281
282 tabWidget->addTab( topFrame, i18n( "Locale" ) ); 282 tabWidget->addTab( topFrame, i18n( "Locale" ) );
283 283
284} 284}
285 285
286 286
287void KDEPIMConfigWidget::setupTimeZoneTab() 287void KDEPIMConfigWidget::setupTimeZoneTab()
288{ 288{
289 QWidget *topFrame = new QWidget( this ); 289 QWidget *topFrame = new QWidget( this );
290 QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2); 290 QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2);
291 topLayout->setSpacing(KDialog::spacingHint()); 291 topLayout->setSpacing(KDialog::spacingHint());
292 topLayout->setMargin(KDialog::marginHint()); 292 topLayout->setMargin(KDialog::marginHint());
293 293
294 QHBox *timeZoneBox = new QHBox( topFrame ); 294 QHBox *timeZoneBox = new QHBox( topFrame );
295 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 295 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
296 296
297 new QLabel( i18n("Timezone:"), timeZoneBox ); 297 new QLabel( i18n("Timezone:"), timeZoneBox );
298 mTimeZoneCombo = new QComboBox( timeZoneBox ); 298 mTimeZoneCombo = new QComboBox( timeZoneBox );
299 if ( QApplication::desktop()->width() < 300 ) { 299 if ( QApplication::desktop()->width() < 300 ) {
300 mTimeZoneCombo->setMaximumWidth(150); 300 mTimeZoneCombo->setMaximumWidth(150);
301 } 301 }
302 302
303 QStringList list; 303 QStringList list;
304 list = KGlobal::locale()->timeZoneList(); 304 list = KGlobal::locale()->timeZoneList();
305 mTimeZoneCombo->insertStringList(list); 305 mTimeZoneCombo->insertStringList(list);
306 306
307 // find the currently set time zone and select it 307 // find the currently set time zone and select it
308 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; 308 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
309 int nCurrentlySet = 11; 309 int nCurrentlySet = 11;
310 for (int i = 0; i < mTimeZoneCombo->count(); i++) 310 for (int i = 0; i < mTimeZoneCombo->count(); i++)
311 { 311 {
312 if (mTimeZoneCombo->text(i) == sCurrentlySet) 312 if (mTimeZoneCombo->text(i) == sCurrentlySet)
313 { 313 {
314 nCurrentlySet = i; 314 nCurrentlySet = i;
315 break; 315 break;
316 } 316 }
317 } 317 }
318 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 318 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
319 int iii = 1; 319 int iii = 1;
320 KPrefsWidBool *sb = 320 KPrefsWidBool *sb =
321 addWidBool(i18n("Timezone has daylight saving"), 321 addWidBool(i18n("Timezone has daylight saving"),
322 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); 322 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
323 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); 323 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
324 ++iii; 324 ++iii;
325 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 325 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
326 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 326 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
327 ++iii; 327 ++iii;
328 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 328 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
329 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 329 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
330 ++iii; 330 ++iii;
331 lab = new QLabel( i18n("Daylight start:"), topFrame ); 331 lab = new QLabel( i18n("Daylight start:"), topFrame );
332 topLayout->addWidget(lab, iii,0); 332 topLayout->addWidget(lab, iii,0);
333 mStartDateSavingEdit = new KDateEdit(topFrame); 333 mStartDateSavingEdit = new KDateEdit(topFrame);
334 topLayout->addWidget(mStartDateSavingEdit, iii,1); 334 topLayout->addWidget(mStartDateSavingEdit, iii,1);
335 ++iii; 335 ++iii;
336 336
337 lab = new QLabel( i18n("Daylight end:"), topFrame ); 337 lab = new QLabel( i18n("Daylight end:"), topFrame );
338 topLayout->addWidget(lab, iii,0); 338 topLayout->addWidget(lab, iii,0);
339 mEndDateSavingEdit = new KDateEdit(topFrame); 339 mEndDateSavingEdit = new KDateEdit(topFrame);
340 topLayout->addWidget(mEndDateSavingEdit, iii,1); 340 topLayout->addWidget(mEndDateSavingEdit, iii,1);
341 ++iii; 341 ++iii;
342 QDate current ( 2001, 1,1); 342 QDate current ( 2001, 1,1);
343 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); 343 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
344 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); 344 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
345 345
346 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 346 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
347 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); 347 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
348 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); 348 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
349 349
350 350
351 351
352 tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); 352 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
353 353
354} 354}
355 355
356void KDEPIMConfigWidget::externalapp_changed( int newApp ) 356void KDEPIMConfigWidget::externalapp_changed( int newApp )
357{ 357{
358 // first store the current data 358 // first store the current data
359 saveEditFieldSettings(); 359 saveEditFieldSettings();
360 360
361 // set mCurrentApp 361 // set mCurrentApp
362 mCurrentApp = (ExternalAppHandler::Types)newApp; 362 mCurrentApp = (ExternalAppHandler::Types)newApp;
363 363
364 // set mCurrentClient 364 // set mCurrentClient
365 switch(mCurrentApp) 365 switch(mCurrentApp)
366 { 366 {
367 case(ExternalAppHandler::EMAIL): 367 case(ExternalAppHandler::EMAIL):
368 mCurrentClient = mEmailClient; 368 mCurrentClient = mEmailClient;
369 break; 369 break;
370 case(ExternalAppHandler::PHONE): 370 case(ExternalAppHandler::PHONE):
371 mCurrentClient = mPhoneClient; 371 mCurrentClient = mPhoneClient;
372 break; 372 break;
373 case(ExternalAppHandler::SMS): 373 case(ExternalAppHandler::SMS):
374 mCurrentClient = mSMSClient; 374 mCurrentClient = mSMSClient;
375 break; 375 break;
376 case(ExternalAppHandler::FAX): 376 case(ExternalAppHandler::FAX):
377 mCurrentClient = mFaxClient; 377 mCurrentClient = mFaxClient;
378 break; 378 break;
379 case(ExternalAppHandler::PAGER): 379 case(ExternalAppHandler::PAGER):
380 mCurrentClient = mPagerClient; 380 mCurrentClient = mPagerClient;
381 break; 381 break;
382 case(ExternalAppHandler::SIP): 382 case(ExternalAppHandler::SIP):
383 mCurrentClient = mSipClient; 383 mCurrentClient = mSipClient;
384 break; 384 break;
385 default: 385 default:
386 return; 386 return;
387 } 387 }
388 388
389 // and at last update the widgets 389 // and at last update the widgets
390 updateClientWidgets(); 390 updateClientWidgets();
391} 391}
392 392
393 393
394 394
395void KDEPIMConfigWidget::client_changed( int newClient ) 395void KDEPIMConfigWidget::client_changed( int newClient )
396{ 396{
397 if (newClient == mCurrentClient) 397 if (newClient == mCurrentClient)
398 return; 398 return;
399 399
400 // first store the current data 400 // first store the current data
401 saveEditFieldSettings(); 401 saveEditFieldSettings();
402 402
403 403
404 //then reset the clientvariable 404 //then reset the clientvariable
405 mCurrentClient = newClient; 405 mCurrentClient = newClient;
406 406
407 // and at last update the widgets 407 // and at last update the widgets
408 updateClientWidgets(); 408 updateClientWidgets();
409 409
410 KPrefsWidget::modified(); 410 KPrefsWidget::modified();
411} 411}
412 412
413void KDEPIMConfigWidget::saveEditFieldSettings() 413void KDEPIMConfigWidget::saveEditFieldSettings()
414{ 414{
415 415
416 switch(mCurrentApp) 416 switch(mCurrentApp)
417 { 417 {
418 case(ExternalAppHandler::EMAIL): 418 case(ExternalAppHandler::EMAIL):
419 mEmailClient = mClient->currentItem(); 419 mEmailClient = mClient->currentItem();
420 break; 420 break;
421 case(ExternalAppHandler::PHONE): 421 case(ExternalAppHandler::PHONE):
422 mPhoneClient= mClient->currentItem(); 422 mPhoneClient= mClient->currentItem();
423 break; 423 break;
424 case(ExternalAppHandler::SMS): 424 case(ExternalAppHandler::SMS):
425 mSMSClient = mClient->currentItem(); 425 mSMSClient = mClient->currentItem();
426 break; 426 break;
427 case(ExternalAppHandler::FAX): 427 case(ExternalAppHandler::FAX):
428 mFaxClient = mClient->currentItem(); 428 mFaxClient = mClient->currentItem();
429 break; 429 break;
430 case(ExternalAppHandler::PAGER): 430 case(ExternalAppHandler::PAGER):
431 mPagerClient = mClient->currentItem(); 431 mPagerClient = mClient->currentItem();
432 break; 432 break;
433 case(ExternalAppHandler::SIP): 433 case(ExternalAppHandler::SIP):
434 mSipClient = mClient->currentItem(); 434 mSipClient = mClient->currentItem();
435 break; 435 break;
436 default: 436 default:
437 return; 437 return;
438 } 438 }
439 439
440 //store the current data back to the apropriate membervariables if we had set it to "other" 440 //store the current data back to the apropriate membervariables if we had set it to "other"
441 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 441 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
442 { 442 {
443 mEmailOtherChannel = mChannel->text(); 443 mEmailOtherChannel = mChannel->text();
444 mEmailOtherMessage = mMessage->text(); 444 mEmailOtherMessage = mMessage->text();
445 mEmailOtherMessageParameters = mParameters->text(); 445 mEmailOtherMessageParameters = mParameters->text();
446 mEmailOtherMessage2 = mMessage2->text(); 446 mEmailOtherMessage2 = mMessage2->text();
447 mEmailOtherMessageParameters2 = mParameters2->text(); 447 mEmailOtherMessageParameters2 = mParameters2->text();
448 } 448 }
449 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 449 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
450 { 450 {
451 mPhoneOtherChannel = mChannel->text(); 451 mPhoneOtherChannel = mChannel->text();
452 mPhoneOtherMessage = mMessage->text(); 452 mPhoneOtherMessage = mMessage->text();
453 mPhoneOtherMessageParameters = mParameters->text(); 453 mPhoneOtherMessageParameters = mParameters->text();
454 } 454 }
455 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 455 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
456 { 456 {
457 mSMSOtherChannel = mChannel->text(); 457 mSMSOtherChannel = mChannel->text();
458 mSMSOtherMessage = mMessage->text(); 458 mSMSOtherMessage = mMessage->text();
459 mSMSOtherMessageParameters = mParameters->text(); 459 mSMSOtherMessageParameters = mParameters->text();
460 } 460 }
461 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 461 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
462 { 462 {
463 mFaxOtherChannel = mChannel->text(); 463 mFaxOtherChannel = mChannel->text();
464 mFaxOtherMessage = mMessage->text(); 464 mFaxOtherMessage = mMessage->text();
465 mFaxOtherMessageParameters = mParameters->text(); 465 mFaxOtherMessageParameters = mParameters->text();
466 } 466 }
467 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 467 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
468 { 468 {
469 mPagerOtherChannel = mChannel->text(); 469 mPagerOtherChannel = mChannel->text();
470 mPagerOtherMessage = mMessage->text(); 470 mPagerOtherMessage = mMessage->text();
471 mPagerOtherMessageParameters = mParameters->text(); 471 mPagerOtherMessageParameters = mParameters->text();
472 } 472 }
473 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 473 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
474 { 474 {
475 mSipOtherChannel = mChannel->text(); 475 mSipOtherChannel = mChannel->text();
476 mSipOtherMessage = mMessage->text(); 476 mSipOtherMessage = mMessage->text();
477 mSipOtherMessageParameters = mParameters->text(); 477 mSipOtherMessageParameters = mParameters->text();
478 } 478 }
479 479
480 480
481} 481}
482 482
483void KDEPIMConfigWidget::updateClientWidgets() 483void KDEPIMConfigWidget::updateClientWidgets()
484{ 484{
485 bool blocked = signalsBlocked(); 485 bool blocked = signalsBlocked();
486 blockSignals( true ); 486 blockSignals( true );
487 487
488 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display 488 // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
489 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); 489 QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
490 if (it == mExternalAppsMap.end()) 490 if (it == mExternalAppsMap.end())
491 return; 491 return;
492 492
493 // update group box 493 // update group box
494 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); 494 mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
495 495
496 //update the entries in the client combobox 496 //update the entries in the client combobox
497 mClient->clear(); 497 mClient->clear();
498 498
499 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); 499 QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
500 DefaultAppItem* dai; 500 DefaultAppItem* dai;
501 for ( dai=items.first(); dai != 0; dai=items.next() ) 501 for ( dai=items.first(); dai != 0; dai=items.next() )
502 { 502 {
503 mClient->insertItem( i18n(dai->_label), dai->_id ); 503 mClient->insertItem( i18n(dai->_label), dai->_id );
504 504
505 if (dai->_id == mCurrentClient) 505 if (dai->_id == mCurrentClient)
506 { 506 {
507 //restore the edit fields with the data of the local membervariables if we had set it to "other". 507 //restore the edit fields with the data of the local membervariables if we had set it to "other".
508 //Otherwise take the default data from externalapphandler. 508 //Otherwise take the default data from externalapphandler.
509 mChannel->setText(dai->_channel); 509 mChannel->setText(dai->_channel);
510 mMessage->setText(dai->_message); 510 mMessage->setText(dai->_message);
511 mParameters->setText(dai->_parameters); 511 mParameters->setText(dai->_parameters);
512 mMessage2->setText(dai->_message2); 512 mMessage2->setText(dai->_message2);
513 mParameters2->setText(dai->_parameters2); 513 mParameters2->setText(dai->_parameters2);
514 514
515 515
516 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 516 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
517 { 517 {
518 mChannel->setText(mEmailOtherChannel); 518 mChannel->setText(mEmailOtherChannel);
519 mMessage->setText(mEmailOtherMessage); 519 mMessage->setText(mEmailOtherMessage);
520 mParameters->setText(mEmailOtherMessageParameters); 520 mParameters->setText(mEmailOtherMessageParameters);
521 mMessage2->setText(mEmailOtherMessage2); 521 mMessage2->setText(mEmailOtherMessage2);
522 mParameters2->setText(mEmailOtherMessageParameters2); 522 mParameters2->setText(mEmailOtherMessageParameters2);
523 } 523 }
524 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 524 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
525 { 525 {
526 mChannel->setText(mPhoneOtherChannel); 526 mChannel->setText(mPhoneOtherChannel);
527 mMessage->setText(mPhoneOtherMessage); 527 mMessage->setText(mPhoneOtherMessage);
528 mParameters->setText(mPhoneOtherMessageParameters); 528 mParameters->setText(mPhoneOtherMessageParameters);
529 } 529 }
530 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 530 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
531 { 531 {
532 mChannel->setText(mSMSOtherChannel); 532 mChannel->setText(mSMSOtherChannel);
533 mMessage->setText(mSMSOtherMessage); 533 mMessage->setText(mSMSOtherMessage);
534 mParameters->setText(mSMSOtherMessageParameters); 534 mParameters->setText(mSMSOtherMessageParameters);
535 } 535 }
536 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 536 else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
537 { 537 {
538 mChannel->setText(mFaxOtherChannel); 538 mChannel->setText(mFaxOtherChannel);
539 mMessage->setText(mFaxOtherMessage); 539 mMessage->setText(mFaxOtherMessage);
540 mParameters->setText(mFaxOtherMessageParameters); 540 mParameters->setText(mFaxOtherMessageParameters);
541 } 541 }
542 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 542 else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
543 { 543 {
544 mChannel->setText(mPagerOtherChannel); 544 mChannel->setText(mPagerOtherChannel);
545 mMessage->setText(mPagerOtherMessage); 545 mMessage->setText(mPagerOtherMessage);
546 mParameters->setText(mPagerOtherMessageParameters); 546 mParameters->setText(mPagerOtherMessageParameters);
547 } 547 }
548 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) 548 else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
549 { 549 {
550 mChannel->setText(mSipOtherChannel); 550 mChannel->setText(mSipOtherChannel);
551 mMessage->setText(mSipOtherMessage); 551 mMessage->setText(mSipOtherMessage);
552 mParameters->setText(mSipOtherMessageParameters); 552 mParameters->setText(mSipOtherMessageParameters);
553 } 553 }
554 } 554 }
555 555
556 } 556 }
557 557
558 bool readonly; 558 bool readonly;
559 bool enabled; 559 bool enabled;
560 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 560 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
561 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 561 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
562 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 562 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
563 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) 563 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC))
564 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) 564 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
565 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) 565 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)))
566 { 566 {
567 readonly = false; 567 readonly = false;
568 } 568 }
569 else 569 else
570 { 570 {
571 readonly = true; 571 readonly = true;
572 } 572 }
573 573
574 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) 574 if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC))
575 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) 575 ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC))
576 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) 576 ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC))
577 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) 577 ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC))
578 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 578 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
579 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 579 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
580 { 580 {
581 enabled = false; 581 enabled = false;
582 } 582 }
583 else 583 else
584 { 584 {
585 enabled = true; 585 enabled = true;
586 } 586 }
587 587
588 588
589 mChannel->setReadOnly(readonly); 589 mChannel->setReadOnly(readonly);
590 mMessage->setReadOnly(readonly); 590 mMessage->setReadOnly(readonly);
591 mParameters->setReadOnly(readonly); 591 mParameters->setReadOnly(readonly);
592 mMessage2->setReadOnly(readonly); 592 mMessage2->setReadOnly(readonly);
593 mParameters2->setReadOnly(readonly); 593 mParameters2->setReadOnly(readonly);
594 594
595 mChannel->setEnabled(enabled); 595 mChannel->setEnabled(enabled);
596 mMessage->setEnabled(enabled); 596 mMessage->setEnabled(enabled);
597 mParameters->setEnabled(enabled); 597 mParameters->setEnabled(enabled);
598 mMessage2->setEnabled(enabled); 598 mMessage2->setEnabled(enabled);
599 mParameters2->setEnabled(enabled); 599 mParameters2->setEnabled(enabled);
600 600
601 601
602 602
603 mClient->setCurrentItem(mCurrentClient); 603 mClient->setCurrentItem(mCurrentClient);
604 604
605 605
606 // enable/disable the extra message/parameter field 606 // enable/disable the extra message/parameter field
607 if (mCurrentApp == ExternalAppHandler::EMAIL) 607 if (mCurrentApp == ExternalAppHandler::EMAIL)
608 { 608 {
609 } 609 }
610 else 610 else
611 { 611 {
612 mMessage2->setText( "" ); 612 mMessage2->setText( "" );
613 mParameters2->setText( "" ); 613 mParameters2->setText( "" );
614 } 614 }
615 615
616 if (enabled == true) { 616 if (enabled == true) {
617 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 617 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
618 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 618 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
619 } 619 }
620 620
621 621
622 blockSignals( blocked ); 622 blockSignals( blocked );
623 623
624} 624}
625 625
626void KDEPIMConfigWidget::usrReadConfig() 626void KDEPIMConfigWidget::usrReadConfig()
627{ 627{
628 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 628 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
629 629
630 bool blocked = signalsBlocked(); 630 bool blocked = signalsBlocked();
631 blockSignals( true ); 631 blockSignals( true );
632 632
633 QString dummy = prefs->mUserDateFormatLong; 633 QString dummy = prefs->mUserDateFormatLong;
634 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 634 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
635 dummy = prefs->mUserDateFormatShort; 635 dummy = prefs->mUserDateFormatShort;
636 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 636 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
637 637
638 QDate current ( 2001, 1,1); 638 QDate current ( 2001, 1,1);
639 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); 639 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
640 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); 640 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
641 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); 641 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
642 642
643 643
644 644
645 645
646 mEmailClient = prefs->mEmailClient; 646 mEmailClient = prefs->mEmailClient;
647 mEmailOtherChannel = prefs->mEmailOtherChannel; 647 mEmailOtherChannel = prefs->mEmailOtherChannel;
648 mEmailOtherMessage = prefs->mEmailOtherMessage; 648 mEmailOtherMessage = prefs->mEmailOtherMessage;
649 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 649 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
650 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 650 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
651 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 651 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
652 652
653 mPhoneClient = prefs->mPhoneClient; 653 mPhoneClient = prefs->mPhoneClient;
654 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 654 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
655 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 655 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
656 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 656 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
657 657
658 mFaxClient = prefs->mFaxClient; 658 mFaxClient = prefs->mFaxClient;
659 mFaxOtherChannel = prefs->mFaxOtherChannel; 659 mFaxOtherChannel = prefs->mFaxOtherChannel;
660 mFaxOtherMessage = prefs->mFaxOtherMessage; 660 mFaxOtherMessage = prefs->mFaxOtherMessage;
661 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 661 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
662 662
663 mSMSClient = prefs->mSMSClient; 663 mSMSClient = prefs->mSMSClient;
664 mSMSOtherChannel = prefs->mSMSOtherChannel; 664 mSMSOtherChannel = prefs->mSMSOtherChannel;
665 mSMSOtherMessage = prefs->mSMSOtherMessage; 665 mSMSOtherMessage = prefs->mSMSOtherMessage;
666 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 666 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
667 667
668 mPagerClient = prefs->mPagerClient; 668 mPagerClient = prefs->mPagerClient;
669 mPagerOtherChannel = prefs->mPagerOtherChannel; 669 mPagerOtherChannel = prefs->mPagerOtherChannel;
670 mPagerOtherMessage = prefs->mPagerOtherMessage; 670 mPagerOtherMessage = prefs->mPagerOtherMessage;
671 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 671 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
672 672
673 mSipClient = prefs->mPagerClient; 673 mSipClient = prefs->mPagerClient;
674 mSipOtherChannel = prefs->mSipOtherChannel; 674 mSipOtherChannel = prefs->mSipOtherChannel;
675 mSipOtherMessage = prefs->mSipOtherMessage; 675 mSipOtherMessage = prefs->mSipOtherMessage;
676 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 676 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
677 677
678 mCurrentApp = ExternalAppHandler::EMAIL; 678 mCurrentApp = ExternalAppHandler::EMAIL;
679 mCurrentClient = mEmailClient; 679 mCurrentClient = mEmailClient;
680 680
681 updateClientWidgets(); 681 updateClientWidgets();
682 682
683 blockSignals( blocked ); 683 blockSignals( blocked );
684 684
685} 685}
686 686
687void KDEPIMConfigWidget::usrWriteConfig() 687void KDEPIMConfigWidget::usrWriteConfig()
688{ 688{
689 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); 689 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
690 690
691 saveEditFieldSettings(); 691 saveEditFieldSettings();
692 692
693 693
694 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 694 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
695 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 695 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
696 696
697 prefs->mTimeZoneId = mTimeZoneCombo->currentText(); 697 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
698 QDate date; 698 QDate date;
699 date = mStartDateSavingEdit->date(); 699 date = mStartDateSavingEdit->date();
700 int sub = 0; 700 int sub = 0;
701 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 701 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
702 sub = 1; 702 sub = 1;
703 prefs->mDaylightsavingStart = date.dayOfYear()-sub; 703 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
704 date = mEndDateSavingEdit->date(); 704 date = mEndDateSavingEdit->date();
705 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 705 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
706 sub = 1; 706 sub = 1;
707 else 707 else
708 sub = 0; 708 sub = 0;
709 prefs->mDaylightsavingEnd = date.dayOfYear()-sub; 709 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
710 710
711 711
712 prefs->mEmailClient = mEmailClient; 712 prefs->mEmailClient = mEmailClient;
713 prefs->mEmailOtherChannel = mEmailOtherChannel; 713 prefs->mEmailOtherChannel = mEmailOtherChannel;
714 prefs->mEmailOtherMessage = mEmailOtherMessage; 714 prefs->mEmailOtherMessage = mEmailOtherMessage;
715 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 715 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
716 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 716 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
717 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 717 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
718 718
719 prefs->mPhoneClient = mPhoneClient; 719 prefs->mPhoneClient = mPhoneClient;
720 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 720 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
721 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 721 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
722 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 722 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
723 723
724 prefs->mFaxClient = mFaxClient; 724 prefs->mFaxClient = mFaxClient;
725 prefs->mFaxOtherChannel = mFaxOtherChannel; 725 prefs->mFaxOtherChannel = mFaxOtherChannel;
726 prefs->mFaxOtherMessage = mFaxOtherMessage; 726 prefs->mFaxOtherMessage = mFaxOtherMessage;
727 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 727 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
728 728
729 prefs->mSMSClient = mSMSClient; 729 prefs->mSMSClient = mSMSClient;
730 prefs->mSMSOtherChannel = mSMSOtherChannel; 730 prefs->mSMSOtherChannel = mSMSOtherChannel;
731 prefs->mSMSOtherMessage = mSMSOtherMessage; 731 prefs->mSMSOtherMessage = mSMSOtherMessage;
732 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 732 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
733 733
734 prefs->mPagerClient = mPagerClient; 734 prefs->mPagerClient = mPagerClient;
735 prefs->mPagerOtherChannel = mPagerOtherChannel; 735 prefs->mPagerOtherChannel = mPagerOtherChannel;
736 prefs->mPagerOtherMessage = mPagerOtherMessage; 736 prefs->mPagerOtherMessage = mPagerOtherMessage;
737 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 737 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
738 738
739 739
740 prefs->mSipClient = mSipClient; 740 prefs->mSipClient = mSipClient;
741 prefs->mSipOtherChannel = mSipOtherChannel; 741 prefs->mSipOtherChannel = mSipOtherChannel;
742 prefs->mSipOtherMessage = mSipOtherMessage; 742 prefs->mSipOtherMessage = mSipOtherMessage;
743 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; 743 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
744 744
745 //release the cache that other views can access the changed values instantanious 745 //release the cache that other views can access the changed values instantanious
746 ExternalAppHandler::instance()->loadConfig(); 746 ExternalAppHandler::instance()->loadConfig();
747 747 KPimGlobalPrefs::instance()->setGlobalConfig();
748} 748}
749 749
750 750
751void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, 751void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
752 const QStringList *tags) 752 const QStringList *tags)
753{ 753{
754 if (tags) { 754 if (tags) {
755 int i = tags->findIndex(text); 755 int i = tags->findIndex(text);
756 if (i > 0) combo->setCurrentItem(i); 756 if (i > 0) combo->setCurrentItem(i);
757 } else { 757 } else {
758 for(int i=0;i<combo->count();++i) { 758 for(int i=0;i<combo->count();++i) {
759 if (combo->text(i) == text) { 759 if (combo->text(i) == text) {
760 combo->setCurrentItem(i); 760 combo->setCurrentItem(i);
761 break; 761 break;
762 } 762 }
763 } 763 }
764 } 764 }
765} 765}
766 766
767 767
768void KDEPIMConfigWidget::textChanged( const QString& text ) 768void KDEPIMConfigWidget::textChanged( const QString& text )
769{ 769{
770 emit changed( true ); 770 emit changed( true );
771} 771}
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 12a503d..a896a0f 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,115 +1,132 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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#include <kstaticdeleter.h> 35#include <kstaticdeleter.h>
36 36
37#include "kpimglobalprefs.h" 37#include "kpimglobalprefs.h"
38 38
39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
40static KStaticDeleter<KPimGlobalPrefs> staticDeleter; 40static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
41 41
42 42
43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
44 : KPrefs("microkdeglobalrc") 44 : KPrefs("microkdeglobalrc")
45{ 45{
46 46
47 KPrefs::setCurrentGroup("Locale"); 47 KPrefs::setCurrentGroup("Locale");
48 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 48 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
49 addItemInt("PreferredTime",&mPreferredTime,0); 49 addItemInt("PreferredTime",&mPreferredTime,0);
50 addItemInt("PreferredDate",&mPreferredDate,0); 50 addItemInt("PreferredDate",&mPreferredDate,0);
51 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 51 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
52 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 52 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
53 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 53 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
54 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 54 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
55 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 55 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
56 56
57 KPrefs::setCurrentGroup("Time & Date"); 57 KPrefs::setCurrentGroup("Time & Date");
58 58
59 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 59 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
60 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 60 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
61 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 61 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
62 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 62 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
63 63
64 64
65 65
66 66
67 KPrefs::setCurrentGroup( "ExternalApplications" ); 67 KPrefs::setCurrentGroup( "ExternalApplications" );
68 68
69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
70 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 70 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
75 75
76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
80 80
81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
82 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 82 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
85 85
86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
87 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 87 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
90 90
91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
92 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 92 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
95 95
96 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); 96 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
97 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 97 addItemString( "SIPChannel", &mSipOtherChannel, "" );
98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
100 100
101} 101}
102 102
103void KPimGlobalPrefs::setGlobalConfig()
104{
105
106 KGlobal::locale()->setHore24Format( !mPreferredTime );
107 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
108 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
109 KGlobal::locale()->setLanguage( mPreferredLanguage );
110 QString dummy = mUserDateFormatLong;
111 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
112 dummy = mUserDateFormatShort;
113 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
114 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
115 mDaylightsavingStart,
116 mDaylightsavingEnd );
117 KGlobal::locale()->setTimezone( mTimeZoneId );
118
119}
103KPimGlobalPrefs::~KPimGlobalPrefs() 120KPimGlobalPrefs::~KPimGlobalPrefs()
104{ 121{
105} 122}
106 123
107KPimGlobalPrefs *KPimGlobalPrefs::instance() 124KPimGlobalPrefs *KPimGlobalPrefs::instance()
108{ 125{
109 if ( !sInstance ) { 126 if ( !sInstance ) {
110 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); 127 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
111 sInstance->readConfig(); 128 sInstance->readConfig();
112 } 129 }
113 130
114 return sInstance; 131 return sInstance;
115} 132}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index dad78e6..84ba689 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -1,137 +1,135 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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#ifndef KPIMGLOBALPREFS_H 31#ifndef KPIMGLOBALPREFS_H
32#define KPIMGLOBALPREFS_H 32#define KPIMGLOBALPREFS_H
33 33
34#include "kprefs.h" 34#include "kprefs.h"
35 35
36class KPimGlobalPrefs : public KPrefs 36class KPimGlobalPrefs : public KPrefs
37{ 37{
38 public: 38 public:
39 39
40 void setGlobalConfig();
40 static KPimGlobalPrefs *instance(); 41 static KPimGlobalPrefs *instance();
41 42
42 43
43 virtual ~KPimGlobalPrefs(); 44 virtual ~KPimGlobalPrefs();
44 45
45 46
46 enum EMailClients { 47 enum EMailClients {
47 NONE_EMC = 0, 48 NONE_EMC = 0,
48 OTHER_EMC = 1, 49 OTHER_EMC = 1,
49 OMPI_EMC = 2, 50 OMPI_EMC = 2,
50 QTOPIA_EMC = 3, 51 QTOPIA_EMC = 3,
51 OPIE_EMC = 4 52 OPIE_EMC = 4
52 }; 53 };
53 54
54 enum PhoneClients { 55 enum PhoneClients {
55 NONE_PHC = 0, 56 NONE_PHC = 0,
56 OTHER_PHC = 1, 57 OTHER_PHC = 1,
57 KPPI_PHC = 2 58 KPPI_PHC = 2
58 }; 59 };
59 60
60 enum FaxClients { 61 enum FaxClients {
61 NONE_FAC = 0, 62 NONE_FAC = 0,
62 OTHER_FAC = 1 63 OTHER_FAC = 1
63 }; 64 };
64 65
65 enum SMSClients { 66 enum SMSClients {
66 NONE_SMC = 0, 67 NONE_SMC = 0,
67 OTHER_SMC = 1 68 OTHER_SMC = 1
68 }; 69 };
69 70
70 enum PagerClients { 71 enum PagerClients {
71 NONE_PAC = 0, 72 NONE_PAC = 0,
72 OTHER_PAC = 1 73 OTHER_PAC = 1
73 }; 74 };
74 75
75 enum SIPClients { 76 enum SIPClients {
76 NONE_SIC = 0, 77 NONE_SIC = 0,
77 OTHER_SIC = 1 78 OTHER_SIC = 1
78 }; 79 };
79 80
80 private: 81 private:
81 KPimGlobalPrefs( const QString &name = QString::null ); 82 KPimGlobalPrefs( const QString &name = QString::null );
82 83
83 static KPimGlobalPrefs *sInstance; 84 static KPimGlobalPrefs *sInstance;
84 85
85 86
86 public: 87 public:
87 //US I copied the following "locale" settings from KOPrefs 88 //US I copied the following "locale" settings from KOPrefs
88 int mPreferredDate; 89 int mPreferredDate;
89 QString mUserDateFormatLong; 90 QString mUserDateFormatLong;
90 QString mUserDateFormatShort; 91 QString mUserDateFormatShort;
91 int mPreferredLanguage; 92 int mPreferredLanguage;
92 int mPreferredTime; 93 int mPreferredTime;
93 bool mWeekStartsOnSunday; 94 bool mWeekStartsOnSunday;
94 QString mTimeZoneId; 95 QString mTimeZoneId;
95 bool mUseDaylightsaving; 96 bool mUseDaylightsaving;
96 int mDaylightsavingStart; 97 int mDaylightsavingStart;
97 int mDaylightsavingEnd; 98 int mDaylightsavingEnd;
98 99
99
100
101
102 int mEmailClient; 100 int mEmailClient;
103 QString mEmailOtherChannel; 101 QString mEmailOtherChannel;
104 QString mEmailOtherMessage; 102 QString mEmailOtherMessage;
105 QString mEmailOtherMessageParameters; 103 QString mEmailOtherMessageParameters;
106 QString mEmailOtherMessage2; 104 QString mEmailOtherMessage2;
107 QString mEmailOtherMessageParameters2; 105 QString mEmailOtherMessageParameters2;
108 106
109 int mPhoneClient; 107 int mPhoneClient;
110 QString mPhoneOtherChannel; 108 QString mPhoneOtherChannel;
111 QString mPhoneOtherMessage; 109 QString mPhoneOtherMessage;
112 QString mPhoneOtherMessageParameters; 110 QString mPhoneOtherMessageParameters;
113 111
114 int mFaxClient; 112 int mFaxClient;
115 QString mFaxOtherChannel; 113 QString mFaxOtherChannel;
116 QString mFaxOtherMessage; 114 QString mFaxOtherMessage;
117 QString mFaxOtherMessageParameters; 115 QString mFaxOtherMessageParameters;
118 116
119 int mSMSClient; 117 int mSMSClient;
120 QString mSMSOtherChannel; 118 QString mSMSOtherChannel;
121 QString mSMSOtherMessage; 119 QString mSMSOtherMessage;
122 QString mSMSOtherMessageParameters; 120 QString mSMSOtherMessageParameters;
123 121
124 int mPagerClient; 122 int mPagerClient;
125 QString mPagerOtherChannel; 123 QString mPagerOtherChannel;
126 QString mPagerOtherMessage; 124 QString mPagerOtherMessage;
127 QString mPagerOtherMessageParameters; 125 QString mPagerOtherMessageParameters;
128 126
129 int mSipClient; 127 int mSipClient;
130 QString mSipOtherChannel; 128 QString mSipOtherChannel;
131 QString mSipOtherMessage; 129 QString mSipOtherMessage;
132 QString mSipOtherMessageParameters; 130 QString mSipOtherMessageParameters;
133 131
134 132
135}; 133};
136 134
137#endif 135#endif