summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-26 17:06:57 (UTC)
committer zautrix <zautrix>2005-03-26 17:06:57 (UTC)
commitc692f6870157f428aebf1dfdab4fbb6e88699c31 (patch) (unidiff)
tree43c45e0aef74c1d1fcc42d22bc1e05c9318159ca
parent5079ed1883f8e53bc12be971c3c9495f45abf341 (diff)
downloadkdepimpi-c692f6870157f428aebf1dfdab4fbb6e88699c31.zip
kdepimpi-c692f6870157f428aebf1dfdab4fbb6e88699c31.tar.gz
kdepimpi-c692f6870157f428aebf1dfdab4fbb6e88699c31.tar.bz2
layout fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefsdialog.cpp4
-rw-r--r--korganizer/calendarview.cpp18
-rw-r--r--korganizer/mainwindow.cpp23
-rw-r--r--korganizer/mainwindow.h1
4 files changed, 35 insertions, 11 deletions
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 4af4a8c..40347cc 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -1,267 +1,271 @@
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#include <kdialog.h> 23#include <kdialog.h>
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 <klineedit.h> 57#include <klineedit.h>
58 58
59 59
60#include "koprefs.h" 60#include "koprefs.h"
61 61
62#include "koprefsdialog.h" 62#include "koprefsdialog.h"
63//#include <kprefswidget.h> 63//#include <kprefswidget.h>
64 64
65 65
66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
67 KPrefsDialog(KOPrefs::instance(),parent,name,true) 67 KPrefsDialog(KOPrefs::instance(),parent,name,true)
68{ 68{
69 69
70 setCaption( i18n("Settings - some need a restart (nr)")); 70 setCaption( i18n("Settings - some need a restart (nr)"));
71 setupGlobalTab(); 71 setupGlobalTab();
72 setupMainTab(); 72 setupMainTab();
73 setupMailTab();; 73 setupMailTab();;
74 setupFontsTab(); 74 setupFontsTab();
75 readConfig(); 75 readConfig();
76#ifndef DESKTOP_VERSION
77 if ( QApplication::desktop()->height() == 480 )
78 hideButtons();
79#endif
76 80
77#if 0 81#if 0
78 82
79 setupMainTab(); 83 setupMainTab();
80 setupLocaleTab(); 84 setupLocaleTab();
81 setupTimeZoneTab(); 85 setupTimeZoneTab();
82 setupTimeTab(); 86 setupTimeTab();
83 setupLocaleDateTab(); 87 setupLocaleDateTab();
84 setupFontsTab(); 88 setupFontsTab();
85 setupColorsTab(); 89 setupColorsTab();
86 setupViewsTab(); 90 setupViewsTab();
87 //setupSyncTab(); 91 //setupSyncTab();
88 //setupSyncAlgTab(); 92 //setupSyncAlgTab();
89 //setupPrinterTab(); 93 //setupPrinterTab();
90 //setupGroupSchedulingTab(); 94 //setupGroupSchedulingTab();
91 //setupGroupAutomationTab(); 95 //setupGroupAutomationTab();
92#endif 96#endif
93} 97}
94 98
95#include "kpimglobalprefs.h" 99#include "kpimglobalprefs.h"
96 100
97KOPrefsDialog::~KOPrefsDialog() 101KOPrefsDialog::~KOPrefsDialog()
98{ 102{
99} 103}
100void KOPrefsDialog::setupGlobalTab() 104void KOPrefsDialog::setupGlobalTab()
101{ 105{
102 QFrame *topFrame = addPage(i18n("Global"),0,0); 106 QFrame *topFrame = addPage(i18n("Global"),0,0);
103 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 107 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
104 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 108 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
105 topLayout->addWidget( kdelibcfg ); 109 topLayout->addWidget( kdelibcfg );
106 110
107 111
108} 112}
109void KOPrefsDialog::setupMainTab() 113void KOPrefsDialog::setupMainTab()
110{ 114{
111 QFrame *topFrame = addPage(i18n("General"),0,0); 115 QFrame *topFrame = addPage(i18n("General"),0,0);
112 116
113 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 117 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
114 topLayout->setSpacing(spacingHint()); 118 topLayout->setSpacing(spacingHint());
115 topLayout->setMargin(marginHint()); 119 topLayout->setMargin(marginHint());
116 120
117 121
118 mNameEdit = new QLineEdit(topFrame); 122 mNameEdit = new QLineEdit(topFrame);
119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 123 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
120 topLayout->addWidget(mNameLabel,0,0); 124 topLayout->addWidget(mNameLabel,0,0);
121 topLayout->addWidget(mNameEdit,0,1); 125 topLayout->addWidget(mNameEdit,0,1);
122 126
123 mEmailEdit = new QLineEdit(topFrame); 127 mEmailEdit = new QLineEdit(topFrame);
124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 128 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
125 topLayout->addWidget(mEmailLabel,1,0); 129 topLayout->addWidget(mEmailLabel,1,0);
126 topLayout->addWidget(mEmailEdit,1,1); 130 topLayout->addWidget(mEmailEdit,1,1);
127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); 131 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
128 topLayout->addMultiCellWidget(lab,2,2,0,1); 132 topLayout->addMultiCellWidget(lab,2,2,0,1);
129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), 133 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
130 &(KOPrefs::instance()->mUseKapi),topFrame); 134 &(KOPrefs::instance()->mUseKapi),topFrame);
131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); 135 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
132} 136}
133 137
134void KOPrefsDialog::setupMailTab() 138void KOPrefsDialog::setupMailTab()
135{ 139{
136 QFrame *topFrame = addPage(i18n("Mail"),0,0); 140 QFrame *topFrame = addPage(i18n("Mail"),0,0);
137 141
138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 142 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
139 topLayout->setSpacing(spacingHint()); 143 topLayout->setSpacing(spacingHint());
140 topLayout->setMargin(marginHint()); 144 topLayout->setMargin(marginHint());
141 145
142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), 146 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"),
143 &(KOPrefs::instance()->mViewAsHtml),topFrame); 147 &(KOPrefs::instance()->mViewAsHtml),topFrame);
144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); 148 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1);
145 149
146 150
147 ttt = addWidBool(i18n("Send mails later"), 151 ttt = addWidBool(i18n("Send mails later"),
148 &(KOPrefs::instance()->mSendLater),topFrame); 152 &(KOPrefs::instance()->mSendLater),topFrame);
149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); 153 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1);
150 ttt = addWidBool(i18n("Show \"To\" field in list view"), 154 ttt = addWidBool(i18n("Show \"To\" field in list view"),
151 &(KOPrefs::instance()->mShowToField),topFrame); 155 &(KOPrefs::instance()->mShowToField),topFrame);
152 topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1); 156 topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1);
153 157
154 int iii =3; 158 int iii =3;
155 ttt = addWidBool(i18n("Show info fields at startup"), 159 ttt = addWidBool(i18n("Show info fields at startup"),
156 &(KOPrefs::instance()->mShowInfoStart),topFrame); 160 &(KOPrefs::instance()->mShowInfoStart),topFrame);
157 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 161 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
158 ++iii; 162 ++iii;
159 ttt = addWidBool(i18n("Show \"Subject\" info field"), 163 ttt = addWidBool(i18n("Show \"Subject\" info field"),
160 &(KOPrefs::instance()->mShowInfoSub),topFrame); 164 &(KOPrefs::instance()->mShowInfoSub),topFrame);
161 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 165 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
162 ++iii; 166 ++iii;
163 ttt = addWidBool(i18n("Show \"From\" info field"), 167 ttt = addWidBool(i18n("Show \"From\" info field"),
164 &(KOPrefs::instance()->mShowInfoFrom),topFrame); 168 &(KOPrefs::instance()->mShowInfoFrom),topFrame);
165 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 169 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
166 ++iii; 170 ++iii;
167 ttt = addWidBool(i18n("Show \"To\" info field"), 171 ttt = addWidBool(i18n("Show \"To\" info field"),
168 &(KOPrefs::instance()->mShowInfoTo),topFrame); 172 &(KOPrefs::instance()->mShowInfoTo),topFrame);
169 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1); 173 topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
170 ++iii; 174 ++iii;
171 175
172 /* 176 /*
173 mCodecEdit = new QLineEdit(topFrame); 177 mCodecEdit = new QLineEdit(topFrame);
174 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); 178 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1);
175 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); 179 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1);
176 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); 180 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1);
177 */ 181 */
178} 182}
179void KOPrefsDialog::setupFontsTab() 183void KOPrefsDialog::setupFontsTab()
180{ 184{
181 185
182 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 186 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
183 // DesktopIcon("fonts",KIcon::SizeMedium)); 187 // DesktopIcon("fonts",KIcon::SizeMedium));
184 188
185 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 189 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
186 topLayout->setSpacing(1); 190 topLayout->setSpacing(1);
187 topLayout->setMargin(3); 191 topLayout->setMargin(3);
188 KPrefsDialogWidFont * tVFont; 192 KPrefsDialogWidFont * tVFont;
189 int i = 0; 193 int i = 0;
190 KPrefsDialogWidFont *timeLabelsFont = 194 KPrefsDialogWidFont *timeLabelsFont =
191 addWidFont(i18n("OK"),i18n("Application(nr)"), 195 addWidFont(i18n("OK"),i18n("Application(nr)"),
192 &(KOPrefs::instance()->mAppFont),topFrame); 196 &(KOPrefs::instance()->mAppFont),topFrame);
193 topLayout->addWidget(timeLabelsFont->label(),i,0); 197 topLayout->addWidget(timeLabelsFont->label(),i,0);
194 topLayout->addWidget(timeLabelsFont->preview(),i,1); 198 topLayout->addWidget(timeLabelsFont->preview(),i,1);
195 topLayout->addWidget(timeLabelsFont->button(),i,2); 199 topLayout->addWidget(timeLabelsFont->button(),i,2);
196 ++i; 200 ++i;
197 201
198 202
199 timeLabelsFont = 203 timeLabelsFont =
200 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), 204 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
201 &(KOPrefs::instance()->mComposeFont),topFrame); 205 &(KOPrefs::instance()->mComposeFont),topFrame);
202 topLayout->addWidget(timeLabelsFont->label(),i,0); 206 topLayout->addWidget(timeLabelsFont->label(),i,0);
203 topLayout->addWidget(timeLabelsFont->preview(),i,1); 207 topLayout->addWidget(timeLabelsFont->preview(),i,1);
204 topLayout->addWidget(timeLabelsFont->button(),i,2); 208 topLayout->addWidget(timeLabelsFont->button(),i,2);
205 ++i; 209 ++i;
206 210
207 KPrefsDialogWidFont *timeBarFont = 211 KPrefsDialogWidFont *timeBarFont =
208 addWidFont(i18n("Hello"),i18n("Read mail:"), 212 addWidFont(i18n("Hello"),i18n("Read mail:"),
209 &(KOPrefs::instance()->mReadFont),topFrame); 213 &(KOPrefs::instance()->mReadFont),topFrame);
210 topLayout->addWidget(timeBarFont->label(),i,0); 214 topLayout->addWidget(timeBarFont->label(),i,0);
211 topLayout->addWidget(timeBarFont->preview(),i,1); 215 topLayout->addWidget(timeBarFont->preview(),i,1);
212 topLayout->addWidget(timeBarFont->button(),i,2); 216 topLayout->addWidget(timeBarFont->button(),i,2);
213 ++i; 217 ++i;
214 218
215 topLayout->setColStretch(1,1); 219 topLayout->setColStretch(1,1);
216 topLayout->setRowStretch(4,1); 220 topLayout->setRowStretch(4,1);
217 221
218} 222}
219void KOPrefsDialog::usrReadConfig() 223void KOPrefsDialog::usrReadConfig()
220{ 224{
221 225
222 mNameEdit->setText(KOPrefs::instance()->mName); 226 mNameEdit->setText(KOPrefs::instance()->mName);
223 mEmailEdit->setText(KOPrefs::instance()->mEmail); 227 mEmailEdit->setText(KOPrefs::instance()->mEmail);
224 //mCodecEdit->setText(KOPrefs::instance()->mSendCodec); 228 //mCodecEdit->setText(KOPrefs::instance()->mSendCodec);
225 kdelibcfg->readConfig(); 229 kdelibcfg->readConfig();
226} 230}
227void KOPrefsDialog::usrWriteConfig() 231void KOPrefsDialog::usrWriteConfig()
228{ 232{
229 KOPrefs::instance()->mName = mNameEdit->text(); 233 KOPrefs::instance()->mName = mNameEdit->text();
230 KOPrefs::instance()->mEmail = mEmailEdit->text(); 234 KOPrefs::instance()->mEmail = mEmailEdit->text();
231 //KOPrefs::instance()->mSendCodec = mCodecEdit->text(); 235 //KOPrefs::instance()->mSendCodec = mCodecEdit->text();
232 kdelibcfg->writeConfig(); 236 kdelibcfg->writeConfig();
233 237
234 238
235} 239}
236 240
237#if 0 241#if 0
238void KOPrefsDialog::setupLocaleDateTab() 242void KOPrefsDialog::setupLocaleDateTab()
239{ 243{
240QFrame *topFrame = addPage(i18n("Date Format"),0,0); 244QFrame *topFrame = addPage(i18n("Date Format"),0,0);
241 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 245 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
242 topLayout->setSpacing(spacingHint()); 246 topLayout->setSpacing(spacingHint());
243 topLayout->setMargin(marginHint()); 247 topLayout->setMargin(marginHint());
244 int iii = 0; 248 int iii = 0;
245 249
246 250
247 KPrefsWidRadios *syncPrefsGroup = 251 KPrefsWidRadios *syncPrefsGroup =
248 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 252 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
249 QString format; 253 QString format;
250 if ( QApplication::desktop()->width() < 480 ) 254 if ( QApplication::desktop()->width() < 480 )
251 format = "(%d.%m.%Y)"; 255 format = "(%d.%m.%Y)";
252 else 256 else
253 format = "(%d.%m.%Y|%A %d %B %Y)"; 257 format = "(%d.%m.%Y|%A %d %B %Y)";
254 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 258 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
255 if ( QApplication::desktop()->width() < 480 ) 259 if ( QApplication::desktop()->width() < 480 )
256 format = "(%m.%d.%Y)"; 260 format = "(%m.%d.%Y)";
257 else 261 else
258 format = "(%m.%d.%Y|%A %B %d %Y)"; 262 format = "(%m.%d.%Y|%A %B %d %Y)";
259 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 263 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
260 if ( QApplication::desktop()->width() < 480 ) 264 if ( QApplication::desktop()->width() < 480 )
261 format = "(%Y-%m-%d)"; 265 format = "(%Y-%m-%d)";
262 else 266 else
263 format = "(%Y-%m-%d|%A %Y %B %d)"; 267 format = "(%Y-%m-%d|%A %Y %B %d)";
264 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 268 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
265 syncPrefsGroup->addRadio(i18n("User defined")); 269 syncPrefsGroup->addRadio(i18n("User defined"));
266 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 270 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
267 ++iii; 271 ++iii;
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 92fd59c..3a16fe6 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3417,399 +3417,405 @@ bool CalendarView::isReadOnly()
3417void CalendarView::setReadOnly(bool readOnly) 3417void CalendarView::setReadOnly(bool readOnly)
3418{ 3418{
3419 if (mReadOnly != readOnly) { 3419 if (mReadOnly != readOnly) {
3420 mReadOnly = readOnly; 3420 mReadOnly = readOnly;
3421 emit readOnlyChanged(mReadOnly); 3421 emit readOnlyChanged(mReadOnly);
3422 } 3422 }
3423} 3423}
3424 3424
3425bool CalendarView::isModified() 3425bool CalendarView::isModified()
3426{ 3426{
3427 return mModified; 3427 return mModified;
3428} 3428}
3429 3429
3430void CalendarView::printSetup() 3430void CalendarView::printSetup()
3431{ 3431{
3432#ifndef KORG_NOPRINTER 3432#ifndef KORG_NOPRINTER
3433 createPrinter(); 3433 createPrinter();
3434 3434
3435 mCalPrinter->setupPrinter(); 3435 mCalPrinter->setupPrinter();
3436#endif 3436#endif
3437} 3437}
3438 3438
3439void CalendarView::print() 3439void CalendarView::print()
3440{ 3440{
3441#ifndef KORG_NOPRINTER 3441#ifndef KORG_NOPRINTER
3442 createPrinter(); 3442 createPrinter();
3443 3443
3444 DateList tmpDateList = mNavigator->selectedDates(); 3444 DateList tmpDateList = mNavigator->selectedDates();
3445 mCalPrinter->print(CalPrinter::Month, 3445 mCalPrinter->print(CalPrinter::Month,
3446 tmpDateList.first(), tmpDateList.last()); 3446 tmpDateList.first(), tmpDateList.last());
3447#endif 3447#endif
3448} 3448}
3449 3449
3450void CalendarView::printPreview() 3450void CalendarView::printPreview()
3451{ 3451{
3452#ifndef KORG_NOPRINTER 3452#ifndef KORG_NOPRINTER
3453 kdDebug() << "CalendarView::printPreview()" << endl; 3453 kdDebug() << "CalendarView::printPreview()" << endl;
3454 3454
3455 createPrinter(); 3455 createPrinter();
3456 3456
3457 DateList tmpDateList = mNavigator->selectedDates(); 3457 DateList tmpDateList = mNavigator->selectedDates();
3458 3458
3459 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3459 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3460 tmpDateList.last()); 3460 tmpDateList.last());
3461#endif 3461#endif
3462} 3462}
3463 3463
3464void CalendarView::exportICalendar() 3464void CalendarView::exportICalendar()
3465{ 3465{
3466 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3466 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3467 3467
3468 // Force correct extension 3468 // Force correct extension
3469 if (filename.right(4) != ".ics") filename += ".ics"; 3469 if (filename.right(4) != ".ics") filename += ".ics";
3470 3470
3471 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3471 FileStorage storage( mCalendar, filename, new ICalFormat() );
3472 storage.save(); 3472 storage.save();
3473} 3473}
3474 3474
3475bool CalendarView::exportVCalendar( QString filename ) 3475bool CalendarView::exportVCalendar( QString filename )
3476{ 3476{
3477 if (mCalendar->journals().count() > 0) { 3477 if (mCalendar->journals().count() > 0) {
3478 int result = KMessageBox::warningContinueCancel(this, 3478 int result = KMessageBox::warningContinueCancel(this,
3479 i18n("The journal entries can not be\nexported to a vCalendar file."), 3479 i18n("The journal entries can not be\nexported to a vCalendar file."),
3480 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3480 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3481 true); 3481 true);
3482 if (result != KMessageBox::Continue) return false; 3482 if (result != KMessageBox::Continue) return false;
3483 } 3483 }
3484 3484
3485 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3485 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3486 3486
3487 // Force correct extension 3487 // Force correct extension
3488 if (filename.right(4) != ".vcs") filename += ".vcs"; 3488 if (filename.right(4) != ".vcs") filename += ".vcs";
3489 3489
3490 FileStorage storage( mCalendar, filename, new VCalFormat ); 3490 FileStorage storage( mCalendar, filename, new VCalFormat );
3491 return storage.save(); 3491 return storage.save();
3492 3492
3493} 3493}
3494 3494
3495void CalendarView::eventUpdated(Incidence *) 3495void CalendarView::eventUpdated(Incidence *)
3496{ 3496{
3497 setModified(); 3497 setModified();
3498 // Don't call updateView here. The code, which has caused the update of the 3498 // Don't call updateView here. The code, which has caused the update of the
3499 // event is responsible for updating the view. 3499 // event is responsible for updating the view.
3500 // updateView(); 3500 // updateView();
3501} 3501}
3502 3502
3503void CalendarView::adaptNavigationUnits() 3503void CalendarView::adaptNavigationUnits()
3504{ 3504{
3505 if (mViewManager->currentView()->isEventView()) { 3505 if (mViewManager->currentView()->isEventView()) {
3506 int days = mViewManager->currentView()->currentDateCount(); 3506 int days = mViewManager->currentView()->currentDateCount();
3507 if (days == 1) { 3507 if (days == 1) {
3508 emit changeNavStringPrev(i18n("&Previous Day")); 3508 emit changeNavStringPrev(i18n("&Previous Day"));
3509 emit changeNavStringNext(i18n("&Next Day")); 3509 emit changeNavStringNext(i18n("&Next Day"));
3510 } else { 3510 } else {
3511 emit changeNavStringPrev(i18n("&Previous Week")); 3511 emit changeNavStringPrev(i18n("&Previous Week"));
3512 emit changeNavStringNext(i18n("&Next Week")); 3512 emit changeNavStringNext(i18n("&Next Week"));
3513 } 3513 }
3514 } 3514 }
3515} 3515}
3516 3516
3517void CalendarView::processMainViewSelection( Incidence *incidence ) 3517void CalendarView::processMainViewSelection( Incidence *incidence )
3518{ 3518{
3519 if ( incidence ) mTodoList->clearSelection(); 3519 if ( incidence ) mTodoList->clearSelection();
3520 processIncidenceSelection( incidence ); 3520 processIncidenceSelection( incidence );
3521} 3521}
3522 3522
3523void CalendarView::processTodoListSelection( Incidence *incidence ) 3523void CalendarView::processTodoListSelection( Incidence *incidence )
3524{ 3524{
3525 if ( incidence && mViewManager->currentView() ) { 3525 if ( incidence && mViewManager->currentView() ) {
3526 mViewManager->currentView()->clearSelection(); 3526 mViewManager->currentView()->clearSelection();
3527 } 3527 }
3528 processIncidenceSelection( incidence ); 3528 processIncidenceSelection( incidence );
3529} 3529}
3530 3530
3531void CalendarView::processIncidenceSelection( Incidence *incidence ) 3531void CalendarView::processIncidenceSelection( Incidence *incidence )
3532{ 3532{
3533 if ( incidence == mSelectedIncidence ) return; 3533 if ( incidence == mSelectedIncidence ) return;
3534 3534
3535 mSelectedIncidence = incidence; 3535 mSelectedIncidence = incidence;
3536 3536
3537 emit incidenceSelected( mSelectedIncidence ); 3537 emit incidenceSelected( mSelectedIncidence );
3538 3538
3539 if ( incidence && incidence->type() == "Event" ) { 3539 if ( incidence && incidence->type() == "Event" ) {
3540 Event *event = static_cast<Event *>( incidence ); 3540 Event *event = static_cast<Event *>( incidence );
3541 if ( event->organizer() == KOPrefs::instance()->email() ) { 3541 if ( event->organizer() == KOPrefs::instance()->email() ) {
3542 emit organizerEventsSelected( true ); 3542 emit organizerEventsSelected( true );
3543 } else { 3543 } else {
3544 emit organizerEventsSelected(false); 3544 emit organizerEventsSelected(false);
3545 } 3545 }
3546 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3546 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3547 KOPrefs::instance()->email() ) ) { 3547 KOPrefs::instance()->email() ) ) {
3548 emit groupEventsSelected( true ); 3548 emit groupEventsSelected( true );
3549 } else { 3549 } else {
3550 emit groupEventsSelected(false); 3550 emit groupEventsSelected(false);
3551 } 3551 }
3552 return; 3552 return;
3553 } else { 3553 } else {
3554 if ( incidence && incidence->type() == "Todo" ) { 3554 if ( incidence && incidence->type() == "Todo" ) {
3555 emit todoSelected( true ); 3555 emit todoSelected( true );
3556 Todo *event = static_cast<Todo *>( incidence ); 3556 Todo *event = static_cast<Todo *>( incidence );
3557 if ( event->organizer() == KOPrefs::instance()->email() ) { 3557 if ( event->organizer() == KOPrefs::instance()->email() ) {
3558 emit organizerEventsSelected( true ); 3558 emit organizerEventsSelected( true );
3559 } else { 3559 } else {
3560 emit organizerEventsSelected(false); 3560 emit organizerEventsSelected(false);
3561 } 3561 }
3562 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3562 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3563 KOPrefs::instance()->email() ) ) { 3563 KOPrefs::instance()->email() ) ) {
3564 emit groupEventsSelected( true ); 3564 emit groupEventsSelected( true );
3565 } else { 3565 } else {
3566 emit groupEventsSelected(false); 3566 emit groupEventsSelected(false);
3567 } 3567 }
3568 return; 3568 return;
3569 } else { 3569 } else {
3570 emit todoSelected( false ); 3570 emit todoSelected( false );
3571 emit organizerEventsSelected(false); 3571 emit organizerEventsSelected(false);
3572 emit groupEventsSelected(false); 3572 emit groupEventsSelected(false);
3573 } 3573 }
3574 return; 3574 return;
3575 } 3575 }
3576 3576
3577 /* if ( incidence && incidence->type() == "Todo" ) { 3577 /* if ( incidence && incidence->type() == "Todo" ) {
3578 emit todoSelected( true ); 3578 emit todoSelected( true );
3579 } else { 3579 } else {
3580 emit todoSelected( false ); 3580 emit todoSelected( false );
3581 }*/ 3581 }*/
3582} 3582}
3583 3583
3584 3584
3585void CalendarView::checkClipboard() 3585void CalendarView::checkClipboard()
3586{ 3586{
3587#ifndef KORG_NODND 3587#ifndef KORG_NODND
3588 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3588 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3589 emit pasteEnabled(true); 3589 emit pasteEnabled(true);
3590 } else { 3590 } else {
3591 emit pasteEnabled(false); 3591 emit pasteEnabled(false);
3592 } 3592 }
3593#endif 3593#endif
3594} 3594}
3595 3595
3596void CalendarView::showDates(const DateList &selectedDates) 3596void CalendarView::showDates(const DateList &selectedDates)
3597{ 3597{
3598 // kdDebug() << "CalendarView::selectDates()" << endl; 3598 // kdDebug() << "CalendarView::selectDates()" << endl;
3599 3599
3600 3600
3601 if ( !mBlockShowDates ) { 3601 if ( !mBlockShowDates ) {
3602 if ( mViewManager->currentView() ) { 3602 if ( mViewManager->currentView() ) {
3603 updateView( selectedDates.first(), selectedDates.last() ); 3603 updateView( selectedDates.first(), selectedDates.last() );
3604 } else { 3604 } else {
3605 mViewManager->showAgendaView(); 3605 mViewManager->showAgendaView();
3606 } 3606 }
3607 } 3607 }
3608 3608
3609 QDate date = selectedDates.first();
3610 if ( ! date.isValid() ) {
3611 topLevelWidget()->setCaption("");
3612 return;
3613 }
3614
3609 QString selDates; 3615 QString selDates;
3610 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3616 selDates = KGlobal::locale()->formatDate( date, true);
3611 if (selectedDates.first() < selectedDates.last() ) 3617 if (selectedDates.first() < selectedDates.last() )
3612 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3618 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3613 else { 3619 else {
3614 QString addString; 3620 QString addString;
3615 if ( selectedDates.first() == QDateTime::currentDateTime().date() ) 3621 if ( date == QDateTime::currentDateTime().date() )
3616 addString = i18n("Today"); 3622 addString = i18n("Today");
3617 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 3623 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3618 addString = i18n("Tomorrow"); 3624 addString = i18n("Tomorrow");
3619 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 3625 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3620 addString = i18n("Yesterday"); 3626 addString = i18n("Yesterday");
3621 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 3627 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3622 addString = i18n("Day before yesterday"); 3628 addString = i18n("Day before yesterday");
3623 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 3629 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3624 addString = i18n("Day after tomorrow"); 3630 addString = i18n("Day after tomorrow");
3625 if ( !addString.isEmpty() ) { 3631 if ( !addString.isEmpty() ) {
3626 topLevelWidget()->setCaption( addString+", " + selDates ); 3632 topLevelWidget()->setCaption( addString+", " + selDates );
3627 return; 3633 return;
3628 } 3634 }
3629 } 3635 }
3630 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3636 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3631 3637
3632} 3638}
3633 3639
3634QPtrList<CalFilter> CalendarView::filters() 3640QPtrList<CalFilter> CalendarView::filters()
3635{ 3641{
3636 return mFilters; 3642 return mFilters;
3637 3643
3638} 3644}
3639void CalendarView::editFilters() 3645void CalendarView::editFilters()
3640{ 3646{
3641 // kdDebug() << "CalendarView::editFilters()" << endl; 3647 // kdDebug() << "CalendarView::editFilters()" << endl;
3642 3648
3643 CalFilter *filter = mFilters.first(); 3649 CalFilter *filter = mFilters.first();
3644 while(filter) { 3650 while(filter) {
3645 kdDebug() << " Filter: " << filter->name() << endl; 3651 kdDebug() << " Filter: " << filter->name() << endl;
3646 filter = mFilters.next(); 3652 filter = mFilters.next();
3647 } 3653 }
3648 3654
3649 mDialogManager->showFilterEditDialog(&mFilters); 3655 mDialogManager->showFilterEditDialog(&mFilters);
3650} 3656}
3651void CalendarView::toggleFilter() 3657void CalendarView::toggleFilter()
3652{ 3658{
3653 showFilter(! mFilterView->isVisible()); 3659 showFilter(! mFilterView->isVisible());
3654} 3660}
3655 3661
3656KOFilterView *CalendarView::filterView() 3662KOFilterView *CalendarView::filterView()
3657{ 3663{
3658 return mFilterView; 3664 return mFilterView;
3659} 3665}
3660void CalendarView::selectFilter( int fil ) 3666void CalendarView::selectFilter( int fil )
3661{ 3667{
3662 mFilterView->setSelectedFilter( fil ); 3668 mFilterView->setSelectedFilter( fil );
3663} 3669}
3664void CalendarView::showFilter(bool visible) 3670void CalendarView::showFilter(bool visible)
3665{ 3671{
3666 if (visible) mFilterView->show(); 3672 if (visible) mFilterView->show();
3667 else mFilterView->hide(); 3673 else mFilterView->hide();
3668} 3674}
3669void CalendarView::toggleFilerEnabled( ) 3675void CalendarView::toggleFilerEnabled( )
3670{ 3676{
3671 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3677 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3672 if ( !mFilterView->filtersEnabled() ) 3678 if ( !mFilterView->filtersEnabled() )
3673 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3679 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3674 3680
3675} 3681}
3676void CalendarView::updateFilter() 3682void CalendarView::updateFilter()
3677{ 3683{
3678 CalFilter *filter = mFilterView->selectedFilter(); 3684 CalFilter *filter = mFilterView->selectedFilter();
3679 if (filter) { 3685 if (filter) {
3680 QString mess; 3686 QString mess;
3681 if (mFilterView->filtersEnabled()) { 3687 if (mFilterView->filtersEnabled()) {
3682 mess = i18n("Filter selected: ")+filter->name(); 3688 mess = i18n("Filter selected: ")+filter->name();
3683 filter->setEnabled(true); 3689 filter->setEnabled(true);
3684 } 3690 }
3685 else filter->setEnabled(false); 3691 else filter->setEnabled(false);
3686 mCalendar->setFilter(filter); 3692 mCalendar->setFilter(filter);
3687 updateView(); 3693 updateView();
3688 if ( !mess.isEmpty() ) 3694 if ( !mess.isEmpty() )
3689 topLevelWidget()->setCaption( mess ); 3695 topLevelWidget()->setCaption( mess );
3690 3696
3691 } 3697 }
3692} 3698}
3693 3699
3694void CalendarView::filterEdited() 3700void CalendarView::filterEdited()
3695{ 3701{
3696 mFilterView->updateFilters(); 3702 mFilterView->updateFilters();
3697 updateFilter(); 3703 updateFilter();
3698 writeSettings(); 3704 writeSettings();
3699} 3705}
3700 3706
3701 3707
3702void CalendarView::takeOverEvent() 3708void CalendarView::takeOverEvent()
3703{ 3709{
3704 Incidence *incidence = currentSelection(); 3710 Incidence *incidence = currentSelection();
3705 3711
3706 if (!incidence) return; 3712 if (!incidence) return;
3707 3713
3708 incidence->setOrganizer(KOPrefs::instance()->email()); 3714 incidence->setOrganizer(KOPrefs::instance()->email());
3709 incidence->recreate(); 3715 incidence->recreate();
3710 incidence->setReadOnly(false); 3716 incidence->setReadOnly(false);
3711 3717
3712 updateView(); 3718 updateView();
3713} 3719}
3714 3720
3715void CalendarView::takeOverCalendar() 3721void CalendarView::takeOverCalendar()
3716{ 3722{
3717 // TODO: Create Calendar::allIncidences() function and use it here 3723 // TODO: Create Calendar::allIncidences() function and use it here
3718 3724
3719 QPtrList<Event> events = mCalendar->events(); 3725 QPtrList<Event> events = mCalendar->events();
3720 for(uint i=0; i<events.count(); ++i) { 3726 for(uint i=0; i<events.count(); ++i) {
3721 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3727 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3722 events.at(i)->recreate(); 3728 events.at(i)->recreate();
3723 events.at(i)->setReadOnly(false); 3729 events.at(i)->setReadOnly(false);
3724 } 3730 }
3725 3731
3726 QPtrList<Todo> todos = mCalendar->todos(); 3732 QPtrList<Todo> todos = mCalendar->todos();
3727 for(uint i=0; i<todos.count(); ++i) { 3733 for(uint i=0; i<todos.count(); ++i) {
3728 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3734 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3729 todos.at(i)->recreate(); 3735 todos.at(i)->recreate();
3730 todos.at(i)->setReadOnly(false); 3736 todos.at(i)->setReadOnly(false);
3731 } 3737 }
3732 3738
3733 QPtrList<Journal> journals = mCalendar->journals(); 3739 QPtrList<Journal> journals = mCalendar->journals();
3734 for(uint i=0; i<journals.count(); ++i) { 3740 for(uint i=0; i<journals.count(); ++i) {
3735 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3741 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3736 journals.at(i)->recreate(); 3742 journals.at(i)->recreate();
3737 journals.at(i)->setReadOnly(false); 3743 journals.at(i)->setReadOnly(false);
3738 } 3744 }
3739 3745
3740 updateView(); 3746 updateView();
3741} 3747}
3742 3748
3743void CalendarView::showIntro() 3749void CalendarView::showIntro()
3744{ 3750{
3745 kdDebug() << "To be implemented." << endl; 3751 kdDebug() << "To be implemented." << endl;
3746} 3752}
3747 3753
3748QWidgetStack *CalendarView::viewStack() 3754QWidgetStack *CalendarView::viewStack()
3749{ 3755{
3750 return mRightFrame; 3756 return mRightFrame;
3751} 3757}
3752 3758
3753QWidget *CalendarView::leftFrame() 3759QWidget *CalendarView::leftFrame()
3754{ 3760{
3755 return ( QWidget *)mLeftFrame; 3761 return ( QWidget *)mLeftFrame;
3756} 3762}
3757 3763
3758DateNavigator *CalendarView::dateNavigator() 3764DateNavigator *CalendarView::dateNavigator()
3759{ 3765{
3760 return mNavigator; 3766 return mNavigator;
3761} 3767}
3762 3768
3763KDateNavigator* CalendarView::dateNavigatorWidget() 3769KDateNavigator* CalendarView::dateNavigatorWidget()
3764{ 3770{
3765 return mDateNavigator->navigatorView(); 3771 return mDateNavigator->navigatorView();
3766} 3772}
3767void CalendarView::toggleDateNavigatorWidget() 3773void CalendarView::toggleDateNavigatorWidget()
3768{ 3774{
3769 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3775 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3770 3776
3771 if (!KOPrefs::instance()->mShowDateNavigator ) 3777 if (!KOPrefs::instance()->mShowDateNavigator )
3772 mDateNavigator->hide(); 3778 mDateNavigator->hide();
3773 else 3779 else
3774 mDateNavigator->show(); 3780 mDateNavigator->show();
3775} 3781}
3776void CalendarView::addView(KOrg::BaseView *view) 3782void CalendarView::addView(KOrg::BaseView *view)
3777{ 3783{
3778 mViewManager->addView(view); 3784 mViewManager->addView(view);
3779} 3785}
3780 3786
3781void CalendarView::showView(KOrg::BaseView *view) 3787void CalendarView::showView(KOrg::BaseView *view)
3782{ 3788{
3783 mViewManager->showView(view, mLeftFrame->isVisible()); 3789 mViewManager->showView(view, mLeftFrame->isVisible());
3784} 3790}
3785 3791
3786Incidence *CalendarView::currentSelection() 3792Incidence *CalendarView::currentSelection()
3787{ 3793{
3788 return mViewManager->currentSelection(); 3794 return mViewManager->currentSelection();
3789} 3795}
3790void CalendarView::toggleAllDaySize() 3796void CalendarView::toggleAllDaySize()
3791{ 3797{
3792 /* 3798 /*
3793 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3799 if ( KOPrefs::instance()->mAllDaySize > 47 )
3794 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3800 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3795 else 3801 else
3796 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3802 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3797 */ 3803 */
3798 viewManager()->agendaView()->toggleAllDay(); 3804 viewManager()->agendaView()->toggleAllDay();
3799} 3805}
3800void CalendarView::toggleExpand() 3806void CalendarView::toggleExpand()
3801{ 3807{
3802 // if ( mLeftFrame->isHidden() ) { 3808 // if ( mLeftFrame->isHidden() ) {
3803 // mLeftFrame->show(); 3809 // mLeftFrame->show();
3804 // emit calendarViewExpanded( false ); 3810 // emit calendarViewExpanded( false );
3805 // } else { 3811 // } else {
3806 // mLeftFrame->hide(); 3812 // mLeftFrame->hide();
3807 // emit calendarViewExpanded( true ); 3813 // emit calendarViewExpanded( true );
3808 // } 3814 // }
3809 //qDebug(" CalendarView::toggleExpand()"); 3815 //qDebug(" CalendarView::toggleExpand()");
3810 globalFlagBlockAgenda = 1; 3816 globalFlagBlockAgenda = 1;
3811 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3817 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3812 globalFlagBlockAgenda = 5; 3818 globalFlagBlockAgenda = 5;
3813 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3819 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3814 //mViewManager->showView( 0, true ); 3820 //mViewManager->showView( 0, true );
3815} 3821}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7faf675..7d5cf72 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,336 +1,336 @@
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 <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131int globalFlagBlockStartup; 131int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 133 QMainWindow( parent, name )
134{ 134{
135 135
136 mClosed = false; 136 mClosed = false;
137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
138 QString confFile = locateLocal("config","korganizerrc"); 138 QString confFile = locateLocal("config","korganizerrc");
139 QFileInfo finf ( confFile ); 139 QFileInfo finf ( confFile );
140 bool showWarning = !finf.exists(); 140 bool showWarning = !finf.exists();
141 setIcon(SmallIcon( "ko24" ) ); 141 setIcon(SmallIcon( "ko24" ) );
142 mBlockAtStartup = true; 142 mBlockAtStartup = true;
143 mFlagKeyPressed = false; 143 mFlagKeyPressed = false;
144 setCaption("KOrganizer/Pi"); 144 setCaption("KO/Pi");
145 KOPrefs *p = KOPrefs::instance(); 145 KOPrefs *p = KOPrefs::instance();
146 KPimGlobalPrefs::instance()->setGlobalConfig(); 146 KPimGlobalPrefs::instance()->setGlobalConfig();
147 if ( p->mHourSize > 22 ) 147 if ( p->mHourSize > 22 )
148 p->mHourSize = 22; 148 p->mHourSize = 22;
149 QMainWindow::ToolBarDock tbd; 149 QMainWindow::ToolBarDock tbd;
150 if ( p->mToolBarHor ) { 150 if ( p->mToolBarHor ) {
151 if ( p->mToolBarUp ) 151 if ( p->mToolBarUp )
152 tbd = Bottom; 152 tbd = Bottom;
153 else 153 else
154 tbd = Top; 154 tbd = Top;
155 } 155 }
156 else { 156 else {
157 if ( p->mToolBarUp ) 157 if ( p->mToolBarUp )
158 tbd = Right; 158 tbd = Right;
159 else 159 else
160 tbd = Left; 160 tbd = Left;
161 } 161 }
162 if ( KOPrefs::instance()->mUseAppColors ) 162 if ( KOPrefs::instance()->mUseAppColors )
163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
164 globalFlagBlockStartup = 1; 164 globalFlagBlockStartup = 1;
165 iconToolBar = new QPEToolBar( this ); 165 iconToolBar = new QPEToolBar( this );
166 addToolBar (iconToolBar , tbd ); 166 addToolBar (iconToolBar , tbd );
167 mCalendarModifiedFlag = false; 167 mCalendarModifiedFlag = false;
168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
169 splash->setAlignment ( AlignCenter ); 169 splash->setAlignment ( AlignCenter );
170 setCentralWidget( splash ); 170 setCentralWidget( splash );
171#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
172 showMaximized(); 172 showMaximized();
173#endif 173#endif
174 174
175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
176 setDefaultPreferences(); 176 setDefaultPreferences();
177 mCalendar = new CalendarLocal(); 177 mCalendar = new CalendarLocal();
178 mView = new CalendarView( mCalendar, this,"mCalendar " ); 178 mView = new CalendarView( mCalendar, this,"mCalendar " );
179 mView->hide(); 179 mView->hide();
180 //mView->resize(splash->size() ); 180 //mView->resize(splash->size() );
181 initActions(); 181 initActions();
182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
183 mSyncManager->setBlockSave(false); 183 mSyncManager->setBlockSave(false);
184 mView->setSyncManager(mSyncManager); 184 mView->setSyncManager(mSyncManager);
185#ifndef DESKTOP_VERSION 185#ifndef DESKTOP_VERSION
186 iconToolBar->show(); 186 iconToolBar->show();
187 qApp->processEvents(); 187 qApp->processEvents();
188#endif 188#endif
189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
190 int vh = height() ; 190 int vh = height() ;
191 int vw = width(); 191 int vw = width();
192 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 192 //qDebug("Toolbar hei %d ",iconToolBar->height() );
193 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 193 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
194 vh -= iconToolBar->height(); 194 vh -= iconToolBar->height();
195 } else { 195 } else {
196 vw -= iconToolBar->height(); 196 vw -= iconToolBar->height();
197 } 197 }
198 //mView->setMaximumSize( splash->size() ); 198 //mView->setMaximumSize( splash->size() );
199 //mView->resize( splash->size() ); 199 //mView->resize( splash->size() );
200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
201 mView->readSettings(); 201 mView->readSettings();
202 bool newFile = false; 202 bool newFile = false;
203 if( !QFile::exists( defaultFileName() ) ) { 203 if( !QFile::exists( defaultFileName() ) ) {
204 QFileInfo finfo ( defaultFileName() ); 204 QFileInfo finfo ( defaultFileName() );
205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
206 qDebug("oldfile %s ", oldFile.latin1()); 206 qDebug("oldfile %s ", oldFile.latin1());
207 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"; 207 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";
208 finfo.setFile( oldFile ); 208 finfo.setFile( oldFile );
209 if (finfo.exists() ) { 209 if (finfo.exists() ) {
210 KMessageBox::information( this, message); 210 KMessageBox::information( this, message);
211 mView->openCalendar( oldFile ); 211 mView->openCalendar( oldFile );
212 qApp->processEvents(); 212 qApp->processEvents();
213 } else { 213 } else {
214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
215 finfo.setFile( oldFile ); 215 finfo.setFile( oldFile );
216 if (finfo.exists() ) { 216 if (finfo.exists() ) {
217 KMessageBox::information( this, message); 217 KMessageBox::information( this, message);
218 mView->openCalendar( oldFile ); 218 mView->openCalendar( oldFile );
219 qApp->processEvents(); 219 qApp->processEvents();
220 } 220 }
221 } 221 }
222 mView->saveCalendar( defaultFileName() ); 222 mView->saveCalendar( defaultFileName() );
223 newFile = true; 223 newFile = true;
224 } 224 }
225 225
226 QTime neededSaveTime = QDateTime::currentDateTime().time(); 226 QTime neededSaveTime = QDateTime::currentDateTime().time();
227 mView->openCalendar( defaultFileName() ); 227 mView->openCalendar( defaultFileName() );
228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
229 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 229 qDebug("KO: Calendar loading time: %d ms",msNeeded );
230 230
231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
232 KOPrefs::instance()->setAllDefaults(); 232 KOPrefs::instance()->setAllDefaults();
233 int count = mView->addCategories(); 233 int count = mView->addCategories();
234 } 234 }
235 processIncidenceSelection( 0 ); 235 processIncidenceSelection( 0 );
236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
237 SLOT( processIncidenceSelection( Incidence * ) ) ); 237 SLOT( processIncidenceSelection( Incidence * ) ) );
238 connect( mView, SIGNAL( modifiedChanged( bool ) ), 238 connect( mView, SIGNAL( modifiedChanged( bool ) ),
239 SLOT( slotModifiedChanged( bool ) ) ); 239 SLOT( slotModifiedChanged( bool ) ) );
240 240
241 241
242 connect( mView, SIGNAL( tempDisableBR(bool) ), 242 connect( mView, SIGNAL( tempDisableBR(bool) ),
243 SLOT( disableBR(bool) ) ); 243 SLOT( disableBR(bool) ) );
244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
245 mView->setModified( false ); 245 mView->setModified( false );
246 mBlockAtStartup = false; 246 mBlockAtStartup = false;
247 mView->setModified( false ); 247 mView->setModified( false );
248 setCentralWidget( mView ); 248 setCentralWidget( mView );
249 globalFlagBlockStartup = 0; 249 globalFlagBlockStartup = 0;
250 mView->show(); 250 mView->show();
251 delete splash; 251 delete splash;
252 if ( newFile ) 252 if ( newFile )
253 mView->updateConfig(); 253 mView->updateConfig();
254 // qApp->processEvents(); 254 // qApp->processEvents();
255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
256 //fillSyncMenu(); 256 //fillSyncMenu();
257 257
258 258
259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( sentSyncFile()); 264 mSyncManager->setDefaultFileName( sentSyncFile());
265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
266 mSyncManager->fillSyncMenu(); 266 mSyncManager->fillSyncMenu();
267 267
268 268
269 269
270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
271 if ( showWarning ) { 271 if ( showWarning ) {
272 KMessageBox::information( this, 272 KMessageBox::information( this,
273 "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"); 273 "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");
274 qApp->processEvents(); 274 qApp->processEvents();
275 mView->dialogManager()->showSyncOptions(); 275 mView->dialogManager()->showSyncOptions();
276 } 276 }
277 277
278 //US listen for result adressed from Ka/Pi 278 //US listen for result adressed from Ka/Pi
279#ifndef DESKTOP_VERSION 279#ifndef DESKTOP_VERSION
280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
281#endif 281#endif
282#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
283 infrared = 0; 283 infrared = 0;
284#endif 284#endif
285 updateWeek( mView->startDate() ); 285 updateWeek( mView->startDate() );
286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
287 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 287 SLOT( updateWeekNum( const KCal::DateList & ) ) );
288 mBRdisabled = false; 288 mBRdisabled = false;
289 //toggleBeamReceive(); 289 //toggleBeamReceive();
290} 290}
291MainWindow::~MainWindow() 291MainWindow::~MainWindow()
292{ 292{
293 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 294 //save toolbar location
295 delete mCalendar; 295 delete mCalendar;
296 delete mSyncManager; 296 delete mSyncManager;
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 if ( infrared ) 298 if ( infrared )
299 delete infrared; 299 delete infrared;
300#endif 300#endif
301 301
302 302
303} 303}
304 304
305void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
306{ 306{
307#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
308 if ( b ) { 308 if ( b ) {
309 if ( infrared ) { 309 if ( infrared ) {
310 toggleBeamReceive(); 310 toggleBeamReceive();
311 mBRdisabled = true; 311 mBRdisabled = true;
312 } 312 }
313 mBRdisabled = true; 313 mBRdisabled = true;
314 } else { 314 } else {
315 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
316 mBRdisabled = false; 316 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 318 // toggleBeamReceive();
319 } 319 }
320 } 320 }
321#endif 321#endif
322 322
323} 323}
324bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
325{ 325{
326#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 327 return ( infrared != 0 );
328#endif 328#endif
329 return false; 329 return false;
330} 330}
331 331
332void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
333{ 333{
334 if ( mBRdisabled ) 334 if ( mBRdisabled )
335 return; 335 return;
336#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
@@ -1663,396 +1663,409 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1663 mView->viewManager()->showDayView(); 1663 mView->viewManager()->showDayView();
1664 showSelectedDates = true; 1664 showSelectedDates = true;
1665 break; 1665 break;
1666 case Qt::Key_O: 1666 case Qt::Key_O:
1667 mView->toggleFilerEnabled( ); 1667 mView->toggleFilerEnabled( );
1668 break; 1668 break;
1669 case Qt::Key_0: 1669 case Qt::Key_0:
1670 case Qt::Key_1: 1670 case Qt::Key_1:
1671 case Qt::Key_2: 1671 case Qt::Key_2:
1672 case Qt::Key_3: 1672 case Qt::Key_3:
1673 case Qt::Key_4: 1673 case Qt::Key_4:
1674 case Qt::Key_5: 1674 case Qt::Key_5:
1675 case Qt::Key_6: 1675 case Qt::Key_6:
1676 case Qt::Key_7: 1676 case Qt::Key_7:
1677 case Qt::Key_8: 1677 case Qt::Key_8:
1678 case Qt::Key_9: 1678 case Qt::Key_9:
1679 pro = e->key()-48; 1679 pro = e->key()-48;
1680 if ( pro == 0 ) 1680 if ( pro == 0 )
1681 pro = 10; 1681 pro = 10;
1682 if ( e->state() == Qt::ControlButton) 1682 if ( e->state() == Qt::ControlButton)
1683 pro += 10; 1683 pro += 10;
1684 break; 1684 break;
1685 case Qt::Key_M: 1685 case Qt::Key_M:
1686 mView->viewManager()->showMonthView(); 1686 mView->viewManager()->showMonthView();
1687 showSelectedDates = true; 1687 showSelectedDates = true;
1688 break; 1688 break;
1689 case Qt::Key_Insert: 1689 case Qt::Key_Insert:
1690 mView->newEvent(); 1690 mView->newEvent();
1691 break; 1691 break;
1692 case Qt::Key_S : 1692 case Qt::Key_S :
1693 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1693 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1694 mView->newSubTodo(); 1694 mView->newSubTodo();
1695 else 1695 else
1696 mView->dialogManager()->showSearchDialog(); 1696 mView->dialogManager()->showSearchDialog();
1697 break; 1697 break;
1698 case Qt::Key_Y : 1698 case Qt::Key_Y :
1699 case Qt::Key_Z : 1699 case Qt::Key_Z :
1700 mView->viewManager()->showWorkWeekView(); 1700 mView->viewManager()->showWorkWeekView();
1701 showSelectedDates = true; 1701 showSelectedDates = true;
1702 break; 1702 break;
1703 case Qt::Key_U : 1703 case Qt::Key_U :
1704 mView->viewManager()->showWeekView(); 1704 mView->viewManager()->showWeekView();
1705 showSelectedDates = true; 1705 showSelectedDates = true;
1706 break; 1706 break;
1707 case Qt::Key_H : 1707 case Qt::Key_H :
1708 keyBindings(); 1708 keyBindings();
1709 break; 1709 break;
1710 case Qt::Key_W: 1710 case Qt::Key_W:
1711 mView->viewManager()->showWhatsNextView(); 1711 mView->viewManager()->showWhatsNextView();
1712 break; 1712 break;
1713 case Qt::Key_L: 1713 case Qt::Key_L:
1714 mView->viewManager()->showListView(); 1714 mView->viewManager()->showListView();
1715 break; 1715 break;
1716 case Qt::Key_N: 1716 case Qt::Key_N:
1717 mView->viewManager()->showNextXView(); 1717 mView->viewManager()->showNextXView();
1718 showSelectedDates = true; 1718 showSelectedDates = true;
1719 break; 1719 break;
1720 case Qt::Key_V: 1720 case Qt::Key_V:
1721 mView->viewManager()->showTodoView(); 1721 mView->viewManager()->showTodoView();
1722 break; 1722 break;
1723 case Qt::Key_C: 1723 case Qt::Key_C:
1724 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1724 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1725 break; 1725 break;
1726 case Qt::Key_P: 1726 case Qt::Key_P:
1727 mView->showDatePicker( ); 1727 mView->showDatePicker( );
1728 break; 1728 break;
1729 case Qt::Key_F: 1729 case Qt::Key_F:
1730 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1730 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1731 mView->editFilters(); 1731 mView->editFilters();
1732 else 1732 else
1733 mView->toggleFilter(); 1733 mView->toggleFilter();
1734 break; 1734 break;
1735 case Qt::Key_X: 1735 case Qt::Key_X:
1736 mView->toggleDateNavigatorWidget(); 1736 mView->toggleDateNavigatorWidget();
1737 break; 1737 break;
1738 case Qt::Key_Space: 1738 case Qt::Key_Space:
1739 mView->toggleExpand(); 1739 mView->toggleExpand();
1740 break; 1740 break;
1741 case Qt::Key_A: 1741 case Qt::Key_A:
1742 mView->toggleAllDaySize(); 1742 mView->toggleAllDaySize();
1743 break; 1743 break;
1744 case Qt::Key_T: 1744 case Qt::Key_T:
1745 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1745 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1746 mView->newTodo(); 1746 mView->newTodo();
1747 else { 1747 else {
1748 mView->goToday(); 1748 mView->goToday();
1749 showSelectedDates = true; 1749 showSelectedDates = true;
1750 } 1750 }
1751 break; 1751 break;
1752 case Qt::Key_J: 1752 case Qt::Key_J:
1753 mView->viewManager()->showJournalView(); 1753 mView->viewManager()->showJournalView();
1754 break; 1754 break;
1755 case Qt::Key_B: 1755 case Qt::Key_B:
1756 mView->editIncidenceDescription();; 1756 mView->editIncidenceDescription();;
1757 break; 1757 break;
1758 // case Qt::Key_Return: 1758 // case Qt::Key_Return:
1759 case Qt::Key_E: 1759 case Qt::Key_E:
1760 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1760 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1761 mView->newEvent(); 1761 mView->newEvent();
1762 else 1762 else
1763 mView->editIncidence(); 1763 mView->editIncidence();
1764 break; 1764 break;
1765 case Qt::Key_Plus: 1765 case Qt::Key_Plus:
1766 size = p->mHourSize +2; 1766 size = p->mHourSize +2;
1767 if ( size <= 22 ) 1767 if ( size <= 22 )
1768 configureAgenda( size ); 1768 configureAgenda( size );
1769 break; 1769 break;
1770 case Qt::Key_Minus: 1770 case Qt::Key_Minus:
1771 size = p->mHourSize - 2; 1771 size = p->mHourSize - 2;
1772 if ( size >= 4 ) 1772 if ( size >= 4 )
1773 configureAgenda( size ); 1773 configureAgenda( size );
1774 break; 1774 break;
1775 1775
1776 1776
1777 default: 1777 default:
1778 e->ignore(); 1778 e->ignore();
1779 } 1779 }
1780 if ( pro > 0 ) { 1780 if ( pro > 0 ) {
1781 mView->selectFilter( pro-1 ); 1781 mView->selectFilter( pro-1 );
1782 } 1782 }
1783 if ( showSelectedDates ) { 1783 if ( showSelectedDates ) {
1784 ;// setCaptionToDates(); 1784 ;// setCaptionToDates();
1785 } 1785 }
1786 1786
1787} 1787}
1788 1788
1789void MainWindow::fillFilterMenu() 1789void MainWindow::fillFilterMenu()
1790{ 1790{
1791 selectFilterMenu->clear(); 1791 selectFilterMenu->clear();
1792 bool disable = false; 1792 bool disable = false;
1793 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1793 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1794 selectFilterMenu->insertSeparator(); 1794 selectFilterMenu->insertSeparator();
1795 if ( mView->filterView()->filtersEnabled() ) { 1795 if ( mView->filterView()->filtersEnabled() ) {
1796 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1796 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1797 } 1797 }
1798 else { 1798 else {
1799 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1799 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1800 disable = true; 1800 disable = true;
1801 } 1801 }
1802 selectFilterMenu->insertSeparator(); 1802 selectFilterMenu->insertSeparator();
1803 QPtrList<CalFilter> fili = mView->filters(); 1803 QPtrList<CalFilter> fili = mView->filters();
1804 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1804 CalFilter *curfilter = mView->filterView()->selectedFilter();
1805 CalFilter *filter = fili.first(); 1805 CalFilter *filter = fili.first();
1806 int iii = 2; 1806 int iii = 2;
1807 while(filter) { 1807 while(filter) {
1808 selectFilterMenu->insertItem( filter->name(), iii ); 1808 selectFilterMenu->insertItem( filter->name(), iii );
1809 if ( filter == curfilter) 1809 if ( filter == curfilter)
1810 selectFilterMenu->setItemChecked( iii, true ); 1810 selectFilterMenu->setItemChecked( iii, true );
1811 if ( disable ) 1811 if ( disable )
1812 selectFilterMenu->setItemEnabled( iii, false ); 1812 selectFilterMenu->setItemEnabled( iii, false );
1813 filter = fili.next(); 1813 filter = fili.next();
1814 ++iii; 1814 ++iii;
1815 } 1815 }
1816} 1816}
1817void MainWindow::selectFilter( int fil ) 1817void MainWindow::selectFilter( int fil )
1818{ 1818{
1819 if ( fil == 0 ) { 1819 if ( fil == 0 ) {
1820 mView->editFilters( ); 1820 mView->editFilters( );
1821 } else if ( fil == 1 ){ 1821 } else if ( fil == 1 ){
1822 mView->toggleFilerEnabled( ); 1822 mView->toggleFilerEnabled( );
1823 } else { 1823 } else {
1824 mView->selectFilter( fil-2 ); 1824 mView->selectFilter( fil-2 );
1825 } 1825 }
1826} 1826}
1827void MainWindow::configureToolBar( int item ) 1827void MainWindow::configureToolBar( int item )
1828{ 1828{
1829 1829
1830 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1830 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1831 KOPrefs *p = KOPrefs::instance(); 1831 KOPrefs *p = KOPrefs::instance();
1832 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1832 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1833 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1833 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1834 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1834 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1835 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1835 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1836 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1836 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1837 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1837 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1838 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1838 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1839 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 1839 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
1840 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1840 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1841 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1841 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1842 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1842 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1843 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1843 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1844 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1844 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1845 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1845 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1846 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1846 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1847 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1847 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1848 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1848 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1849 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1849 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1850 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1850 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1851 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1851 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1852 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 1852 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
1853 // initActions(); 1853 // initActions();
1854} 1854}
1855 1855void MainWindow::setCaption ( const QString & c )
1856{
1857 QString cap = c;
1858 cap.replace( QRegExp("\n"), " " );
1859 cap = cap.stripWhiteSpace();
1860 if ( cap.isEmpty() )
1861 cap = "KO/Pi";
1862 QWidget::setCaption( cap );
1863}
1856void MainWindow::setCaptionToDates() 1864void MainWindow::setCaptionToDates()
1857{ 1865{
1858 QString selDates; 1866 QString selDates;
1859 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1867 QDate date = mView->startDate();
1868 if ( ! date.isValid() ) {
1869 setCaption("");
1870 return;
1871 }
1872 selDates = KGlobal::locale()->formatDate( date, true);
1860 if (mView->startDate() < mView->endDate() ) 1873 if (mView->startDate() < mView->endDate() )
1861 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1874 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1862 else { 1875 else {
1863 QString addString; 1876 QString addString;
1864 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1877 if ( date == QDateTime::currentDateTime().date() )
1865 addString = i18n("Today"); 1878 addString = i18n("Today");
1866 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1879 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
1867 addString = i18n("Tomorrow"); 1880 addString = i18n("Tomorrow");
1868 if ( !addString.isEmpty() ) 1881 if ( !addString.isEmpty() )
1869 selDates = addString+", "+selDates ; 1882 selDates = addString+", "+selDates ;
1870 } 1883 }
1871 setCaption( i18n("Dates: ") + selDates ); 1884 setCaption( i18n("Dates: ") + selDates );
1872 1885
1873} 1886}
1874void MainWindow::showConfigureAgenda( ) 1887void MainWindow::showConfigureAgenda( )
1875{ 1888{
1876 int iii; 1889 int iii;
1877 for ( iii = 1;iii<= 10 ;++iii ){ 1890 for ( iii = 1;iii<= 10 ;++iii ){
1878 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1891 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1879 } 1892 }
1880 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1893 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1881} 1894}
1882void MainWindow::configureAgenda( int item ) 1895void MainWindow::configureAgenda( int item )
1883{ 1896{
1884 if ( KOPrefs::instance()->mHourSize == item ) 1897 if ( KOPrefs::instance()->mHourSize == item )
1885 return; 1898 return;
1886 KOPrefs::instance()->mHourSize=item; 1899 KOPrefs::instance()->mHourSize=item;
1887 mView->viewManager()->agendaView()->updateConfig(); 1900 mView->viewManager()->agendaView()->updateConfig();
1888} 1901}
1889 1902
1890void MainWindow::saveCalendar() 1903void MainWindow::saveCalendar()
1891{ 1904{
1892 QString fn = KOPrefs::instance()->mLastSaveFile; 1905 QString fn = KOPrefs::instance()->mLastSaveFile;
1893 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1906 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1894 1907
1895 if ( fn == "" ) 1908 if ( fn == "" )
1896 return; 1909 return;
1897 QFileInfo info; 1910 QFileInfo info;
1898 info.setFile( fn ); 1911 info.setFile( fn );
1899 QString mes; 1912 QString mes;
1900 bool createbup = true; 1913 bool createbup = true;
1901 if ( info. exists() ) { 1914 if ( info. exists() ) {
1902 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1915 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1903 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1916 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1904 i18n("Overwrite!"), i18n("Cancel"), 0, 1917 i18n("Overwrite!"), i18n("Cancel"), 0,
1905 0, 1 ); 1918 0, 1 );
1906 if ( result != 0 ) { 1919 if ( result != 0 ) {
1907 createbup = false; 1920 createbup = false;
1908 } 1921 }
1909 } 1922 }
1910 if ( createbup ) { 1923 if ( createbup ) {
1911 mView->saveCalendar( fn ); 1924 mView->saveCalendar( fn );
1912 mes = i18n("KO/Pi:Saved %1").arg(fn); 1925 mes = i18n("KO/Pi:Saved %1").arg(fn);
1913 KOPrefs::instance()->mLastSaveFile = fn; 1926 KOPrefs::instance()->mLastSaveFile = fn;
1914 setCaption(mes); 1927 setCaption(mes);
1915 } 1928 }
1916} 1929}
1917void MainWindow::loadCalendar() 1930void MainWindow::loadCalendar()
1918{ 1931{
1919 1932
1920 QString fn = KOPrefs::instance()->mLastLoadFile; 1933 QString fn = KOPrefs::instance()->mLastLoadFile;
1921 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1934 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1922 1935
1923 if ( fn == "" ) 1936 if ( fn == "" )
1924 return; 1937 return;
1925 QFileInfo info; 1938 QFileInfo info;
1926 info.setFile( fn ); 1939 info.setFile( fn );
1927 QString mess; 1940 QString mess;
1928 bool loadbup = true; 1941 bool loadbup = true;
1929 if ( info. exists() ) { 1942 if ( info. exists() ) {
1930 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1943 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1931 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1944 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1932 mess, 1945 mess,
1933 i18n("Load!"), i18n("Cancel"), 0, 1946 i18n("Load!"), i18n("Cancel"), 0,
1934 0, 1 ); 1947 0, 1 );
1935 if ( result != 0 ) { 1948 if ( result != 0 ) {
1936 loadbup = false; 1949 loadbup = false;
1937 } 1950 }
1938 } else { 1951 } else {
1939 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1952 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1940 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1953 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1941 0, 1 ); 1954 0, 1 );
1942 1955
1943 return; 1956 return;
1944 } 1957 }
1945 if ( loadbup ) { 1958 if ( loadbup ) {
1946 mView->openCalendar( fn ); 1959 mView->openCalendar( fn );
1947 KOPrefs::instance()->mLastLoadFile = fn; 1960 KOPrefs::instance()->mLastLoadFile = fn;
1948 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1961 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1949 setCaption(mess); 1962 setCaption(mess);
1950 } 1963 }
1951 1964
1952} 1965}
1953void MainWindow::quickImportIcal() 1966void MainWindow::quickImportIcal()
1954{ 1967{
1955 importFile( KOPrefs::instance()->mLastImportFile, false ); 1968 importFile( KOPrefs::instance()->mLastImportFile, false );
1956} 1969}
1957void MainWindow::importFile( QString fn, bool quick ) 1970void MainWindow::importFile( QString fn, bool quick )
1958{ 1971{
1959 QFileInfo info; 1972 QFileInfo info;
1960 info.setFile( fn ); 1973 info.setFile( fn );
1961 QString mess; 1974 QString mess;
1962 bool loadbup = true; 1975 bool loadbup = true;
1963 if ( !info. exists() ) { 1976 if ( !info. exists() ) {
1964 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1977 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1965 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1978 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1966 mess ); 1979 mess );
1967 return; 1980 return;
1968 } 1981 }
1969 int result = 0; 1982 int result = 0;
1970 if ( !quick ) { 1983 if ( !quick ) {
1971 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 )); 1984 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 ));
1972 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1985 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1973 mess, 1986 mess,
1974 "Import", "Cancel", 0, 1987 "Import", "Cancel", 0,
1975 0, 1 ); 1988 0, 1 );
1976 } 1989 }
1977 if ( result == 0 ) { 1990 if ( result == 0 ) {
1978 if ( mView->openCalendar( fn, true )) { 1991 if ( mView->openCalendar( fn, true )) {
1979 KOPrefs::instance()->mLastImportFile = fn; 1992 KOPrefs::instance()->mLastImportFile = fn;
1980 setCaption(i18n("Imported file successfully")); 1993 setCaption(i18n("Imported file successfully"));
1981 } else { 1994 } else {
1982 setCaption(i18n("Error importing file")); 1995 setCaption(i18n("Error importing file"));
1983 } 1996 }
1984 } 1997 }
1985} 1998}
1986 1999
1987void MainWindow::importIcal() 2000void MainWindow::importIcal()
1988{ 2001{
1989 2002
1990 QString fn =KOPrefs::instance()->mLastImportFile; 2003 QString fn =KOPrefs::instance()->mLastImportFile;
1991 2004
1992 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2005 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1993 if ( fn == "" ) 2006 if ( fn == "" )
1994 return; 2007 return;
1995 importFile( fn, true ); 2008 importFile( fn, true );
1996 2009
1997} 2010}
1998 2011
1999void MainWindow::exportVCalendar() 2012void MainWindow::exportVCalendar()
2000{ 2013{
2001 QString fn = KOPrefs::instance()->mLastVcalFile; 2014 QString fn = KOPrefs::instance()->mLastVcalFile;
2002 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2015 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2003 if ( fn == "" ) 2016 if ( fn == "" )
2004 return; 2017 return;
2005 QFileInfo info; 2018 QFileInfo info;
2006 info.setFile( fn ); 2019 info.setFile( fn );
2007 QString mes; 2020 QString mes;
2008 bool createbup = true; 2021 bool createbup = true;
2009 if ( info. exists() ) { 2022 if ( info. exists() ) {
2010 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2023 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2011 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2024 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2012 i18n("Overwrite!"), i18n("Cancel"), 0, 2025 i18n("Overwrite!"), i18n("Cancel"), 0,
2013 0, 1 ); 2026 0, 1 );
2014 if ( result != 0 ) { 2027 if ( result != 0 ) {
2015 createbup = false; 2028 createbup = false;
2016 } 2029 }
2017 } 2030 }
2018 if ( createbup ) { 2031 if ( createbup ) {
2019 if ( mView->exportVCalendar( fn ) ) { 2032 if ( mView->exportVCalendar( fn ) ) {
2020 KOPrefs::instance()->mLastVcalFile = fn; 2033 KOPrefs::instance()->mLastVcalFile = fn;
2021 if ( fn.length() > 20 ) 2034 if ( fn.length() > 20 )
2022 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2035 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2023 else 2036 else
2024 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2037 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2025 setCaption(mes); 2038 setCaption(mes);
2026 } 2039 }
2027 } 2040 }
2028 2041
2029} 2042}
2030QString MainWindow::sentSyncFile() 2043QString MainWindow::sentSyncFile()
2031{ 2044{
2032#ifdef DESKTOP_VERSION 2045#ifdef DESKTOP_VERSION
2033 return locateLocal( "tmp", "copysynccal.ics" ); 2046 return locateLocal( "tmp", "copysynccal.ics" );
2034#else 2047#else
2035 return QString( "/tmp/copysynccal.ics" ); 2048 return QString( "/tmp/copysynccal.ics" );
2036#endif 2049#endif
2037} 2050}
2038 2051
2039void MainWindow::syncFileRequest() 2052void MainWindow::syncFileRequest()
2040{ 2053{
2041 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2054 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2042 mSyncManager->slotSyncMenu( 999 ); 2055 mSyncManager->slotSyncMenu( 999 );
2043 } 2056 }
2044 2057
2045 setCaption(i18n("Saving Data to temp file ..." )); 2058 setCaption(i18n("Saving Data to temp file ..." ));
2046 mView->saveCalendar( sentSyncFile() ); 2059 mView->saveCalendar( sentSyncFile() );
2047 setCaption(i18n("Data saved to temp file!" )); 2060 setCaption(i18n("Data saved to temp file!" ));
2048 2061
2049} 2062}
2050void MainWindow::getFile( bool success ) 2063void MainWindow::getFile( bool success )
2051{ 2064{
2052 if ( ! success ) { 2065 if ( ! success ) {
2053 setCaption( i18n("Error receiving file. Nothing changed!") ); 2066 setCaption( i18n("Error receiving file. Nothing changed!") );
2054 return; 2067 return;
2055 } 2068 }
2056 mView->openCalendar( sentSyncFile() ); 2069 mView->openCalendar( sentSyncFile() );
2057 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2070 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2058 mSyncManager->slotSyncMenu( 999 ); 2071 mSyncManager->slotSyncMenu( 999 );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 5808700..7604529 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,159 +1,160 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h" 13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 14#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
17#endif 17#endif
18class QAction; 18class QAction;
19class CalendarView; 19class CalendarView;
20class KSyncProfile; 20class KSyncProfile;
21#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
22 22
23#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 24#define QPEMenuBar QMenuBar
25#endif 25#endif
26class QPEToolBar; 26class QPEToolBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33class KOMenuBar : public QMenuBar 33class KOMenuBar : public QMenuBar
34{ 34{
35 public: 35 public:
36 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} 36 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
37 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} 37 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
38}; 38};
39 39
40using namespace KCal; 40using namespace KCal;
41 41
42class MainWindow : public QMainWindow 42class MainWindow : public QMainWindow
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 46 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
47 ~MainWindow(); 47 ~MainWindow();
48 bool beamReceiveEnabled(); 48 bool beamReceiveEnabled();
49 static QString defaultFileName(); 49 static QString defaultFileName();
50 static QString syncFileName(); 50 static QString syncFileName();
51 static QString resourcePath(); 51 static QString resourcePath();
52 public slots: 52 public slots:
53 void setCaption ( const QString & );
53 void updateWeekNum(const KCal::DateList &); 54 void updateWeekNum(const KCal::DateList &);
54 void updateWeek(QDate); 55 void updateWeek(QDate);
55 virtual void showMaximized (); 56 virtual void showMaximized ();
56 void configureAgenda( int ); 57 void configureAgenda( int );
57 void recieve( const QCString& msg, const QByteArray& data ); 58 void recieve( const QCString& msg, const QByteArray& data );
58 protected slots: 59 protected slots:
59 void setCaptionToDates(); 60 void setCaptionToDates();
60 void weekAction(); 61 void weekAction();
61 void about(); 62 void about();
62 void licence(); 63 void licence();
63 void faq(); 64 void faq();
64 void usertrans(); 65 void usertrans();
65 void features(); 66 void features();
66 void synchowto(); 67 void synchowto();
67 void kdesynchowto(); 68 void kdesynchowto();
68 void multisynchowto(); 69 void multisynchowto();
69 void whatsNew(); 70 void whatsNew();
70 void keyBindings(); 71 void keyBindings();
71 void aboutAutoSaving();; 72 void aboutAutoSaving();;
72 void aboutKnownBugs(); 73 void aboutKnownBugs();
73 74
74 void processIncidenceSelection( Incidence * ); 75 void processIncidenceSelection( Incidence * );
75 76
76 void importQtopia(); 77 void importQtopia();
77 void importBday(); 78 void importBday();
78 void importOL(); 79 void importOL();
79 void importIcal(); 80 void importIcal();
80 void importFile( QString, bool ); 81 void importFile( QString, bool );
81 void quickImportIcal(); 82 void quickImportIcal();
82 83
83 void slotModifiedChanged( bool ); 84 void slotModifiedChanged( bool );
84 85
85 void save(); 86 void save();
86 void saveStopTimer(); 87 void saveStopTimer();
87 void configureToolBar( int ); 88 void configureToolBar( int );
88 void printSel(); 89 void printSel();
89 void printCal(); 90 void printCal();
90 void saveCalendar(); 91 void saveCalendar();
91 void loadCalendar(); 92 void loadCalendar();
92 void exportVCalendar(); 93 void exportVCalendar();
93 void fillFilterMenu(); 94 void fillFilterMenu();
94 void selectFilter( int ); 95 void selectFilter( int );
95 void exportToPhone( int ); 96 void exportToPhone( int );
96 void toggleBeamReceive(); 97 void toggleBeamReceive();
97 void disableBR(bool); 98 void disableBR(bool);
98 signals: 99 signals:
99 void selectWeek ( int ); 100 void selectWeek ( int );
100 private slots: 101 private slots:
101 void showConfigureAgenda(); 102 void showConfigureAgenda();
102 void getFile( bool ); 103 void getFile( bool );
103 void syncFileRequest(); 104 void syncFileRequest();
104 105
105 protected: 106 protected:
106 QString sentSyncFile(); 107 QString sentSyncFile();
107 void displayText( QString, QString); 108 void displayText( QString, QString);
108 void enableIncidenceActions( bool ); 109 void enableIncidenceActions( bool );
109 110
110 private: 111 private:
111 bool mBRdisabled; 112 bool mBRdisabled;
112#ifndef DESKTOP_VERSION 113#ifndef DESKTOP_VERSION
113 QCopChannel* infrared; 114 QCopChannel* infrared;
114#endif 115#endif
115 QAction* brAction; 116 QAction* brAction;
116 KSyncManager* mSyncManager; 117 KSyncManager* mSyncManager;
117 bool mClosed; 118 bool mClosed;
118 void saveOnClose(); 119 void saveOnClose();
119 bool mFlagKeyPressed; 120 bool mFlagKeyPressed;
120 bool mBlockAtStartup; 121 bool mBlockAtStartup;
121 QPEToolBar *iconToolBar; 122 QPEToolBar *iconToolBar;
122 void initActions(); 123 void initActions();
123 void setDefaultPreferences(); 124 void setDefaultPreferences();
124 void keyPressEvent ( QKeyEvent * ) ; 125 void keyPressEvent ( QKeyEvent * ) ;
125 void keyReleaseEvent ( QKeyEvent * ) ; 126 void keyReleaseEvent ( QKeyEvent * ) ;
126 QPopupMenu *configureToolBarMenu; 127 QPopupMenu *configureToolBarMenu;
127 QPopupMenu *selectFilterMenu; 128 QPopupMenu *selectFilterMenu;
128 QPopupMenu *configureAgendaMenu, *syncMenu; 129 QPopupMenu *configureAgendaMenu, *syncMenu;
129 CalendarLocal *mCalendar; 130 CalendarLocal *mCalendar;
130 CalendarView *mView; 131 CalendarView *mView;
131 QAction *mNewSubTodoAction; 132 QAction *mNewSubTodoAction;
132 QAction *mWeekAction; 133 QAction *mWeekAction;
133 QFont mWeekFont; 134 QFont mWeekFont;
134 QPixmap mWeekPixmap; 135 QPixmap mWeekPixmap;
135 QColor mWeekBgColor; 136 QColor mWeekBgColor;
136 137
137 QAction *mShowAction; 138 QAction *mShowAction;
138 QAction *mEditAction; 139 QAction *mEditAction;
139 QAction *mDeleteAction; 140 QAction *mDeleteAction;
140 QAction *mCloneAction; 141 QAction *mCloneAction;
141 QAction *mMoveAction; 142 QAction *mMoveAction;
142 QAction *mBeamAction; 143 QAction *mBeamAction;
143 QAction *mCancelAction; 144 QAction *mCancelAction;
144 145
145 QAction *mToggleNav; 146 QAction *mToggleNav;
146 QAction *mToggleFilter; 147 QAction *mToggleFilter;
147 QAction *mToggleAllday; 148 QAction *mToggleAllday;
148 149
149 150
150 void closeEvent( QCloseEvent* ce ); 151 void closeEvent( QCloseEvent* ce );
151 SimpleAlarmClient mAlarmClient; 152 SimpleAlarmClient mAlarmClient;
152 QTimer mSaveTimer; 153 QTimer mSaveTimer;
153 //bool mBlockSaveFlag; 154 //bool mBlockSaveFlag;
154 bool mCalendarModifiedFlag; 155 bool mCalendarModifiedFlag;
155 QPixmap loadPixmap( QString ); 156 QPixmap loadPixmap( QString );
156}; 157};
157 158
158 159
159#endif 160#endif