summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-28 15:16:46 (UTC)
committer zautrix <zautrix>2005-03-28 15:16:46 (UTC)
commit435d67be852dc98b460bd3123a2164131db82334 (patch) (unidiff)
tree5d031d970da9214e111079061ccae271752c33c0
parente4e6bda3a6b0a82e3f64db0fa5f7d60cab9f0e48 (diff)
downloadkdepimpi-435d67be852dc98b460bd3123a2164131db82334.zip
kdepimpi-435d67be852dc98b460bd3123a2164131db82334.tar.gz
kdepimpi-435d67be852dc98b460bd3123a2164131db82334.tar.bz2
more fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ad1c0cd..2da592b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2314 +1,2346 @@
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 "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "simplealarmclient.h" 63#include "simplealarmclient.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65 65
66using namespace KCal; 66using namespace KCal;
67#ifndef _WIN32_ 67#ifndef _WIN32_
68#include <unistd.h> 68#include <unistd.h>
69#else 69#else
70#ifdef _OL_IMPORT_ 70#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 71#include "koimportoldialog.h"
72#endif 72#endif
73#endif 73#endif
74#include "mainwindow.h" 74#include "mainwindow.h"
75 75
76 76
77class KOex2phonePrefs : public QDialog 77class KOex2phonePrefs : public QDialog
78{ 78{
79 public: 79 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 81 QDialog( parent, name, true )
82 { 82 {
83 setCaption( i18n("Export to phone options") ); 83 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 84 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 85 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 86 lay->setMargin( 3 );
87 QLabel *lab; 87 QLabel *lab;
88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
89 lab->setAlignment (AlignHCenter ); 89 lab->setAlignment (AlignHCenter );
90 QHBox* temphb; 90 QHBox* temphb;
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("I/O device: "), temphb ); 92 new QLabel( i18n("I/O device: "), temphb );
93 mPhoneDevice = new QLineEdit( temphb); 93 mPhoneDevice = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 114 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 119 resize( 220, 240 );
120 qApp->processEvents(); 120 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
124 } 124 }
125 125
126public: 126public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
128 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
129 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
130}; 130};
131 131
132int globalFlagBlockStartup; 132int globalFlagBlockStartup;
133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
134 QMainWindow( parent, name ) 134 QMainWindow( parent, name )
135{ 135{
136 136
137 mClosed = false; 137 mClosed = false;
138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
139 QString confFile = locateLocal("config","korganizerrc"); 139 QString confFile = locateLocal("config","korganizerrc");
140 QFileInfo finf ( confFile ); 140 QFileInfo finf ( confFile );
141 bool showWarning = !finf.exists(); 141 bool showWarning = !finf.exists();
142 setIcon(SmallIcon( "ko24" ) ); 142 setIcon(SmallIcon( "ko24" ) );
143 mBlockAtStartup = true; 143 mBlockAtStartup = true;
144 mFlagKeyPressed = false; 144 mFlagKeyPressed = false;
145 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
146 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 if ( p->mHourSize > 22 ) 148 if ( p->mHourSize > 22 )
149 p->mHourSize = 22; 149 p->mHourSize = 22;
150 QMainWindow::ToolBarDock tbd; 150 QMainWindow::ToolBarDock tbd;
151 if ( p->mToolBarHor ) { 151 if ( p->mToolBarHor ) {
152 if ( p->mToolBarUp ) 152 if ( p->mToolBarUp )
153 tbd = Bottom; 153 tbd = Bottom;
154 else 154 else
155 tbd = Top; 155 tbd = Top;
156 } 156 }
157 else { 157 else {
158 if ( p->mToolBarUp ) 158 if ( p->mToolBarUp )
159 tbd = Right; 159 tbd = Right;
160 else 160 else
161 tbd = Left; 161 tbd = Left;
162 } 162 }
163 if ( KOPrefs::instance()->mUseAppColors ) 163 if ( KOPrefs::instance()->mUseAppColors )
164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
165 globalFlagBlockStartup = 1; 165 globalFlagBlockStartup = 1;
166 iconToolBar = new QPEToolBar( this ); 166 iconToolBar = new QPEToolBar( this );
167 addToolBar (iconToolBar , tbd ); 167 addToolBar (iconToolBar , tbd );
168 168
169 if ( KOPrefs::instance()->mShowIconFilter ) { 169 if ( KOPrefs::instance()->mShowIconFilter ) {
170 if ( p->mToolBarHorF ) { 170 if ( p->mToolBarHorF ) {
171 if ( p->mToolBarUpF ) 171 if ( p->mToolBarUpF )
172 tbd = Bottom; 172 tbd = Bottom;
173 else 173 else
174 tbd = Top; 174 tbd = Top;
175 } 175 }
176 else { 176 else {
177 if ( p->mToolBarUpF ) 177 if ( p->mToolBarUpF )
178 tbd = Right; 178 tbd = Right;
179 else 179 else
180 tbd = Left; 180 tbd = Left;
181 } 181 }
182 filterToolBar = new QPEToolBar ( this ); 182 filterToolBar = new QPEToolBar ( this );
183 filterMenubar = new QPEMenuBar( filterToolBar ); 183 filterMenubar = new QPEMenuBar( filterToolBar );
184 QFontMetrics fm ( filterMenubar->font() ); 184 QFontMetrics fm ( filterMenubar->font() );
185 185
186 filterPopupMenu = new QPopupMenu( this ); 186 filterPopupMenu = new QPopupMenu( this );
187 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 187 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
188 QString addTest = "Ax"; 188 QString addTest = "Ax";
189#ifdef DESKTOP_VERSION 189#ifdef DESKTOP_VERSION
190 addTest = "AAAx"; 190 addTest = "AAAx";
191#endif 191#endif
192 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); 192 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) );
193 addToolBar (filterToolBar , tbd ); 193 addToolBar (filterToolBar , tbd );
194 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 194 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
195 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 195 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
196 } else { 196 } else {
197 filterToolBar = 0; 197 filterToolBar = 0;
198 filterMenubar = 0; 198 filterMenubar = 0;
199 filterPopupMenu = 0; 199 filterPopupMenu = 0;
200 } 200 }
201 if ( p->mShowIconOnetoolbar ) { 201 if ( p->mShowIconOnetoolbar ) {
202 viewToolBar = iconToolBar ; 202 viewToolBar = iconToolBar ;
203 navigatorToolBar = iconToolBar ; 203 navigatorToolBar = iconToolBar ;
204 } else { 204 } else {
205 if ( p->mToolBarHorV ) { 205 if ( p->mToolBarHorV ) {
206 if ( p->mToolBarUpV ) 206 if ( p->mToolBarUpV )
207 tbd = Bottom; 207 tbd = Bottom;
208 else 208 else
209 tbd = Top; 209 tbd = Top;
210 } 210 }
211 else { 211 else {
212 if ( p->mToolBarUpV ) 212 if ( p->mToolBarUpV )
213 tbd = Right; 213 tbd = Right;
214 else 214 else
215 tbd = Left; 215 tbd = Left;
216 } 216 }
217 viewToolBar = new QPEToolBar( this ); 217 viewToolBar = new QPEToolBar( this );
218 addToolBar (viewToolBar , tbd ); 218 addToolBar (viewToolBar , tbd );
219 if ( p->mToolBarHorN ) { 219 if ( p->mToolBarHorN ) {
220 if ( p->mToolBarUpN ) 220 if ( p->mToolBarUpN )
221 tbd = Bottom; 221 tbd = Bottom;
222 else 222 else
223 tbd = Top; 223 tbd = Top;
224 } 224 }
225 else { 225 else {
226 if ( p->mToolBarUpN ) 226 if ( p->mToolBarUpN )
227 tbd = Right; 227 tbd = Right;
228 else 228 else
229 tbd = Left; 229 tbd = Left;
230 } 230 }
231 navigatorToolBar = new QPEToolBar( this ); 231 navigatorToolBar = new QPEToolBar( this );
232 addToolBar (navigatorToolBar , tbd ); 232 addToolBar (navigatorToolBar , tbd );
233 } 233 }
234 234
235 235
236 236
237 mCalendarModifiedFlag = false; 237 mCalendarModifiedFlag = false;
238 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 238 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
239 splash->setAlignment ( AlignCenter ); 239 splash->setAlignment ( AlignCenter );
240 setCentralWidget( splash ); 240 setCentralWidget( splash );
241#ifndef DESKTOP_VERSION 241#ifndef DESKTOP_VERSION
242 showMaximized(); 242 showMaximized();
243#endif 243#endif
244 244
245 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 245 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
246 setDefaultPreferences(); 246 setDefaultPreferences();
247 mCalendar = new CalendarLocal(); 247 mCalendar = new CalendarLocal();
248 mView = new CalendarView( mCalendar, this,"mCalendar " ); 248 mView = new CalendarView( mCalendar, this,"mCalendar " );
249 mView->hide(); 249 mView->hide();
250 //mView->resize(splash->size() ); 250 //mView->resize(splash->size() );
251 initActions(); 251 initActions();
252 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 252 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
253 mSyncManager->setBlockSave(false); 253 mSyncManager->setBlockSave(false);
254 mView->setSyncManager(mSyncManager); 254 mView->setSyncManager(mSyncManager);
255#ifndef DESKTOP_VERSION 255#ifndef DESKTOP_VERSION
256 iconToolBar->show(); 256 iconToolBar->show();
257 qApp->processEvents(); 257 qApp->processEvents();
258#endif 258#endif
259 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 259 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
260 int vh = height() ; 260 int vh = height() ;
261 int vw = width(); 261 int vw = width();
262 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 262 //qDebug("Toolbar hei %d ",iconToolBar->height() );
263 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 263 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
264 vh -= iconToolBar->height(); 264 vh -= iconToolBar->height();
265 } else { 265 } else {
266 vw -= iconToolBar->height(); 266 vw -= iconToolBar->height();
267 } 267 }
268 //mView->setMaximumSize( splash->size() ); 268 //mView->setMaximumSize( splash->size() );
269 //mView->resize( splash->size() ); 269 //mView->resize( splash->size() );
270 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 270 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
271 mView->readSettings(); 271 mView->readSettings();
272 bool newFile = false; 272 bool newFile = false;
273 if( !QFile::exists( defaultFileName() ) ) { 273 if( !QFile::exists( defaultFileName() ) ) {
274 QFileInfo finfo ( defaultFileName() ); 274 QFileInfo finfo ( defaultFileName() );
275 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 275 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
276 qDebug("oldfile %s ", oldFile.latin1()); 276 qDebug("oldfile %s ", oldFile.latin1());
277 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"; 277 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";
278 finfo.setFile( oldFile ); 278 finfo.setFile( oldFile );
279 if (finfo.exists() ) { 279 if (finfo.exists() ) {
280 KMessageBox::information( this, message); 280 KMessageBox::information( this, message);
281 mView->openCalendar( oldFile ); 281 mView->openCalendar( oldFile );
282 qApp->processEvents(); 282 qApp->processEvents();
283 } else { 283 } else {
284 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 284 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
285 finfo.setFile( oldFile ); 285 finfo.setFile( oldFile );
286 if (finfo.exists() ) { 286 if (finfo.exists() ) {
287 KMessageBox::information( this, message); 287 KMessageBox::information( this, message);
288 mView->openCalendar( oldFile ); 288 mView->openCalendar( oldFile );
289 qApp->processEvents(); 289 qApp->processEvents();
290 } 290 }
291 } 291 }
292 mView->saveCalendar( defaultFileName() ); 292 mView->saveCalendar( defaultFileName() );
293 newFile = true; 293 newFile = true;
294 } 294 }
295 295
296 QTime neededSaveTime = QDateTime::currentDateTime().time(); 296 QTime neededSaveTime = QDateTime::currentDateTime().time();
297 mView->openCalendar( defaultFileName() ); 297 mView->openCalendar( defaultFileName() );
298 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 298 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
299 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 299 qDebug("KO: Calendar loading time: %d ms",msNeeded );
300 300
301 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 301 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
302 KOPrefs::instance()->setAllDefaults(); 302 KOPrefs::instance()->setAllDefaults();
303 int count = mView->addCategories(); 303 int count = mView->addCategories();
304 } 304 }
305 processIncidenceSelection( 0 ); 305 processIncidenceSelection( 0 );
306 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 306 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
307 SLOT( processIncidenceSelection( Incidence * ) ) ); 307 SLOT( processIncidenceSelection( Incidence * ) ) );
308 connect( mView, SIGNAL( modifiedChanged( bool ) ), 308 connect( mView, SIGNAL( modifiedChanged( bool ) ),
309 SLOT( slotModifiedChanged( bool ) ) ); 309 SLOT( slotModifiedChanged( bool ) ) );
310 310
311 311
312 connect( mView, SIGNAL( tempDisableBR(bool) ), 312 connect( mView, SIGNAL( tempDisableBR(bool) ),
313 SLOT( disableBR(bool) ) ); 313 SLOT( disableBR(bool) ) );
314 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 314 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
315 mView->setModified( false ); 315 mView->setModified( false );
316 mBlockAtStartup = false; 316 mBlockAtStartup = false;
317 mView->setModified( false ); 317 mView->setModified( false );
318 setCentralWidget( mView ); 318 setCentralWidget( mView );
319 globalFlagBlockStartup = 0; 319 globalFlagBlockStartup = 0;
320 mView->show(); 320 mView->show();
321 delete splash; 321 delete splash;
322 if ( newFile ) 322 if ( newFile )
323 mView->updateConfig(); 323 mView->updateConfig();
324 // qApp->processEvents(); 324 // qApp->processEvents();
325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
326 //fillSyncMenu(); 326 //fillSyncMenu();
327 327
328 328
329 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 329 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
330 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 330 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
331 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 331 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
332 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 332 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
333 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 333 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
334 mSyncManager->setDefaultFileName( sentSyncFile()); 334 mSyncManager->setDefaultFileName( sentSyncFile());
335 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 335 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
336 mSyncManager->fillSyncMenu(); 336 mSyncManager->fillSyncMenu();
337 337
338 338
339 339
340 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 340 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
341 if ( showWarning ) { 341 if ( showWarning ) {
342 KMessageBox::information( this, 342 KMessageBox::information( this,
343 "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"); 343 "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");
344 qApp->processEvents(); 344 qApp->processEvents();
345 mView->dialogManager()->showSyncOptions(); 345 mView->dialogManager()->showSyncOptions();
346 } 346 }
347 347
348 //US listen for result adressed from Ka/Pi 348 //US listen for result adressed from Ka/Pi
349#ifndef DESKTOP_VERSION 349#ifndef DESKTOP_VERSION
350 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 350 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
351#endif 351#endif
352#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
353 infrared = 0; 353 infrared = 0;
354#endif 354#endif
355 updateFilterToolbar(); 355 updateFilterToolbar();
356 updateWeek( mView->startDate() ); 356 updateWeek( mView->startDate() );
357 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 357 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
358 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 358 SLOT( updateWeekNum( const KCal::DateList & ) ) );
359 mBRdisabled = false; 359 mBRdisabled = false;
360 //toggleBeamReceive(); 360 //toggleBeamReceive();
361} 361}
362MainWindow::~MainWindow() 362MainWindow::~MainWindow()
363{ 363{
364 //qDebug("MainWindow::~MainWindow() "); 364 //qDebug("MainWindow::~MainWindow() ");
365 //save toolbar location 365 //save toolbar location
366 delete mCalendar; 366 delete mCalendar;
367 delete mSyncManager; 367 delete mSyncManager;
368#ifndef DESKTOP_VERSION 368#ifndef DESKTOP_VERSION
369 if ( infrared ) 369 if ( infrared )
370 delete infrared; 370 delete infrared;
371#endif 371#endif
372 372
373 373
374} 374}
375 375
376void MainWindow::disableBR(bool b) 376void MainWindow::disableBR(bool b)
377{ 377{
378#ifndef DESKTOP_VERSION 378#ifndef DESKTOP_VERSION
379 if ( b ) { 379 if ( b ) {
380 if ( infrared ) { 380 if ( infrared ) {
381 toggleBeamReceive(); 381 toggleBeamReceive();
382 mBRdisabled = true; 382 mBRdisabled = true;
383 } 383 }
384 mBRdisabled = true; 384 mBRdisabled = true;
385 } else { 385 } else {
386 if ( mBRdisabled ) { 386 if ( mBRdisabled ) {
387 mBRdisabled = false; 387 mBRdisabled = false;
388 //makes no sense,because other cal ap is probably running 388 //makes no sense,because other cal ap is probably running
389 // toggleBeamReceive(); 389 // toggleBeamReceive();
390 } 390 }
391 } 391 }
392#endif 392#endif
393 393
394} 394}
395bool MainWindow::beamReceiveEnabled() 395bool MainWindow::beamReceiveEnabled()
396{ 396{
397#ifndef DESKTOP_VERSION 397#ifndef DESKTOP_VERSION
398 return ( infrared != 0 ); 398 return ( infrared != 0 );
399#endif 399#endif
400 return false; 400 return false;
401} 401}
402 402
403void MainWindow::toggleBeamReceive() 403void MainWindow::toggleBeamReceive()
404{ 404{
405 if ( mBRdisabled ) 405 if ( mBRdisabled )
406 return; 406 return;
407#ifndef DESKTOP_VERSION 407#ifndef DESKTOP_VERSION
408 if ( infrared ) { 408 if ( infrared ) {
409 qDebug("disable BeamReceive "); 409 qDebug("disable BeamReceive ");
410 delete infrared; 410 delete infrared;
411 infrared = 0; 411 infrared = 0;
412 brAction->setOn(false); 412 brAction->setOn(false);
413 return; 413 return;
414 } 414 }
415 qDebug("enable BeamReceive "); 415 qDebug("enable BeamReceive ");
416 brAction->setOn(true); 416 brAction->setOn(true);
417 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 417 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
418 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 418 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
419#endif 419#endif
420} 420}
421void MainWindow::showMaximized () 421void MainWindow::showMaximized ()
422{ 422{
423#ifndef DESKTOP_VERSION 423#ifndef DESKTOP_VERSION
424 if ( ! globalFlagBlockStartup ) 424 if ( ! globalFlagBlockStartup )
425 if ( mClosed ) 425 if ( mClosed )
426 mView->goToday(); 426 mView->goToday();
427#endif 427#endif
428 QWidget::showMaximized () ; 428 QWidget::showMaximized () ;
429 mClosed = false; 429 mClosed = false;
430} 430}
431void MainWindow::closeEvent( QCloseEvent* ce ) 431void MainWindow::closeEvent( QCloseEvent* ce )
432{ 432{
433 433
434 434
435 435
436 if ( ! KOPrefs::instance()->mAskForQuit ) { 436 if ( ! KOPrefs::instance()->mAskForQuit ) {
437 saveOnClose(); 437 saveOnClose();
438 mClosed = true; 438 mClosed = true;
439 ce->accept(); 439 ce->accept();
440 return; 440 return;
441 441
442 } 442 }
443 443
444 switch( QMessageBox::information( this, "KO/Pi", 444 switch( QMessageBox::information( this, "KO/Pi",
445 i18n("Do you really want\nto close KO/Pi?"), 445 i18n("Do you really want\nto close KO/Pi?"),
446 i18n("Close"), i18n("No"), 446 i18n("Close"), i18n("No"),
447 0, 0 ) ) { 447 0, 0 ) ) {
448 case 0: 448 case 0:
449 saveOnClose(); 449 saveOnClose();
450 mClosed = true; 450 mClosed = true;
451 ce->accept(); 451 ce->accept();
452 break; 452 break;
453 case 1: 453 case 1:
454 ce->ignore(); 454 ce->ignore();
455 break; 455 break;
456 case 2: 456 case 2:
457 457
458 default: 458 default:
459 break; 459 break;
460 } 460 }
461 461
462 462
463} 463}
464 464
465void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 465void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
466{ 466{
467 QDataStream stream( data, IO_ReadOnly ); 467 QDataStream stream( data, IO_ReadOnly );
468 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 468 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
469 //QString datamess; 469 //QString datamess;
470 //qDebug("message "); 470 //qDebug("message ");
471 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 471 qDebug("KO: QCOP message received: %s ", cmsg.data() );
472 472
473 if ( cmsg == "setDocument(QString)" ) { 473 if ( cmsg == "setDocument(QString)" ) {
474 QDataStream stream( data, IO_ReadOnly ); 474 QDataStream stream( data, IO_ReadOnly );
475 QString fileName; 475 QString fileName;
476 stream >> fileName; 476 stream >> fileName;
477 //qDebug("filename %s ", fileName.latin1()); 477 //qDebug("filename %s ", fileName.latin1());
478 showMaximized(); 478 showMaximized();
479 raise(); 479 raise();
480 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 480 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
481 mSyncManager->slotSyncMenu( 1002 ); 481 mSyncManager->slotSyncMenu( 1002 );
482 return; 482 return;
483 } 483 }
484 484
485 if ( cmsg == "-writeFile" ) { 485 if ( cmsg == "-writeFile" ) {
486 // I made from the "-writeFile" an "-writeAlarm" 486 // I made from the "-writeFile" an "-writeAlarm"
487 mView->viewManager()->showWhatsNextView(); 487 mView->viewManager()->showWhatsNextView();
488 mCalendar->checkAlarmForIncidence( 0, true); 488 mCalendar->checkAlarmForIncidence( 0, true);
489 showMaximized(); 489 showMaximized();
490 raise(); 490 raise();
491 return; 491 return;
492 492
493 } 493 }
494 if ( cmsg == "-writeFileSilent" ) { 494 if ( cmsg == "-writeFileSilent" ) {
495 // I made from the "-writeFile" an "-writeAlarm" 495 // I made from the "-writeFile" an "-writeAlarm"
496 // mView->viewManager()->showWhatsNextView(); 496 // mView->viewManager()->showWhatsNextView();
497 mCalendar->checkAlarmForIncidence( 0, true); 497 mCalendar->checkAlarmForIncidence( 0, true);
498 //showMaximized(); 498 //showMaximized();
499 //raise(); 499 //raise();
500 hide(); 500 hide();
501 return; 501 return;
502 } 502 }
503 if ( cmsg == "-newCountdown" ) { 503 if ( cmsg == "-newCountdown" ) {
504 qDebug("newCountdown "); 504 qDebug("newCountdown ");
505 505
506 } 506 }
507 QString msg ; 507 QString msg ;
508 QString allmsg = cmsg; 508 QString allmsg = cmsg;
509 while ( allmsg.length() > 0 ) { 509 while ( allmsg.length() > 0 ) {
510 int nextC = allmsg.find( "-", 1 ); 510 int nextC = allmsg.find( "-", 1 );
511 if ( nextC == -1 ) { 511 if ( nextC == -1 ) {
512 msg = allmsg; 512 msg = allmsg;
513 allmsg = ""; 513 allmsg = "";
514 } else{ 514 } else{
515 msg = allmsg.left( nextC ); 515 msg = allmsg.left( nextC );
516 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 516 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
517 } 517 }
518 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 518 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
519 if ( msg == "-newEvent" ) { 519 if ( msg == "-newEvent" ) {
520 mView->newEvent(); 520 mView->newEvent();
521 } 521 }
522 if ( msg == "-newTodo" ) { 522 if ( msg == "-newTodo" ) {
523 mView->newTodo(); 523 mView->newTodo();
524 524
525 } 525 }
526 if ( msg == "-showWN" ) { 526 if ( msg == "-showWN" ) {
527 mView->viewManager()->showWhatsNextView(); 527 mView->viewManager()->showWhatsNextView();
528 } 528 }
529 if ( msg == "-showTodo" ) { 529 if ( msg == "-showTodo" ) {
530 mView->viewManager()->showTodoView(); 530 mView->viewManager()->showTodoView();
531 } 531 }
532 if ( msg == "-showList" ) { 532 if ( msg == "-showList" ) {
533 mView->viewManager()->showListView(); 533 mView->viewManager()->showListView();
534 } 534 }
535 else if ( msg == "-showDay" ) { 535 else if ( msg == "-showDay" ) {
536 mView->viewManager()->showDayView(); 536 mView->viewManager()->showDayView();
537 } 537 }
538 else if ( msg == "-showWWeek" ) { 538 else if ( msg == "-showWWeek" ) {
539 mView->viewManager()->showWorkWeekView(); 539 mView->viewManager()->showWorkWeekView();
540 } 540 }
541 else if ( msg == "-ringSync" ) { 541 else if ( msg == "-ringSync" ) {
542 mSyncManager->multiSync( false ); 542 mSyncManager->multiSync( false );
543 } 543 }
544 else if ( msg == "-showWeek" ) { 544 else if ( msg == "-showWeek" ) {
545 mView->viewManager()->showWeekView(); 545 mView->viewManager()->showWeekView();
546 } 546 }
547 else if ( msg == "-showTodo" ) { 547 else if ( msg == "-showTodo" ) {
548 mView->viewManager()->showTodoView(); 548 mView->viewManager()->showTodoView();
549 } 549 }
550 else if ( msg == "-showJournal" ) { 550 else if ( msg == "-showJournal" ) {
551 mView->dateNavigator()->selectDates( 1 ); 551 mView->dateNavigator()->selectDates( 1 );
552 mView->dateNavigator()->selectToday(); 552 mView->dateNavigator()->selectToday();
553 mView->viewManager()->showJournalView(); 553 mView->viewManager()->showJournalView();
554 } 554 }
555 else if ( msg == "-showKO" ) { 555 else if ( msg == "-showKO" ) {
556 mView->viewManager()->showNextXView(); 556 mView->viewManager()->showNextXView();
557 } 557 }
558 else if ( msg == "-showWNext" ) { 558 else if ( msg == "-showWNext" ) {
559 mView->viewManager()->showWhatsNextView(); 559 mView->viewManager()->showWhatsNextView();
560 } 560 }
561 else if ( msg == "nextView()" ) { 561 else if ( msg == "nextView()" ) {
562 mView->viewManager()->showNextView(); 562 mView->viewManager()->showNextView();
563 } 563 }
564 else if ( msg == "-showNextXView" ) { 564 else if ( msg == "-showNextXView" ) {
565 mView->viewManager()->showNextXView(); 565 mView->viewManager()->showNextXView();
566 } 566 }
567 567
568 568
569 } 569 }
570 570
571 showMaximized(); 571 showMaximized();
572 raise(); 572 raise();
573} 573}
574 574
575QPixmap MainWindow::loadPixmap( QString name ) 575QPixmap MainWindow::loadPixmap( QString name )
576{ 576{
577 return SmallIcon( name ); 577 return SmallIcon( name );
578 578
579} 579}
580void MainWindow::initActions() 580void MainWindow::initActions()
581{ 581{
582 //KOPrefs::instance()->mShowFullMenu 582 //KOPrefs::instance()->mShowFullMenu
583 iconToolBar->clear(); 583 iconToolBar->clear();
584 KOPrefs *p = KOPrefs::instance(); 584 KOPrefs *p = KOPrefs::instance();
585 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 585 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
586 586
587 QPopupMenu *viewMenu = new QPopupMenu( this ); 587 QPopupMenu *viewMenu = new QPopupMenu( this );
588 QPopupMenu *actionMenu = new QPopupMenu( this ); 588 QPopupMenu *actionMenu = new QPopupMenu( this );
589 QPopupMenu *importMenu = new QPopupMenu( this ); 589 QPopupMenu *importMenu = new QPopupMenu( this );
590 QPopupMenu *importMenu_X = new QPopupMenu( this ); 590 QPopupMenu *importMenu_X = new QPopupMenu( this );
591 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 591 QPopupMenu *exportMenu_X = new QPopupMenu( this );
592 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 592 QPopupMenu *beamMenu_X = new QPopupMenu( this );
593 selectFilterMenu = new QPopupMenu( this ); 593 selectFilterMenu = new QPopupMenu( this );
594 selectFilterMenu->setCheckable( true ); 594 selectFilterMenu->setCheckable( true );
595 syncMenu = new QPopupMenu( this ); 595 syncMenu = new QPopupMenu( this );
596 configureAgendaMenu = new QPopupMenu( this ); 596 configureAgendaMenu = new QPopupMenu( this );
597 configureToolBarMenu = new QPopupMenu( this ); 597 configureToolBarMenu = new QPopupMenu( this );
598 QPopupMenu *helpMenu = new QPopupMenu( this ); 598 QPopupMenu *helpMenu = new QPopupMenu( this );
599 QIconSet icon; 599 QIconSet icon;
600 int pixWid = 22, pixHei = 22; 600 int pixWid = 22, pixHei = 22;
601 QString pathString = ""; 601 QString pathString = "";
602 if ( !p->mToolBarMiniIcons ) { 602 if ( !p->mToolBarMiniIcons ) {
603 if ( QApplication::desktop()->width() < 480 ) { 603 if ( QApplication::desktop()->width() < 480 ) {
604 pathString += "icons16/"; 604 pathString += "icons16/";
605 pixWid = 18; pixHei = 16; 605 pixWid = 18; pixHei = 16;
606 } 606 }
607 } else { 607 } else {
608 pathString += "iconsmini/"; 608 pathString += "iconsmini/";
609 pixWid = 18; pixHei = 16; 609 pixWid = 18; pixHei = 16;
610 } 610 }
611 if ( KOPrefs::instance()->mShowFullMenu ) { 611 if ( KOPrefs::instance()->mShowFullMenu ) {
612 QMenuBar *menuBar1; 612 QMenuBar *menuBar1;
613 menuBar1 = menuBar(); 613 menuBar1 = menuBar();
614 menuBar1->insertItem( i18n("File"), importMenu ); 614 menuBar1->insertItem( i18n("File"), importMenu );
615 menuBar1->insertItem( i18n("View"), viewMenu ); 615 menuBar1->insertItem( i18n("View"), viewMenu );
616 menuBar1->insertItem( i18n("Actions"), actionMenu ); 616 menuBar1->insertItem( i18n("Actions"), actionMenu );
617#ifdef DESKTOP_VERSION 617#ifdef DESKTOP_VERSION
618 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 618 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
619 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 619 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
620#else 620#else
621 menuBar1->insertItem( i18n("Sync"), syncMenu ); 621 menuBar1->insertItem( i18n("Sync"), syncMenu );
622 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 622 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
623#endif 623#endif
624 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 624 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
625 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 625 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
626 menuBar1->insertItem( i18n("Help"), helpMenu ); 626 menuBar1->insertItem( i18n("Help"), helpMenu );
627 } else { 627 } else {
628 QPEMenuBar *menuBar1; 628 QPEMenuBar *menuBar1;
629 menuBar1 = new QPEMenuBar( iconToolBar ); 629 menuBar1 = new QPEMenuBar( iconToolBar );
630 QPopupMenu *menuBar = new QPopupMenu( this ); 630 QPopupMenu *menuBar = new QPopupMenu( this );
631 icon = loadPixmap( pathString + "z_menu" ); 631 icon = loadPixmap( pathString + "z_menu" );
632 menuBar1->insertItem( icon.pixmap(), menuBar); 632 menuBar1->insertItem( icon.pixmap(), menuBar);
633 //menuBar1->insertItem( i18n("ME"), menuBar); 633 //menuBar1->insertItem( i18n("ME"), menuBar);
634 menuBar->insertItem( i18n("File"), importMenu ); 634 menuBar->insertItem( i18n("File"), importMenu );
635 menuBar->insertItem( i18n("View"), viewMenu ); 635 menuBar->insertItem( i18n("View"), viewMenu );
636 menuBar->insertItem( i18n("Actions"), actionMenu ); 636 menuBar->insertItem( i18n("Actions"), actionMenu );
637 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 637 menuBar->insertItem( i18n("Synchronize"), syncMenu );
638 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 638 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
639 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 639 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
640 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 640 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
641 menuBar->insertItem( i18n("Help"), helpMenu ); 641 menuBar->insertItem( i18n("Help"), helpMenu );
642 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 642 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
643 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 643 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
644 } 644 }
645 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 645 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
646 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 646 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
647 mWeekBgColor = iconToolBar->backgroundColor(); 647 mWeekBgColor = iconToolBar->backgroundColor();
648 mWeekPixmap.resize( pixWid , pixHei ); 648 mWeekPixmap.resize( pixWid , pixHei );
649 mWeekPixmap.fill( mWeekBgColor ); 649 mWeekPixmap.fill( mWeekBgColor );
650 icon = mWeekPixmap; 650 icon = mWeekPixmap;
651 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 651 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
652 if ( p-> mShowIconWeekNum ) 652 if ( p-> mShowIconWeekNum )
653 mWeekAction->addTo( iconToolBar ); 653 mWeekAction->addTo( iconToolBar );
654 mWeekFont = font(); 654 mWeekFont = font();
655 655
656 int fontPoint = mWeekFont.pointSize(); 656 int fontPoint = mWeekFont.pointSize();
657 QFontMetrics f( mWeekFont ); 657 QFontMetrics f( mWeekFont );
658 int fontWid = f.width( "30" ); 658 int fontWid = f.width( "30" );
659 while ( fontWid > pixWid ) { 659 while ( fontWid > pixWid ) {
660 --fontPoint; 660 --fontPoint;
661 mWeekFont.setPointSize( fontPoint ); 661 mWeekFont.setPointSize( fontPoint );
662 QFontMetrics f( mWeekFont ); 662 QFontMetrics f( mWeekFont );
663 fontWid = f.width( "30" ); 663 fontWid = f.width( "30" );
664 //qDebug("dec-- "); 664 //qDebug("dec-- ");
665 } 665 }
666 666
667 connect( mWeekAction, SIGNAL( activated() ), 667 connect( mWeekAction, SIGNAL( activated() ),
668 this, SLOT( weekAction() ) ); 668 this, SLOT( weekAction() ) );
669 669
670 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 670 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
671 671
672 //#endif 672 //#endif
673 // ****************** 673 // ******************
674 QAction *action; 674 QAction *action;
675 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 675 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
676 configureToolBarMenu->setCheckable( true ); 676 configureToolBarMenu->setCheckable( true );
677 677
678 678
679 configureAgendaMenu->setCheckable( true ); 679 configureAgendaMenu->setCheckable( true );
680 int iii ; 680 int iii ;
681 for ( iii = 1;iii<= 10 ;++iii ){ 681 for ( iii = 1;iii<= 10 ;++iii ){
682 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 682 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
683 } 683 }
684 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 684 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
685 685
686 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 686 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
687 this, SLOT( showConfigureAgenda( ) ) ); 687 this, SLOT( showConfigureAgenda( ) ) );
688 688
689 icon = loadPixmap( pathString + "configure" ); 689 icon = loadPixmap( pathString + "configure" );
690 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 690 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
691 action->addTo( actionMenu ); 691 action->addTo( actionMenu );
692 connect( action, SIGNAL( activated() ), 692 connect( action, SIGNAL( activated() ),
693 mView, SLOT( edit_options() ) ); 693 mView, SLOT( edit_options() ) );
694 actionMenu->insertSeparator(); 694 actionMenu->insertSeparator();
695 695
696 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 696 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
697 action->addTo( actionMenu ); 697 action->addTo( actionMenu );
698 connect( action, SIGNAL( activated() ), 698 connect( action, SIGNAL( activated() ),
699 mView, SLOT( undo_delete() ) ); 699 mView, SLOT( undo_delete() ) );
700 actionMenu->insertSeparator(); 700 actionMenu->insertSeparator();
701 701
702 icon = loadPixmap( pathString + "newevent" ); 702 icon = loadPixmap( pathString + "newevent" );
703 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 703 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
704 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 704 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
705 configureToolBarMenu->insertSeparator(); 705 configureToolBarMenu->insertSeparator();
706 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 706 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
707 configureToolBarMenu->insertSeparator(); 707 configureToolBarMenu->insertSeparator();
708 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 708 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
709 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 709 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
710 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 710 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
711 ne_action->addTo( actionMenu ); 711 ne_action->addTo( actionMenu );
712 connect( ne_action, SIGNAL( activated() ), 712 connect( ne_action, SIGNAL( activated() ),
713 mView, SLOT( newEvent() ) ); 713 mView, SLOT( newEvent() ) );
714 icon = loadPixmap( pathString + "newtodo" ); 714 icon = loadPixmap( pathString + "newtodo" );
715 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 715 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
716 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 716 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
717 nt_action->addTo( actionMenu ); 717 nt_action->addTo( actionMenu );
718 connect( nt_action, SIGNAL( activated() ), 718 connect( nt_action, SIGNAL( activated() ),
719 mView, SLOT( newTodo() ) ); 719 mView, SLOT( newTodo() ) );
720 720
721 icon = loadPixmap( pathString + "today" ); 721 icon = loadPixmap( pathString + "today" );
722 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 722 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
723 today_action->addTo( viewMenu ); 723 today_action->addTo( viewMenu );
724 connect( today_action, SIGNAL( activated() ), 724 connect( today_action, SIGNAL( activated() ),
725 mView, SLOT( goToday() ) ); 725 mView, SLOT( goToday() ) );
726 viewMenu->insertSeparator(); 726 viewMenu->insertSeparator();
727 727
728 icon = loadPixmap( pathString + "navi" ); 728 icon = loadPixmap( pathString + "navi" );
729 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 729 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
730 action->addTo( viewMenu ); 730 action->addTo( viewMenu );
731 connect( action, SIGNAL( activated() ), 731 connect( action, SIGNAL( activated() ),
732 mView, SLOT( toggleDateNavigatorWidget() ) ); 732 mView, SLOT( toggleDateNavigatorWidget() ) );
733 mToggleNav = action ; 733 mToggleNav = action ;
734 icon = loadPixmap( pathString + "filter" ); 734 icon = loadPixmap( pathString + "filter" );
735 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 735 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
736 action->addTo( viewMenu ); 736 action->addTo( viewMenu );
737 connect( action, SIGNAL( activated() ), 737 connect( action, SIGNAL( activated() ),
738 mView, SLOT( toggleFilter() ) ); 738 mView, SLOT( toggleFilter() ) );
739 mToggleFilter = action; 739 mToggleFilter = action;
740 icon = loadPixmap( pathString + "allday" ); 740 icon = loadPixmap( pathString + "allday" );
741 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 741 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
742 action->addTo( viewMenu ); 742 action->addTo( viewMenu );
743 connect( action, SIGNAL( activated() ), 743 connect( action, SIGNAL( activated() ),
744 mView, SLOT( toggleAllDaySize() ) ); 744 mView, SLOT( toggleAllDaySize() ) );
745 mToggleAllday = action; 745 mToggleAllday = action;
746 746
747 747
748 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 748 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
749 mToggleNav, SLOT( setEnabled ( bool ) ) ); 749 mToggleNav, SLOT( setEnabled ( bool ) ) );
750 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 750 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
751 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 751 mToggleFilter, SLOT( setEnabled ( bool ) ) );
752 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 752 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
753 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 753 mToggleAllday, SLOT( setEnabled ( bool ) ) );
754 754
755 viewMenu->insertSeparator(); 755 viewMenu->insertSeparator();
756 icon = loadPixmap( pathString + "picker" ); 756 icon = loadPixmap( pathString + "picker" );
757 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 757 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
758 action->addTo( viewMenu ); 758 action->addTo( viewMenu );
759 connect( action, SIGNAL( activated() ), 759 connect( action, SIGNAL( activated() ),
760 mView, SLOT( showDatePicker() ) ); 760 mView, SLOT( showDatePicker() ) );
761 action->addTo( iconToolBar ); 761 action->addTo( iconToolBar );
762 viewMenu->insertSeparator(); 762 viewMenu->insertSeparator();
763 763
764 764
765 icon = loadPixmap( pathString + "whatsnext" ); 765 icon = loadPixmap( pathString + "whatsnext" );
766 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 766 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
767 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 767 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
768 whatsnext_action->addTo( viewMenu ); 768 whatsnext_action->addTo( viewMenu );
769 connect( whatsnext_action, SIGNAL( activated() ), 769 connect( whatsnext_action, SIGNAL( activated() ),
770 mView->viewManager(), SLOT( showWhatsNextView() ) ); 770 mView->viewManager(), SLOT( showWhatsNextView() ) );
771 771
772 icon = loadPixmap( pathString + "xdays" ); 772 icon = loadPixmap( pathString + "xdays" );
773 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 773 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
774 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 774 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
775 xdays_action->addTo( viewMenu ); 775 xdays_action->addTo( viewMenu );
776 connect( xdays_action, SIGNAL( activated() ), 776 connect( xdays_action, SIGNAL( activated() ),
777 mView->viewManager(), SLOT( showNextXView() ) ); 777 mView->viewManager(), SLOT( showNextXView() ) );
778 778
779 779
780 icon = loadPixmap( pathString + "journal" ); 780 icon = loadPixmap( pathString + "journal" );
781 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 781 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
782 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 782 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
783 viewjournal_action->addTo( viewMenu ); 783 viewjournal_action->addTo( viewMenu );
784 connect( viewjournal_action, SIGNAL( activated() ), 784 connect( viewjournal_action, SIGNAL( activated() ),
785 mView->viewManager(), SLOT( showJournalView() ) ); 785 mView->viewManager(), SLOT( showJournalView() ) );
786 786
787 787
788 icon = loadPixmap( pathString + "day" ); 788 icon = loadPixmap( pathString + "day" );
789 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 789 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
790 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 790 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
791 day1_action->addTo( viewMenu ); 791 day1_action->addTo( viewMenu );
792 // action->addTo( toolBar ); 792 // action->addTo( toolBar );
793 connect( day1_action, SIGNAL( activated() ), 793 connect( day1_action, SIGNAL( activated() ),
794 mView->viewManager(), SLOT( showDayView() ) ); 794 mView->viewManager(), SLOT( showDayView() ) );
795 795
796 icon = loadPixmap( pathString + "workweek" ); 796 icon = loadPixmap( pathString + "workweek" );
797 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 797 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
798 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 798 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
799 day5_action->addTo( viewMenu ); 799 day5_action->addTo( viewMenu );
800 connect( day5_action, SIGNAL( activated() ), 800 connect( day5_action, SIGNAL( activated() ),
801 mView->viewManager(), SLOT( showWorkWeekView() ) ); 801 mView->viewManager(), SLOT( showWorkWeekView() ) );
802 802
803 icon = loadPixmap( pathString + "week" ); 803 icon = loadPixmap( pathString + "week" );
804 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 804 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
805 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 805 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
806 day7_action->addTo( viewMenu ); 806 day7_action->addTo( viewMenu );
807 connect( day7_action, SIGNAL( activated() ), 807 connect( day7_action, SIGNAL( activated() ),
808 mView->viewManager(), SLOT( showWeekView() ) ); 808 mView->viewManager(), SLOT( showWeekView() ) );
809 809
810 icon = loadPixmap( pathString + "workweek2" ); 810 icon = loadPixmap( pathString + "workweek2" );
811 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 811 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
812 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 812 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
813 day6_action->addTo( viewMenu ); 813 day6_action->addTo( viewMenu );
814 connect( day6_action, SIGNAL( activated() ), 814 connect( day6_action, SIGNAL( activated() ),
815 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 815 mView->viewManager(), SLOT( showMonthViewWeek() ) );
816 816
817 icon = loadPixmap( pathString + "month" ); 817 icon = loadPixmap( pathString + "month" );
818 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 818 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
819 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 819 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
820 month_action->addTo( viewMenu ); 820 month_action->addTo( viewMenu );
821 connect( month_action, SIGNAL( activated() ), 821 connect( month_action, SIGNAL( activated() ),
822 mView->viewManager(), SLOT( showMonthView() ) ); 822 mView->viewManager(), SLOT( showMonthView() ) );
823 823
824 icon = loadPixmap( pathString + "list" ); 824 icon = loadPixmap( pathString + "list" );
825 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 825 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
826 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 826 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
827 showlist_action->addTo( viewMenu ); 827 showlist_action->addTo( viewMenu );
828 connect( showlist_action, SIGNAL( activated() ), 828 connect( showlist_action, SIGNAL( activated() ),
829 mView->viewManager(), SLOT( showListView() ) ); 829 mView->viewManager(), SLOT( showListView() ) );
830 830
831 icon = loadPixmap( pathString + "todo" ); 831 icon = loadPixmap( pathString + "todo" );
832 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 832 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
833 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 833 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
834 todoview_action->addTo( viewMenu ); 834 todoview_action->addTo( viewMenu );
835 connect( todoview_action, SIGNAL( activated() ), 835 connect( todoview_action, SIGNAL( activated() ),
836 mView->viewManager(), SLOT( showTodoView() ) ); 836 mView->viewManager(), SLOT( showTodoView() ) );
837 837
838 838
839 839
840#if 0 840#if 0
841 action = new QAction( "view_timespan", "Time Span", 0, this ); 841 action = new QAction( "view_timespan", "Time Span", 0, this );
842 action->addTo( viewMenu ); 842 action->addTo( viewMenu );
843 connect( action, SIGNAL( activated() ), 843 connect( action, SIGNAL( activated() ),
844 mView->viewManager(), SLOT( showTimeSpanView() ) ); 844 mView->viewManager(), SLOT( showTimeSpanView() ) );
845#endif 845#endif
846 846
847 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 847 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
848 this ); 848 this );
849 mNewSubTodoAction->addTo( actionMenu ); 849 mNewSubTodoAction->addTo( actionMenu );
850 connect( mNewSubTodoAction, SIGNAL( activated() ), 850 connect( mNewSubTodoAction, SIGNAL( activated() ),
851 mView, SLOT( newSubTodo() ) ); 851 mView, SLOT( newSubTodo() ) );
852 852
853 actionMenu->insertSeparator(); 853 actionMenu->insertSeparator();
854 854
855 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 855 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
856 mShowAction->addTo( actionMenu ); 856 mShowAction->addTo( actionMenu );
857 connect( mShowAction, SIGNAL( activated() ), 857 connect( mShowAction, SIGNAL( activated() ),
858 mView, SLOT( showIncidence() ) ); 858 mView, SLOT( showIncidence() ) );
859 859
860 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 860 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
861 mEditAction->addTo( actionMenu ); 861 mEditAction->addTo( actionMenu );
862 connect( mEditAction, SIGNAL( activated() ), 862 connect( mEditAction, SIGNAL( activated() ),
863 mView, SLOT( editIncidence() ) ); 863 mView, SLOT( editIncidence() ) );
864 864
865 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 865 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
866 mDeleteAction->addTo( actionMenu ); 866 mDeleteAction->addTo( actionMenu );
867 connect( mDeleteAction, SIGNAL( activated() ), 867 connect( mDeleteAction, SIGNAL( activated() ),
868 mView, SLOT( deleteIncidence() ) ); 868 mView, SLOT( deleteIncidence() ) );
869 869
870 870
871 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 871 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
872 mCloneAction->addTo( actionMenu ); 872 mCloneAction->addTo( actionMenu );
873 connect( mCloneAction, SIGNAL( activated() ), 873 connect( mCloneAction, SIGNAL( activated() ),
874 mView, SLOT( cloneIncidence() ) ); 874 mView, SLOT( cloneIncidence() ) );
875 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 875 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
876 mMoveAction->addTo( actionMenu ); 876 mMoveAction->addTo( actionMenu );
877 connect( mMoveAction, SIGNAL( activated() ), 877 connect( mMoveAction, SIGNAL( activated() ),
878 mView, SLOT( moveIncidence() ) ); 878 mView, SLOT( moveIncidence() ) );
879 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 879 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
880 mBeamAction->addTo( actionMenu ); 880 mBeamAction->addTo( actionMenu );
881 connect( mBeamAction, SIGNAL( activated() ), 881 connect( mBeamAction, SIGNAL( activated() ),
882 mView, SLOT( beamIncidence() ) ); 882 mView, SLOT( beamIncidence() ) );
883 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 883 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
884 mCancelAction->addTo( actionMenu ); 884 mCancelAction->addTo( actionMenu );
885 connect( mCancelAction, SIGNAL( activated() ), 885 connect( mCancelAction, SIGNAL( activated() ),
886 mView, SLOT( toggleCancelIncidence() ) ); 886 mView, SLOT( toggleCancelIncidence() ) );
887 887
888 actionMenu->insertSeparator(); 888 actionMenu->insertSeparator();
889 889
890 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 890 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
891 this ); 891 this );
892 action->addTo( actionMenu ); 892 action->addTo( actionMenu );
893 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 893 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
894 894
895 icon = loadPixmap( pathString + "search" ); 895 icon = loadPixmap( pathString + "search" );
896 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 896 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
897 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 897 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
898 search_action->addTo( actionMenu ); 898 search_action->addTo( actionMenu );
899 connect( search_action, SIGNAL( activated() ), 899 connect( search_action, SIGNAL( activated() ),
900 mView->dialogManager(), SLOT( showSearchDialog() ) ); 900 mView->dialogManager(), SLOT( showSearchDialog() ) );
901 901
902 902
903 903
904 if ( KOPrefs::instance()->mShowFullMenu ) { 904 if ( KOPrefs::instance()->mShowFullMenu ) {
905 actionMenu->insertSeparator(); 905 actionMenu->insertSeparator();
906 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 906 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
907 907
908 } 908 }
909 // actionMenu->insertSeparator(); 909 // actionMenu->insertSeparator();
910 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 910 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
911 this ); 911 this );
912 action->addTo( importMenu_X ); 912 action->addTo( importMenu_X );
913 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 913 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
914 action = new QAction( "import_quick", i18n("Import last file"), 0, 914 action = new QAction( "import_quick", i18n("Import last file"), 0,
915 this ); 915 this );
916 action->addTo( importMenu_X ); 916 action->addTo( importMenu_X );
917 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 917 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
918 importMenu_X->insertSeparator(); 918 importMenu_X->insertSeparator();
919 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 919 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
920 this ); 920 this );
921 action->addTo( importMenu_X ); 921 action->addTo( importMenu_X );
922 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 922 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
923 //#ifndef DESKTOP_VERSION 923 //#ifndef DESKTOP_VERSION
924 importMenu_X->insertSeparator(); 924 importMenu_X->insertSeparator();
925 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 925 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
926 this ); 926 this );
927 action->addTo( importMenu_X ); 927 action->addTo( importMenu_X );
928 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 928 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
929 //#else 929 //#else
930#ifdef _OL_IMPORT_ 930#ifdef _OL_IMPORT_
931 importMenu_X->insertSeparator(); 931 importMenu_X->insertSeparator();
932 action = new QAction( "import_ol", i18n("Import from OL"), 0, 932 action = new QAction( "import_ol", i18n("Import from OL"), 0,
933 this ); 933 this );
934 action->addTo( importMenu_X ); 934 action->addTo( importMenu_X );
935 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 935 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
936#endif 936#endif
937 //#endif 937 //#endif
938 938
939 //importMenu->insertSeparator(); 939 //importMenu->insertSeparator();
940 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 940 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
941 this ); 941 this );
942 action->addTo( importMenu ); 942 action->addTo( importMenu );
943 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 943 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
944 944
945 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 945 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
946 this ); 946 this );
947 action->addTo( importMenu ); 947 action->addTo( importMenu );
948 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 948 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
949 importMenu->insertSeparator(); 949 importMenu->insertSeparator();
950 importMenu->insertItem( i18n("Import"), importMenu_X ); 950 importMenu->insertItem( i18n("Import"), importMenu_X );
951 //importMenu->insertSeparator(); 951 //importMenu->insertSeparator();
952 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 952 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
953 this ); 953 this );
954 action->addTo( exportMenu_X ); 954 action->addTo( exportMenu_X );
955 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 955 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
956 956
957 957
958 //LR 958 //LR
959 QPopupMenu *ex2phone = new QPopupMenu( this ); 959 QPopupMenu *ex2phone = new QPopupMenu( this );
960 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 960 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
961 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 961 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
962 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 962 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
963 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 963 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
964 964
965 importMenu->insertItem( i18n("Export"), exportMenu_X ); 965 importMenu->insertItem( i18n("Export"), exportMenu_X );
966#ifndef DESKTOP_VERSION 966#ifndef DESKTOP_VERSION
967 //importMenu->insertSeparator(); 967 //importMenu->insertSeparator();
968 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 968 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
969 this ); 969 this );
970 brAction->addTo( beamMenu_X ); 970 brAction->addTo( beamMenu_X );
971 brAction->setToggleAction (true ) ; 971 brAction->setToggleAction (true ) ;
972 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 972 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
973 973
974 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 974 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
975 this ); 975 this );
976 action->addTo( beamMenu_X ); 976 action->addTo( beamMenu_X );
977 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 977 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
978 978
979 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 979 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
980 this ); 980 this );
981 action->addTo( beamMenu_X ); 981 action->addTo( beamMenu_X );
982 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 982 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
983 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 983 importMenu->insertItem( i18n("Beam"), beamMenu_X );
984#else 984#else
985 //importMenu->insertSeparator(); 985 //importMenu->insertSeparator();
986 icon = loadPixmap( pathString + "print" ); 986 icon = loadPixmap( pathString + "print" );
987 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 987 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
988 action->addTo( beamMenu_X ); 988 action->addTo( beamMenu_X );
989 connect( action, SIGNAL( activated() ), 989 connect( action, SIGNAL( activated() ),
990 this, SLOT( printCal() ) ); 990 this, SLOT( printCal() ) );
991 991
992 icon = loadPixmap( pathString + "print" ); 992 icon = loadPixmap( pathString + "print" );
993 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 993 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
994 action->addTo( beamMenu_X ); 994 action->addTo( beamMenu_X );
995 connect( action, SIGNAL( activated() ), 995 connect( action, SIGNAL( activated() ),
996 this, SLOT( printSel() ) ); 996 this, SLOT( printSel() ) );
997 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 997 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
998 action->addTo( beamMenu_X ); 998 action->addTo( beamMenu_X );
999 connect( action, SIGNAL( activated() ), 999 connect( action, SIGNAL( activated() ),
1000 mView->viewManager(), SLOT( slotprintWNV() ) ); 1000 mView->viewManager(), SLOT( slotprintWNV() ) );
1001 1001
1002 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1002 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1003 action->addTo( beamMenu_X ); 1003 action->addTo( beamMenu_X );
1004 connect( action, SIGNAL( activated() ), 1004 connect( action, SIGNAL( activated() ),
1005 mView, SLOT( slotprintSelInc() ) ); 1005 mView, SLOT( slotprintSelInc() ) );
1006 1006
1007 1007
1008 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1008 importMenu->insertItem( i18n("Print"), beamMenu_X );
1009#endif 1009#endif
1010 importMenu->insertSeparator(); 1010 importMenu->insertSeparator();
1011 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1011 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1012 this ); 1012 this );
1013 action->addTo( importMenu ); 1013 action->addTo( importMenu );
1014 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1014 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1015 importMenu->insertSeparator(); 1015 importMenu->insertSeparator();
1016 action = new QAction( "beam all", i18n("Save"), 0, 1016 action = new QAction( "beam all", i18n("Save"), 0,
1017 this ); 1017 this );
1018 action->addTo( importMenu ); 1018 action->addTo( importMenu );
1019 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1019 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1020 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1020 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1021 this ); 1021 this );
1022 action->addTo( importMenu ); 1022 action->addTo( importMenu );
1023 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1023 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1024 1024
1025 //menuBar->insertItem( "Configure",configureMenu ); 1025 //menuBar->insertItem( "Configure",configureMenu );
1026 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1026 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1027 icon = loadPixmap( "korganizer/korganizer" ); 1027 icon = loadPixmap( "korganizer/korganizer" );
1028 1028
1029 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1029 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1030 action->addTo( helpMenu ); 1030 action->addTo( helpMenu );
1031 connect( action, SIGNAL( activated() ), 1031 connect( action, SIGNAL( activated() ),
1032 SLOT( whatsNew() ) ); 1032 SLOT( whatsNew() ) );
1033 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1033 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1034 action->addTo( helpMenu ); 1034 action->addTo( helpMenu );
1035 connect( action, SIGNAL( activated() ), 1035 connect( action, SIGNAL( activated() ),
1036 SLOT( features() ) ); 1036 SLOT( features() ) );
1037 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1037 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1038 action->addTo( helpMenu ); 1038 action->addTo( helpMenu );
1039 connect( action, SIGNAL( activated() ), 1039 connect( action, SIGNAL( activated() ),
1040 SLOT( keyBindings() ) ); 1040 SLOT( keyBindings() ) );
1041 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1041 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1042 action->addTo( helpMenu ); 1042 action->addTo( helpMenu );
1043 connect( action, SIGNAL( activated() ), 1043 connect( action, SIGNAL( activated() ),
1044 SLOT( synchowto() ) ); 1044 SLOT( synchowto() ) );
1045 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1045 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1046 action->addTo( helpMenu ); 1046 action->addTo( helpMenu );
1047 connect( action, SIGNAL( activated() ), 1047 connect( action, SIGNAL( activated() ),
1048 SLOT( kdesynchowto() ) ); 1048 SLOT( kdesynchowto() ) );
1049 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1049 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1050 action->addTo( helpMenu ); 1050 action->addTo( helpMenu );
1051 connect( action, SIGNAL( activated() ), 1051 connect( action, SIGNAL( activated() ),
1052 SLOT( multisynchowto() ) ); 1052 SLOT( multisynchowto() ) );
1053 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1053 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1054 action->addTo( helpMenu ); 1054 action->addTo( helpMenu );
1055 connect( action, SIGNAL( activated() ), 1055 connect( action, SIGNAL( activated() ),
1056 SLOT( aboutAutoSaving() ) ); 1056 SLOT( aboutAutoSaving() ) );
1057 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1057 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1058 action->addTo( helpMenu ); 1058 action->addTo( helpMenu );
1059 connect( action, SIGNAL( activated() ), 1059 connect( action, SIGNAL( activated() ),
1060 SLOT( aboutKnownBugs() ) ); 1060 SLOT( aboutKnownBugs() ) );
1061 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1061 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1062 action->addTo( helpMenu ); 1062 action->addTo( helpMenu );
1063 connect( action, SIGNAL( activated() ), 1063 connect( action, SIGNAL( activated() ),
1064 SLOT( usertrans() ) ); 1064 SLOT( usertrans() ) );
1065 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1065 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1066 action->addTo( helpMenu ); 1066 action->addTo( helpMenu );
1067 connect( action, SIGNAL( activated() ), 1067 connect( action, SIGNAL( activated() ),
1068 SLOT( faq() ) ); 1068 SLOT( faq() ) );
1069 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1069 action = new QAction( "licence", i18n("Licence..."), 0, this );
1070 action->addTo( helpMenu ); 1070 action->addTo( helpMenu );
1071 connect( action, SIGNAL( activated() ), 1071 connect( action, SIGNAL( activated() ),
1072 SLOT( licence() ) ); 1072 SLOT( licence() ) );
1073 action = new QAction( "about", i18n("About..."), 0, this ); 1073 action = new QAction( "about", i18n("About..."), 0, this );
1074 action->addTo( helpMenu ); 1074 action->addTo( helpMenu );
1075 connect( action, SIGNAL( activated() ), 1075 connect( action, SIGNAL( activated() ),
1076 SLOT( about() ) ); 1076 SLOT( about() ) );
1077 //menuBar->insertSeparator(); 1077 //menuBar->insertSeparator();
1078 1078
1079 // ****************************************************** 1079 // ******************************************************
1080 // menubar icons 1080 // menubar icons
1081 1081
1082 1082
1083 1083
1084 //menuBar->insertItem( iconToolBar ); 1084 //menuBar->insertItem( iconToolBar );
1085 //xdays_action 1085 //xdays_action
1086 if (p-> mShowIconNewEvent) 1086 if (p-> mShowIconNewEvent)
1087 ne_action->addTo( iconToolBar ); 1087 ne_action->addTo( iconToolBar );
1088 if (p->mShowIconNewTodo ) 1088 if (p->mShowIconNewTodo )
1089 nt_action->addTo( iconToolBar ); 1089 nt_action->addTo( iconToolBar );
1090 if (p-> mShowIconSearch) 1090 if (p-> mShowIconSearch)
1091 search_action->addTo( iconToolBar ); 1091 search_action->addTo( iconToolBar );
1092 if (p-> mShowIconWhatsThis) 1092 if (p-> mShowIconWhatsThis)
1093 QWhatsThis::whatsThisButton ( iconToolBar ); 1093 QWhatsThis::whatsThisButton ( iconToolBar );
1094 if (p-> mShowIconNext) 1094 if (p-> mShowIconNext)
1095 whatsnext_action->addTo( viewToolBar ); 1095 whatsnext_action->addTo( viewToolBar );
1096 if (p-> mShowIconNextDays) 1096 if (p-> mShowIconNextDays)
1097 xdays_action->addTo( viewToolBar ); 1097 xdays_action->addTo( viewToolBar );
1098 if (p-> mShowIconJournal) 1098 if (p-> mShowIconJournal)
1099 viewjournal_action->addTo( viewToolBar ); 1099 viewjournal_action->addTo( viewToolBar );
1100 if (p-> mShowIconDay1) 1100 if (p-> mShowIconDay1)
1101 day1_action->addTo( viewToolBar ); 1101 day1_action->addTo( viewToolBar );
1102 if (p-> mShowIconDay5) 1102 if (p-> mShowIconDay5)
1103 day5_action->addTo( viewToolBar ); 1103 day5_action->addTo( viewToolBar );
1104 if (p-> mShowIconDay7) 1104 if (p-> mShowIconDay7)
1105 day7_action->addTo( viewToolBar ); 1105 day7_action->addTo( viewToolBar );
1106 if (p-> mShowIconDay6) 1106 if (p-> mShowIconDay6)
1107 day6_action->addTo( viewToolBar ); 1107 day6_action->addTo( viewToolBar );
1108 if (p-> mShowIconMonth) 1108 if (p-> mShowIconMonth)
1109 month_action->addTo( viewToolBar ); 1109 month_action->addTo( viewToolBar );
1110 if (p-> mShowIconList) 1110 if (p-> mShowIconList)
1111 showlist_action->addTo( viewToolBar ); 1111 showlist_action->addTo( viewToolBar );
1112 if (p-> mShowIconTodoview) 1112 if (p-> mShowIconTodoview)
1113 todoview_action->addTo( viewToolBar ); 1113 todoview_action->addTo( viewToolBar );
1114 1114
1115 icon = loadPixmap( pathString + "2leftarrowB" ); 1115 icon = loadPixmap( pathString + "2leftarrowB" );
1116 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1116 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1117 if (p-> mShowIconBackFast) { 1117 if (p-> mShowIconBackFast) {
1118 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1118 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1119 connect( action, SIGNAL( activated() ), 1119 connect( action, SIGNAL( activated() ),
1120 mView, SLOT( goPreviousMonth() ) ); 1120 mView, SLOT( goPreviousMonth() ) );
1121 action->addTo( navigatorToolBar ); 1121 action->addTo( navigatorToolBar );
1122 } 1122 }
1123 icon = loadPixmap( pathString + "1leftarrowB" ); 1123 icon = loadPixmap( pathString + "1leftarrowB" );
1124 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1124 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1125 if (p-> mShowIconBack) { 1125 if (p-> mShowIconBack) {
1126 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1126 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1127 connect( action, SIGNAL( activated() ), 1127 connect( action, SIGNAL( activated() ),
1128 mView, SLOT( goPrevious() ) ); 1128 mView, SLOT( goPrevious() ) );
1129 action->addTo( navigatorToolBar ); 1129 action->addTo( navigatorToolBar );
1130 } 1130 }
1131 icon = loadPixmap( pathString + "today" ); 1131 icon = loadPixmap( pathString + "today" );
1132 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1132 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1133 if (p-> mShowIconToday) 1133 if (p-> mShowIconToday)
1134 today_action->addTo( navigatorToolBar ); 1134 today_action->addTo( navigatorToolBar );
1135 icon = loadPixmap( pathString + "1rightarrowB" ); 1135 icon = loadPixmap( pathString + "1rightarrowB" );
1136 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1136 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1137 if (p-> mShowIconForward) { 1137 if (p-> mShowIconForward) {
1138 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1138 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1139 connect( action, SIGNAL( activated() ), 1139 connect( action, SIGNAL( activated() ),
1140 mView, SLOT( goNext() ) ); 1140 mView, SLOT( goNext() ) );
1141 action->addTo( navigatorToolBar ); 1141 action->addTo( navigatorToolBar );
1142 } 1142 }
1143 icon = loadPixmap( pathString + "2rightarrowB" ); 1143 icon = loadPixmap( pathString + "2rightarrowB" );
1144 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1144 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1145 if (p-> mShowIconForwardFast) { 1145 if (p-> mShowIconForwardFast) {
1146 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1146 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1147 connect( action, SIGNAL( activated() ), 1147 connect( action, SIGNAL( activated() ),
1148 mView, SLOT( goNextMonth() ) ); 1148 mView, SLOT( goNextMonth() ) );
1149 action->addTo( navigatorToolBar ); 1149 action->addTo( navigatorToolBar );
1150 } 1150 }
1151 1151
1152 1152
1153 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1153 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1154 1154
1155 if (p-> mShowIconNewEvent) 1155 if (p-> mShowIconNewEvent)
1156 configureToolBarMenu->setItemChecked( 10, true ); 1156 configureToolBarMenu->setItemChecked( 10, true );
1157 if (p->mShowIconNewTodo ) 1157 if (p->mShowIconNewTodo )
1158 configureToolBarMenu->setItemChecked( 20, true ); 1158 configureToolBarMenu->setItemChecked( 20, true );
1159 if (p-> mShowIconSearch) 1159 if (p-> mShowIconSearch)
1160 configureToolBarMenu->setItemChecked( 120, true ); 1160 configureToolBarMenu->setItemChecked( 120, true );
1161 if (p-> mShowIconList) 1161 if (p-> mShowIconList)
1162 configureToolBarMenu->setItemChecked( 30, true ); 1162 configureToolBarMenu->setItemChecked( 30, true );
1163 if (p-> mShowIconDay1) 1163 if (p-> mShowIconDay1)
1164 configureToolBarMenu->setItemChecked( 40, true ); 1164 configureToolBarMenu->setItemChecked( 40, true );
1165 if (p-> mShowIconDay5) 1165 if (p-> mShowIconDay5)
1166 configureToolBarMenu->setItemChecked( 50, true ); 1166 configureToolBarMenu->setItemChecked( 50, true );
1167 if (p-> mShowIconDay6) 1167 if (p-> mShowIconDay6)
1168 configureToolBarMenu->setItemChecked( 75, true ); 1168 configureToolBarMenu->setItemChecked( 75, true );
1169 if (p-> mShowIconDay7) 1169 if (p-> mShowIconDay7)
1170 configureToolBarMenu->setItemChecked( 60, true ); 1170 configureToolBarMenu->setItemChecked( 60, true );
1171 if (p-> mShowIconMonth) 1171 if (p-> mShowIconMonth)
1172 configureToolBarMenu->setItemChecked( 70, true ); 1172 configureToolBarMenu->setItemChecked( 70, true );
1173 if (p-> mShowIconTodoview) 1173 if (p-> mShowIconTodoview)
1174 configureToolBarMenu->setItemChecked( 80, true ); 1174 configureToolBarMenu->setItemChecked( 80, true );
1175 if (p-> mShowIconBackFast) 1175 if (p-> mShowIconBackFast)
1176 configureToolBarMenu->setItemChecked( 200, true ); 1176 configureToolBarMenu->setItemChecked( 200, true );
1177 if (p-> mShowIconBack) 1177 if (p-> mShowIconBack)
1178 configureToolBarMenu->setItemChecked( 210, true ); 1178 configureToolBarMenu->setItemChecked( 210, true );
1179 if (p-> mShowIconToday) 1179 if (p-> mShowIconToday)
1180 configureToolBarMenu->setItemChecked( 130, true ); 1180 configureToolBarMenu->setItemChecked( 130, true );
1181 if (p-> mShowIconForward) 1181 if (p-> mShowIconForward)
1182 configureToolBarMenu->setItemChecked( 220, true ); 1182 configureToolBarMenu->setItemChecked( 220, true );
1183 if (p-> mShowIconForwardFast) 1183 if (p-> mShowIconForwardFast)
1184 configureToolBarMenu->setItemChecked( 230, true ); 1184 configureToolBarMenu->setItemChecked( 230, true );
1185 if (p-> mShowIconNextDays) 1185 if (p-> mShowIconNextDays)
1186 configureToolBarMenu->setItemChecked( 100, true ); 1186 configureToolBarMenu->setItemChecked( 100, true );
1187 if (p-> mShowIconNext) 1187 if (p-> mShowIconNext)
1188 configureToolBarMenu->setItemChecked( 110, true ); 1188 configureToolBarMenu->setItemChecked( 110, true );
1189 if (p-> mShowIconJournal) 1189 if (p-> mShowIconJournal)
1190 configureToolBarMenu->setItemChecked( 90, true ); 1190 configureToolBarMenu->setItemChecked( 90, true );
1191 if (p-> mShowIconWhatsThis) 1191 if (p-> mShowIconWhatsThis)
1192 configureToolBarMenu->setItemChecked( 300, true ); 1192 configureToolBarMenu->setItemChecked( 300, true );
1193 if (p-> mShowIconWeekNum) 1193 if (p-> mShowIconWeekNum)
1194 configureToolBarMenu->setItemChecked( 400, true ); 1194 configureToolBarMenu->setItemChecked( 400, true );
1195 if (!p-> mShowIconStretch) { 1195 if (!p-> mShowIconStretch) {
1196 QLabel* dummy = new QLabel( iconToolBar ); 1196 QLabel* dummy = new QLabel( iconToolBar );
1197 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1197 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1198 dummy->setMinimumWidth( 0 ); 1198 dummy->setMinimumWidth( 0 );
1199 iconToolBar->setStretchableWidget ( dummy ) ; 1199 iconToolBar->setStretchableWidget ( dummy ) ;
1200 } 1200 }
1201 else { 1201 else {
1202 iconToolBar->setHorizontalStretchable (true ); 1202 iconToolBar->setHorizontalStretchable (true );
1203 viewToolBar->setHorizontalStretchable (true ); 1203 viewToolBar->setHorizontalStretchable (true );
1204 navigatorToolBar->setHorizontalStretchable (true ); 1204 navigatorToolBar->setHorizontalStretchable (true );
1205 iconToolBar->setVerticalStretchable (true ); 1205 iconToolBar->setVerticalStretchable (true );
1206 viewToolBar->setVerticalStretchable (true ); 1206 viewToolBar->setVerticalStretchable (true );
1207 navigatorToolBar->setVerticalStretchable (true ); 1207 navigatorToolBar->setVerticalStretchable (true );
1208 configureToolBarMenu->setItemChecked( 5, true ); 1208 configureToolBarMenu->setItemChecked( 5, true );
1209 } 1209 }
1210 if (p-> mShowIconFilter) 1210 if (p-> mShowIconFilter)
1211 configureToolBarMenu->setItemChecked( 7, true ); 1211 configureToolBarMenu->setItemChecked( 7, true );
1212 if (p-> mShowIconOnetoolbar) 1212 if (p-> mShowIconOnetoolbar)
1213 configureToolBarMenu->setItemChecked( 6, true ); 1213 configureToolBarMenu->setItemChecked( 6, true );
1214 1214
1215 1215
1216 if ( filterMenubar ) 1216 if ( filterMenubar )
1217 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1217 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1218 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1218 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1219 configureAgenda( p->mHourSize ); 1219 configureAgenda( p->mHourSize );
1220 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1220 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1221} 1221}
1222 1222
1223void MainWindow::exportToPhone( int mode ) 1223void MainWindow::exportToPhone( int mode )
1224{ 1224{
1225 1225
1226 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1226 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1227 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1227 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1228 KOex2phonePrefs ex2phone; 1228 KOex2phonePrefs ex2phone;
1229 1229
1230 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1230 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1231 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1231 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1232 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1232 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1233 if ( mode == 1 ) 1233 if ( mode == 1 )
1234 ex2phone.setCaption(i18n("Export complete calendar")); 1234 ex2phone.setCaption(i18n("Export complete calendar"));
1235 if ( mode == 2 ) 1235 if ( mode == 2 )
1236 ex2phone.setCaption(i18n("Export filtered calendar")); 1236 ex2phone.setCaption(i18n("Export filtered calendar"));
1237 1237
1238 if ( !ex2phone.exec() ) { 1238 if ( !ex2phone.exec() ) {
1239 return; 1239 return;
1240 } 1240 }
1241 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1241 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1242 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1242 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1243 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1243 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1244 1244
1245 int inFuture = 0; 1245 int inFuture = 0;
1246 if ( ex2phone.mWriteBackFuture->isChecked() ) 1246 if ( ex2phone.mWriteBackFuture->isChecked() )
1247 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1247 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1248 QPtrList<Incidence> delSel; 1248 QPtrList<Incidence> delSel;
1249 if ( mode == 1 ) 1249 if ( mode == 1 )
1250 delSel = mCalendar->rawIncidences(); 1250 delSel = mCalendar->rawIncidences();
1251 if ( mode == 2 ) 1251 if ( mode == 2 )
1252 delSel = mCalendar->incidences(); 1252 delSel = mCalendar->incidences();
1253 CalendarLocal* cal = new CalendarLocal(); 1253 CalendarLocal* cal = new CalendarLocal();
1254 cal->setLocalTime(); 1254 cal->setLocalTime();
1255 Incidence *incidence = delSel.first(); 1255 Incidence *incidence = delSel.first();
1256 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1256 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1257 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1257 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1258 while ( incidence ) { 1258 while ( incidence ) {
1259 if ( incidence->type() != "Journal" ) { 1259 if ( incidence->type() != "Journal" ) {
1260 bool add = true; 1260 bool add = true;
1261 if ( inFuture ) { 1261 if ( inFuture ) {
1262 QDateTime dt; 1262 QDateTime dt;
1263 if ( incidence->type() == "Todo" ) { 1263 if ( incidence->type() == "Todo" ) {
1264 Todo * t = (Todo*)incidence; 1264 Todo * t = (Todo*)incidence;
1265 if ( t->hasDueDate() ) 1265 if ( t->hasDueDate() )
1266 dt = t->dtDue(); 1266 dt = t->dtDue();
1267 else 1267 else
1268 dt = cur.addSecs( 62 ); 1268 dt = cur.addSecs( 62 );
1269 } 1269 }
1270 else { 1270 else {
1271 bool ok; 1271 bool ok;
1272 dt = incidence->getNextOccurence( cur, &ok ); 1272 dt = incidence->getNextOccurence( cur, &ok );
1273 if ( !ok ) 1273 if ( !ok )
1274 dt = cur.addSecs( -62 ); 1274 dt = cur.addSecs( -62 );
1275 } 1275 }
1276 if ( dt < cur || dt > end ) { 1276 if ( dt < cur || dt > end ) {
1277 add = false; 1277 add = false;
1278 } 1278 }
1279 } 1279 }
1280 if ( add ) { 1280 if ( add ) {
1281 Incidence *in = incidence->clone(); 1281 Incidence *in = incidence->clone();
1282 cal->addIncidence( in ); 1282 cal->addIncidence( in );
1283 } 1283 }
1284 } 1284 }
1285 incidence = delSel.next(); 1285 incidence = delSel.next();
1286 } 1286 }
1287 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1287 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1288 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1288 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1289 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1289 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1290 1290
1291 setCaption( i18n("Writing to phone...")); 1291 setCaption( i18n("Writing to phone..."));
1292 if ( PhoneFormat::writeToPhone( cal ) ) 1292 if ( PhoneFormat::writeToPhone( cal ) )
1293 setCaption( i18n("Export to phone successful!")); 1293 setCaption( i18n("Export to phone successful!"));
1294 else 1294 else
1295 setCaption( i18n("Error exporting to phone!")); 1295 setCaption( i18n("Error exporting to phone!"));
1296 delete cal; 1296 delete cal;
1297} 1297}
1298 1298
1299 1299
1300void MainWindow::setDefaultPreferences() 1300void MainWindow::setDefaultPreferences()
1301{ 1301{
1302 KOPrefs *p = KOPrefs::instance(); 1302 KOPrefs *p = KOPrefs::instance();
1303 1303
1304 p->mCompactDialogs = true; 1304 p->mCompactDialogs = true;
1305 p->mConfirm = true; 1305 p->mConfirm = true;
1306 // p->mEnableQuickTodo = false; 1306 // p->mEnableQuickTodo = false;
1307 1307
1308} 1308}
1309 1309
1310QString MainWindow::resourcePath() 1310QString MainWindow::resourcePath()
1311{ 1311{
1312 return KGlobal::iconLoader()->iconPath(); 1312 return KGlobal::iconLoader()->iconPath();
1313} 1313}
1314 1314
1315void MainWindow::displayText( QString text ,QString cap ) 1315void MainWindow::displayText( QString text ,QString cap )
1316{ 1316{
1317 QDialog dia( this, "name", true ); ; 1317 QDialog dia( this, "name", true ); ;
1318 dia.setCaption( cap ); 1318 dia.setCaption( cap );
1319 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1319 QVBoxLayout* lay = new QVBoxLayout( &dia );
1320 lay->setSpacing( 3 ); 1320 lay->setSpacing( 3 );
1321 lay->setMargin( 3 ); 1321 lay->setMargin( 3 );
1322 QTextBrowser tb ( &dia ); 1322 QTextBrowser tb ( &dia );
1323 lay->addWidget( &tb ); 1323 lay->addWidget( &tb );
1324 tb.setText( text ); 1324 tb.setText( text );
1325#ifdef DESKTOP_VERSION 1325#ifdef DESKTOP_VERSION
1326 dia.resize( 640, 480); 1326 dia.resize( 640, 480);
1327#else 1327#else
1328 dia.showMaximized(); 1328 dia.showMaximized();
1329#endif 1329#endif
1330 dia.exec(); 1330 dia.exec();
1331} 1331}
1332 1332
1333void MainWindow::features() 1333void MainWindow::features()
1334{ 1334{
1335 1335
1336 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1336 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1337} 1337}
1338 1338
1339void MainWindow::usertrans() 1339void MainWindow::usertrans()
1340{ 1340{
1341 1341
1342 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1342 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1343} 1343}
1344 1344
1345void MainWindow::kdesynchowto() 1345void MainWindow::kdesynchowto()
1346{ 1346{
1347 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1347 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1348} 1348}
1349void MainWindow::multisynchowto() 1349void MainWindow::multisynchowto()
1350{ 1350{
1351 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1351 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1352} 1352}
1353void MainWindow::synchowto() 1353void MainWindow::synchowto()
1354{ 1354{
1355 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1355 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1356} 1356}
1357void MainWindow::faq() 1357void MainWindow::faq()
1358{ 1358{
1359 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1359 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1360 1360
1361} 1361}
1362void MainWindow::whatsNew() 1362void MainWindow::whatsNew()
1363{ 1363{
1364 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1364 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1365 1365
1366} 1366}
1367void MainWindow::licence() 1367void MainWindow::licence()
1368{ 1368{
1369 KApplication::showLicence(); 1369 KApplication::showLicence();
1370 1370
1371} 1371}
1372void MainWindow::about() 1372void MainWindow::about()
1373{ 1373{
1374 QString version; 1374 QString version;
1375#include <../version> 1375#include <../version>
1376 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1376 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1377 i18n("KOrganizer/Platform-independent\n") + 1377 i18n("KOrganizer/Platform-independent\n") +
1378 "(KO/Pi) " + version + " - " + 1378 "(KO/Pi) " + version + " - " +
1379 1379
1380#ifdef DESKTOP_VERSION 1380#ifdef DESKTOP_VERSION
1381 i18n("Desktop Edition\n") + 1381 i18n("Desktop Edition\n") +
1382#else 1382#else
1383 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1383 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1384#endif 1384#endif
1385 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1385 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1386} 1386}
1387void MainWindow::keyBindings() 1387void MainWindow::keyBindings()
1388{ 1388{
1389 QString cap = i18n("KO/Pi Keys + Colors"); 1389 QString cap = i18n("KO/Pi Keys + Colors");
1390 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1390 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1391 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1391 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1392 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1392 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1393 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1393 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1394 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1394 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1395 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1395 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1396 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1396 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1397 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1397 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1398 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1398 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1399 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1399 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1400 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1400 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1401 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1401 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1402 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1402 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1403 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1403 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1404 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1404 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1405 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1405 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1406 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1406 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1407 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1407 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1408 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1408 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1409 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1409 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1410 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1410 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1411 i18n("<p><h3>In agenda view:</h3></p>\n") + 1411 i18n("<p><h3>In agenda view:</h3></p>\n") +
1412 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1412 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1413 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1413 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1414 i18n("<p><h3>In todo view:</h3></p>\n") + 1414 i18n("<p><h3>In todo view:</h3></p>\n") +
1415 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1415 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1416 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1416 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1417 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1417 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1418 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1418 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1419 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1419 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1420 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1420 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1421 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1421 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1422 i18n("<p><h3>In list view:</h3></p>\n") + 1422 i18n("<p><h3>In list view:</h3></p>\n") +
1423 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1423 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1424 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1424 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1425 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1425 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1426 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1426 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1427 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1427 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1428 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1428 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1429 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1429 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1430 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1430 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1431 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1431 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1432 i18n("<p><b>E</b>: Edit item</p>\n") + 1432 i18n("<p><b>E</b>: Edit item</p>\n") +
1433 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1433 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1434 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1434 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1435 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1435 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1436 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1436 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1437 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1437 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1438 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1438 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1439 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1439 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1440 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1440 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1441 i18n("<p><b>White</b>: Item readonly</p>\n"); 1441 i18n("<p><b>White</b>: Item readonly</p>\n");
1442 displayText( text, cap); 1442 displayText( text, cap);
1443} 1443}
1444void MainWindow::aboutAutoSaving() 1444void MainWindow::aboutAutoSaving()
1445{ 1445{
1446 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1446 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1447 1447
1448 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1448 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1449 1449
1450} 1450}
1451void MainWindow::aboutKnownBugs() 1451void MainWindow::aboutKnownBugs()
1452{ 1452{
1453 QMessageBox* msg; 1453 QMessageBox* msg;
1454 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1454 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1455 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1455 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1456 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1456 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1457 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1457 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1458 i18n("\nor report them in the bugtracker on\n") + 1458 i18n("\nor report them in the bugtracker on\n") +
1459 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1459 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1460 QMessageBox::NoIcon, 1460 QMessageBox::NoIcon,
1461 QMessageBox::Ok, 1461 QMessageBox::Ok,
1462 QMessageBox::NoButton, 1462 QMessageBox::NoButton,
1463 QMessageBox::NoButton); 1463 QMessageBox::NoButton);
1464 msg->exec(); 1464 msg->exec();
1465 delete msg; 1465 delete msg;
1466 1466
1467} 1467}
1468 1468
1469QString MainWindow::defaultFileName() 1469QString MainWindow::defaultFileName()
1470{ 1470{
1471 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1471 return locateLocal( "data", "korganizer/mycalendar.ics" );
1472} 1472}
1473QString MainWindow::syncFileName() 1473QString MainWindow::syncFileName()
1474{ 1474{
1475#ifdef DESKTOP_VERSION 1475#ifdef DESKTOP_VERSION
1476 return locateLocal( "tmp", "synccalendar.ics" ); 1476 return locateLocal( "tmp", "synccalendar.ics" );
1477#else 1477#else
1478 return QString( "/tmp/synccalendar.ics" ); 1478 return QString( "/tmp/synccalendar.ics" );
1479#endif 1479#endif
1480} 1480}
1481void MainWindow::updateWeek(QDate seda) 1481void MainWindow::updateWeek(QDate seda)
1482{ 1482{
1483 int weekNum = 0; 1483 int weekNum = 0;
1484 QDate d = QDate ( seda.year(), 1,1); 1484 QDate d = QDate ( seda.year(), 1,1);
1485 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1485 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1486 if ( seda.addDays(6).year() != seda.year() ) { 1486 if ( seda.addDays(6).year() != seda.year() ) {
1487 if ( seda.year() != d.year() ) { 1487 if ( seda.year() != d.year() ) {
1488 if ( d.dayOfWeek() > 4 ) 1488 if ( d.dayOfWeek() > 4 )
1489 d = QDate ( seda.year(), 1,1); 1489 d = QDate ( seda.year(), 1,1);
1490 else 1490 else
1491 weekNum = 1; 1491 weekNum = 1;
1492 } else { 1492 } else {
1493 QDate dd( seda.year()+1, 1,1); 1493 QDate dd( seda.year()+1, 1,1);
1494 if ( dd.dayOfWeek() <= 4 ) 1494 if ( dd.dayOfWeek() <= 4 )
1495 weekNum = 1; 1495 weekNum = 1;
1496 } 1496 }
1497 } 1497 }
1498 if ( weekNum == 0 ){ 1498 if ( weekNum == 0 ){
1499 int dow = d.dayOfWeek(); 1499 int dow = d.dayOfWeek();
1500 if ( dow <= 4 ) 1500 if ( dow <= 4 )
1501 d = d.addDays( 1-dow ); 1501 d = d.addDays( 1-dow );
1502 else // 5,6,7 1502 else // 5,6,7
1503 d = d.addDays( 8-dow ); 1503 d = d.addDays( 8-dow );
1504 // we have the first week of the year.we are on monday 1504 // we have the first week of the year.we are on monday
1505 weekNum = d.daysTo( seda ) / 7 +1; 1505 weekNum = d.daysTo( seda ) / 7 +1;
1506 } 1506 }
1507 1507
1508 mWeekPixmap.fill( mWeekBgColor ); 1508 mWeekPixmap.fill( mWeekBgColor );
1509 QPainter p ( &mWeekPixmap ); 1509 QPainter p ( &mWeekPixmap );
1510 p.setFont( mWeekFont ); 1510 p.setFont( mWeekFont );
1511 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1511 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1512 p.end(); 1512 p.end();
1513 QIconSet icon3 ( mWeekPixmap ); 1513 QIconSet icon3 ( mWeekPixmap );
1514 mWeekAction->setIconSet ( icon3 ); 1514 mWeekAction->setIconSet ( icon3 );
1515 1515
1516} 1516}
1517void MainWindow::updateWeekNum(const DateList &selectedDates) 1517void MainWindow::updateWeekNum(const DateList &selectedDates)
1518{ 1518{
1519 updateWeek( selectedDates.first() ); 1519 updateWeek( selectedDates.first() );
1520} 1520}
1521void MainWindow::processIncidenceSelection( Incidence *incidence ) 1521void MainWindow::processIncidenceSelection( Incidence *incidence )
1522{ 1522{
1523 1523
1524 if ( !incidence ) { 1524 if ( !incidence ) {
1525 enableIncidenceActions( false ); 1525 enableIncidenceActions( false );
1526 1526
1527 mNewSubTodoAction->setEnabled( false ); 1527 mNewSubTodoAction->setEnabled( false );
1528 setCaptionToDates(); 1528 setCaptionToDates();
1529 return; 1529 return;
1530 1530
1531 } 1531 }
1532 1532
1533 //KGlobal::locale()->formatDateTime(nextA, true); 1533 //KGlobal::locale()->formatDateTime(nextA, true);
1534 QString startString = ""; 1534 QString startString = "";
1535 if ( incidence->type() != "Todo" ) { 1535 if ( incidence->type() != "Todo" ) {
1536 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1536 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1537 if ( incidence->doesFloat() ) { 1537 if ( incidence->doesFloat() ) {
1538 startString += ": "+incidence->dtStartDateStr( true ); 1538 startString += ": "+incidence->dtStartDateStr( true );
1539 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1539 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1540 1540
1541 } else { 1541 } else {
1542 startString = ": "+incidence->dtStartStr(true); 1542 startString = ": "+incidence->dtStartStr(true);
1543 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1543 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1544 1544
1545 } 1545 }
1546 1546
1547 } else { 1547 } else {
1548 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1548 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1549 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1549 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1550 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1550 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1551 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1551 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1552 bool ok; 1552 bool ok;
1553 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1553 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1554 if ( ok ) { 1554 if ( ok ) {
1555 int years = noc.date().year() - incidence->dtStart().date().year(); 1555 int years = noc.date().year() - incidence->dtStart().date().year();
1556 startString += i18n(" (%1 y.)"). arg( years ); 1556 startString += i18n(" (%1 y.)"). arg( years );
1557 } 1557 }
1558 } 1558 }
1559 else 1559 else
1560 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1560 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1561 } 1561 }
1562 1562
1563 } 1563 }
1564 else 1564 else
1565 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1565 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1566 if ( !incidence->location().isEmpty() ) 1566 if ( !incidence->location().isEmpty() )
1567 startString += " (" +incidence->location()+")"; 1567 startString += " (" +incidence->location()+")";
1568 setCaption( incidence->summary()+startString); 1568 setCaption( incidence->summary()+startString);
1569 1569
1570 enableIncidenceActions( true ); 1570 enableIncidenceActions( true );
1571 1571
1572 if ( incidence->type() == "Event" ) { 1572 if ( incidence->type() == "Event" ) {
1573 mShowAction->setText( i18n("Show Event...") ); 1573 mShowAction->setText( i18n("Show Event...") );
1574 mEditAction->setText( i18n("Edit Event...") ); 1574 mEditAction->setText( i18n("Edit Event...") );
1575 mDeleteAction->setText( i18n("Delete Event...") ); 1575 mDeleteAction->setText( i18n("Delete Event...") );
1576 1576
1577 mNewSubTodoAction->setEnabled( false ); 1577 mNewSubTodoAction->setEnabled( false );
1578 } else if ( incidence->type() == "Todo" ) { 1578 } else if ( incidence->type() == "Todo" ) {
1579 mShowAction->setText( i18n("Show Todo...") ); 1579 mShowAction->setText( i18n("Show Todo...") );
1580 mEditAction->setText( i18n("Edit Todo...") ); 1580 mEditAction->setText( i18n("Edit Todo...") );
1581 mDeleteAction->setText( i18n("Delete Todo...") ); 1581 mDeleteAction->setText( i18n("Delete Todo...") );
1582 1582
1583 mNewSubTodoAction->setEnabled( true ); 1583 mNewSubTodoAction->setEnabled( true );
1584 } else { 1584 } else {
1585 mShowAction->setText( i18n("Show...") ); 1585 mShowAction->setText( i18n("Show...") );
1586 mShowAction->setText( i18n("Edit...") ); 1586 mShowAction->setText( i18n("Edit...") );
1587 mShowAction->setText( i18n("Delete...") ); 1587 mShowAction->setText( i18n("Delete...") );
1588 1588
1589 mNewSubTodoAction->setEnabled( false ); 1589 mNewSubTodoAction->setEnabled( false );
1590 } 1590 }
1591} 1591}
1592 1592
1593void MainWindow::enableIncidenceActions( bool enabled ) 1593void MainWindow::enableIncidenceActions( bool enabled )
1594{ 1594{
1595 mShowAction->setEnabled( enabled ); 1595 mShowAction->setEnabled( enabled );
1596 mEditAction->setEnabled( enabled ); 1596 mEditAction->setEnabled( enabled );
1597 mDeleteAction->setEnabled( enabled ); 1597 mDeleteAction->setEnabled( enabled );
1598 1598
1599 mCloneAction->setEnabled( enabled ); 1599 mCloneAction->setEnabled( enabled );
1600 mMoveAction->setEnabled( enabled ); 1600 mMoveAction->setEnabled( enabled );
1601 mBeamAction->setEnabled( enabled ); 1601 mBeamAction->setEnabled( enabled );
1602 mCancelAction->setEnabled( enabled ); 1602 mCancelAction->setEnabled( enabled );
1603} 1603}
1604 1604
1605void MainWindow::importOL() 1605void MainWindow::importOL()
1606{ 1606{
1607#ifdef _OL_IMPORT_ 1607#ifdef _OL_IMPORT_
1608 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1608 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1609 id->exec(); 1609 id->exec();
1610 delete id; 1610 delete id;
1611 mView->updateView(); 1611 mView->updateView();
1612#endif 1612#endif
1613} 1613}
1614void MainWindow::importBday() 1614void MainWindow::importBday()
1615{ 1615{
1616 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1616 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1617 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1617 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1618 i18n("Import!"), i18n("Cancel"), 0, 1618 i18n("Import!"), i18n("Cancel"), 0,
1619 0, 1 ); 1619 0, 1 );
1620 if ( result == 0 ) { 1620 if ( result == 0 ) {
1621 mView->importBday(); 1621 mView->importBday();
1622 1622
1623 } 1623 }
1624 1624
1625 1625
1626} 1626}
1627void MainWindow::importQtopia() 1627void MainWindow::importQtopia()
1628{ 1628{
1629 //#ifndef DESKTOP_VERSION 1629 //#ifndef DESKTOP_VERSION
1630 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1630 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1631#ifdef DESKTOP_VERSION 1631#ifdef DESKTOP_VERSION
1632 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1632 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1633#endif 1633#endif
1634 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1634 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1635 i18n("Import!"), i18n("Cancel"), 0, 1635 i18n("Import!"), i18n("Cancel"), 0,
1636 0, 1 ); 1636 0, 1 );
1637 if ( result == 0 ) { 1637 if ( result == 0 ) {
1638#ifndef DESKTOP_VERSION 1638#ifndef DESKTOP_VERSION
1639 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1639 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1640 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1640 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1641 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1641 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1642#else 1642#else
1643 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1643 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1644 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1644 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1645 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1645 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1646#endif 1646#endif
1647 mView->importQtopia( categories, datebook, todolist ); 1647 mView->importQtopia( categories, datebook, todolist );
1648 } 1648 }
1649#if 0 1649#if 0
1650 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1650 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1651 i18n("Not supported \non desktop!\n"), 1651 i18n("Not supported \non desktop!\n"),
1652 i18n("Ok"), i18n("Cancel"), 0, 1652 i18n("Ok"), i18n("Cancel"), 0,
1653 0, 1 ); 1653 0, 1 );
1654 1654
1655#endif 1655#endif
1656} 1656}
1657 1657
1658void MainWindow::saveOnClose() 1658void MainWindow::saveOnClose()
1659{ 1659{
1660 KOPrefs *p = KOPrefs::instance(); 1660 KOPrefs *p = KOPrefs::instance();
1661 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1661 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1662 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1663 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1664 if ( filterToolBar ) {
1665 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1666 }
1667#ifdef DESKTOP_VERSION
1668
1669 QPoint myP;
1670 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1671 if ( p->mToolBarHor )
1672 p->mToolBarUp = myP.y() > height()/2;
1673 else
1674 p->mToolBarUp = myP.x() > width()/2;
1675 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1676 if ( p->mToolBarHorV )
1677 p->mToolBarUpV = myP.y() > height()/2;
1678 else
1679 p->mToolBarUpV = myP.x() > width()/2 ;
1680 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1681 if ( p->mToolBarHorN )
1682 p->mToolBarUpN = myP.y() > height()/2;
1683 else
1684 p->mToolBarUpN = myP.x() > width()/2 ;
1685 if ( filterToolBar ) {
1686 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1687 if ( p->mToolBarHorF )
1688 p->mToolBarUpF = myP.y() > height()/2;
1689 else
1690 p->mToolBarUpF = myP.x() > width()/2 ;
1691 }
1692#else
1662 if ( p->mToolBarHor ) 1693 if ( p->mToolBarHor )
1663 p->mToolBarUp = iconToolBar->y() > height()/2; 1694 p->mToolBarUp = iconToolBar->y() > height()/2;
1664 else 1695 else
1665 p->mToolBarUp = iconToolBar->x() > width()/2; 1696 p->mToolBarUp = iconToolBar->x() > width()/2;
1666 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1667 if ( p->mToolBarHorV ) 1697 if ( p->mToolBarHorV )
1668 p->mToolBarUpV = viewToolBar->y() > height()/2; 1698 p->mToolBarUpV = viewToolBar->y() > height()/2;
1669 else 1699 else
1670 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1700 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1671 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1701
1672 if ( p->mToolBarHorN ) 1702 if ( p->mToolBarHorN )
1673 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1703 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1674 else 1704 else
1675 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1705 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1676 if ( filterToolBar ) { 1706 if ( filterToolBar ) {
1677 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1678 if ( p->mToolBarHorF ) 1707 if ( p->mToolBarHorF )
1679 p->mToolBarUpF = filterToolBar->y() > height()/2; 1708 p->mToolBarUpF = filterToolBar->y() > height()/2;
1680 else 1709 else
1681 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1710 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1682 } 1711 }
1712#endif
1713
1714
1683 mView->writeSettings(); 1715 mView->writeSettings();
1684 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1716 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1685 save(); 1717 save();
1686} 1718}
1687void MainWindow::slotModifiedChanged( bool changed ) 1719void MainWindow::slotModifiedChanged( bool changed )
1688{ 1720{
1689 if ( mBlockAtStartup ) 1721 if ( mBlockAtStartup )
1690 return; 1722 return;
1691 1723
1692 int msec; 1724 int msec;
1693 // we store the changes after 1 minute, 1725 // we store the changes after 1 minute,
1694 // and for safety reasons after 10 minutes again 1726 // and for safety reasons after 10 minutes again
1695 if ( !mSyncManager->blockSave() ) 1727 if ( !mSyncManager->blockSave() )
1696 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1728 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1697 else 1729 else
1698 msec = 1000 * 600; 1730 msec = 1000 * 600;
1699 mSaveTimer.start( msec, true ); // 1 minute 1731 mSaveTimer.start( msec, true ); // 1 minute
1700 qDebug("KO: Saving File in %d secs!", msec/1000); 1732 qDebug("KO: Saving File in %d secs!", msec/1000);
1701 mCalendarModifiedFlag = true; 1733 mCalendarModifiedFlag = true;
1702} 1734}
1703void MainWindow::saveStopTimer() 1735void MainWindow::saveStopTimer()
1704{ 1736{
1705 mSaveTimer.stop(); 1737 mSaveTimer.stop();
1706 if (mSaveTimer.isActive() ) 1738 if (mSaveTimer.isActive() )
1707 qDebug("ti active "); 1739 qDebug("ti active ");
1708 else 1740 else
1709 qDebug("KO: Save timer stopped"); 1741 qDebug("KO: Save timer stopped");
1710} 1742}
1711void MainWindow::save() 1743void MainWindow::save()
1712{ 1744{
1713 if ( !mCalendarModifiedFlag ) { 1745 if ( !mCalendarModifiedFlag ) {
1714 qDebug("KO: Calendar not modified. Nothing saved."); 1746 qDebug("KO: Calendar not modified. Nothing saved.");
1715 return; 1747 return;
1716 } 1748 }
1717 if ( mSyncManager->blockSave() ) 1749 if ( mSyncManager->blockSave() )
1718 return; 1750 return;
1719 mSyncManager->setBlockSave(true); 1751 mSyncManager->setBlockSave(true);
1720 if ( mView->checkFileVersion( defaultFileName()) ) { 1752 if ( mView->checkFileVersion( defaultFileName()) ) {
1721 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1753 QTime neededSaveTime = QDateTime::currentDateTime().time();
1722 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1754 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1723 qDebug("KO: Start saving data to file!"); 1755 qDebug("KO: Start saving data to file!");
1724 mView->saveCalendar( defaultFileName() ); 1756 mView->saveCalendar( defaultFileName() );
1725 mCalendarModifiedFlag = false; 1757 mCalendarModifiedFlag = false;
1726 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1758 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1727 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1759 qDebug("KO: Needed %d ms for saving.",msNeeded );
1728 QString savemes; 1760 QString savemes;
1729 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1761 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1730 setCaption(savemes); 1762 setCaption(savemes);
1731 } else 1763 } else
1732 setCaption(i18n("Saving cancelled!")); 1764 setCaption(i18n("Saving cancelled!"));
1733 mSyncManager->setBlockSave( false ); 1765 mSyncManager->setBlockSave( false );
1734} 1766}
1735 1767
1736void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1768void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1737{ 1769{
1738 if ( !e->isAutoRepeat() ) { 1770 if ( !e->isAutoRepeat() ) {
1739 mFlagKeyPressed = false; 1771 mFlagKeyPressed = false;
1740 } 1772 }
1741} 1773}
1742void MainWindow::keyPressEvent ( QKeyEvent * e ) 1774void MainWindow::keyPressEvent ( QKeyEvent * e )
1743{ 1775{
1744 qApp->processEvents(); 1776 qApp->processEvents();
1745 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1777 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1746 e->ignore(); 1778 e->ignore();
1747 // qDebug(" ignore %d",e->isAutoRepeat() ); 1779 // qDebug(" ignore %d",e->isAutoRepeat() );
1748 return; 1780 return;
1749 } 1781 }
1750 if (! e->isAutoRepeat() ) 1782 if (! e->isAutoRepeat() )
1751 mFlagKeyPressed = true; 1783 mFlagKeyPressed = true;
1752 KOPrefs *p = KOPrefs::instance(); 1784 KOPrefs *p = KOPrefs::instance();
1753 bool showSelectedDates = false; 1785 bool showSelectedDates = false;
1754 int size; 1786 int size;
1755 int pro = 0; 1787 int pro = 0;
1756 //qDebug("MainWindow::keyPressEvent "); 1788 //qDebug("MainWindow::keyPressEvent ");
1757 switch ( e->key() ) { 1789 switch ( e->key() ) {
1758 case Qt::Key_Right: 1790 case Qt::Key_Right:
1759 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1791 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1760 mView->goNextMonth(); 1792 mView->goNextMonth();
1761 else 1793 else
1762 mView->goNext(); 1794 mView->goNext();
1763 showSelectedDates = true; 1795 showSelectedDates = true;
1764 break; 1796 break;
1765 case Qt::Key_Left: 1797 case Qt::Key_Left:
1766 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1798 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1767 mView->goPreviousMonth(); 1799 mView->goPreviousMonth();
1768 else 1800 else
1769 mView->goPrevious(); 1801 mView->goPrevious();
1770 showSelectedDates = true; 1802 showSelectedDates = true;
1771 break; 1803 break;
1772 case Qt::Key_Down: 1804 case Qt::Key_Down:
1773 mView->viewManager()->agendaView()->scrollOneHourDown(); 1805 mView->viewManager()->agendaView()->scrollOneHourDown();
1774 break; 1806 break;
1775 case Qt::Key_Up: 1807 case Qt::Key_Up:
1776 mView->viewManager()->agendaView()->scrollOneHourUp(); 1808 mView->viewManager()->agendaView()->scrollOneHourUp();
1777 break; 1809 break;
1778 case Qt::Key_K: 1810 case Qt::Key_K:
1779 mView->viewManager()->showMonthViewWeek(); 1811 mView->viewManager()->showMonthViewWeek();
1780 break; 1812 break;
1781 case Qt::Key_I: 1813 case Qt::Key_I:
1782 mView->showIncidence(); 1814 mView->showIncidence();
1783 break; 1815 break;
1784 case Qt::Key_Delete: 1816 case Qt::Key_Delete:
1785 case Qt::Key_Backspace: 1817 case Qt::Key_Backspace:
1786 mView->deleteIncidence(); 1818 mView->deleteIncidence();
1787 break; 1819 break;
1788 case Qt::Key_D: 1820 case Qt::Key_D:
1789 mView->viewManager()->showDayView(); 1821 mView->viewManager()->showDayView();
1790 showSelectedDates = true; 1822 showSelectedDates = true;
1791 break; 1823 break;
1792 case Qt::Key_O: 1824 case Qt::Key_O:
1793 mView->toggleFilerEnabled( ); 1825 mView->toggleFilerEnabled( );
1794 break; 1826 break;
1795 case Qt::Key_0: 1827 case Qt::Key_0:
1796 case Qt::Key_1: 1828 case Qt::Key_1:
1797 case Qt::Key_2: 1829 case Qt::Key_2:
1798 case Qt::Key_3: 1830 case Qt::Key_3:
1799 case Qt::Key_4: 1831 case Qt::Key_4:
1800 case Qt::Key_5: 1832 case Qt::Key_5:
1801 case Qt::Key_6: 1833 case Qt::Key_6:
1802 case Qt::Key_7: 1834 case Qt::Key_7:
1803 case Qt::Key_8: 1835 case Qt::Key_8:
1804 case Qt::Key_9: 1836 case Qt::Key_9:
1805 pro = e->key()-48; 1837 pro = e->key()-48;
1806 if ( pro == 0 ) 1838 if ( pro == 0 )
1807 pro = 10; 1839 pro = 10;
1808 if ( e->state() == Qt::ControlButton) 1840 if ( e->state() == Qt::ControlButton)
1809 pro += 10; 1841 pro += 10;
1810 break; 1842 break;
1811 case Qt::Key_M: 1843 case Qt::Key_M:
1812 mView->viewManager()->showMonthView(); 1844 mView->viewManager()->showMonthView();
1813 showSelectedDates = true; 1845 showSelectedDates = true;
1814 break; 1846 break;
1815 case Qt::Key_Insert: 1847 case Qt::Key_Insert:
1816 mView->newEvent(); 1848 mView->newEvent();
1817 break; 1849 break;
1818 case Qt::Key_S : 1850 case Qt::Key_S :
1819 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1851 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1820 mView->newSubTodo(); 1852 mView->newSubTodo();
1821 else 1853 else
1822 mView->dialogManager()->showSearchDialog(); 1854 mView->dialogManager()->showSearchDialog();
1823 break; 1855 break;
1824 case Qt::Key_Y : 1856 case Qt::Key_Y :
1825 case Qt::Key_Z : 1857 case Qt::Key_Z :
1826 mView->viewManager()->showWorkWeekView(); 1858 mView->viewManager()->showWorkWeekView();
1827 showSelectedDates = true; 1859 showSelectedDates = true;
1828 break; 1860 break;
1829 case Qt::Key_U : 1861 case Qt::Key_U :
1830 mView->viewManager()->showWeekView(); 1862 mView->viewManager()->showWeekView();
1831 showSelectedDates = true; 1863 showSelectedDates = true;
1832 break; 1864 break;
1833 case Qt::Key_H : 1865 case Qt::Key_H :
1834 keyBindings(); 1866 keyBindings();
1835 break; 1867 break;
1836 case Qt::Key_W: 1868 case Qt::Key_W:
1837 mView->viewManager()->showWhatsNextView(); 1869 mView->viewManager()->showWhatsNextView();
1838 break; 1870 break;
1839 case Qt::Key_L: 1871 case Qt::Key_L:
1840 mView->viewManager()->showListView(); 1872 mView->viewManager()->showListView();
1841 break; 1873 break;
1842 case Qt::Key_N: 1874 case Qt::Key_N:
1843 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1875 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1844 mView->viewManager()->showNextView(); 1876 mView->viewManager()->showNextView();
1845 else { 1877 else {
1846 mView->viewManager()->showNextXView(); 1878 mView->viewManager()->showNextXView();
1847 showSelectedDates = true; 1879 showSelectedDates = true;
1848 } 1880 }
1849 break; 1881 break;
1850 case Qt::Key_V: 1882 case Qt::Key_V:
1851 mView->viewManager()->showTodoView(); 1883 mView->viewManager()->showTodoView();
1852 break; 1884 break;
1853 case Qt::Key_C: 1885 case Qt::Key_C:
1854 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1886 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1855 break; 1887 break;
1856 case Qt::Key_P: 1888 case Qt::Key_P:
1857 mView->showDatePicker( ); 1889 mView->showDatePicker( );
1858 break; 1890 break;
1859 case Qt::Key_F: 1891 case Qt::Key_F:
1860 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1892 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1861 mView->editFilters(); 1893 mView->editFilters();
1862 else 1894 else
1863 mView->toggleFilter(); 1895 mView->toggleFilter();
1864 break; 1896 break;
1865 case Qt::Key_X: 1897 case Qt::Key_X:
1866 mView->toggleDateNavigatorWidget(); 1898 mView->toggleDateNavigatorWidget();
1867 break; 1899 break;
1868 case Qt::Key_Space: 1900 case Qt::Key_Space:
1869 mView->toggleExpand(); 1901 mView->toggleExpand();
1870 break; 1902 break;
1871 case Qt::Key_A: 1903 case Qt::Key_A:
1872 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1904 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1873 mView->showNextAlarms(); 1905 mView->showNextAlarms();
1874 else 1906 else
1875 mView->toggleAllDaySize(); 1907 mView->toggleAllDaySize();
1876 break; 1908 break;
1877 case Qt::Key_T: 1909 case Qt::Key_T:
1878 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1910 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1879 mView->newTodo(); 1911 mView->newTodo();
1880 else { 1912 else {
1881 mView->goToday(); 1913 mView->goToday();
1882 showSelectedDates = true; 1914 showSelectedDates = true;
1883 } 1915 }
1884 break; 1916 break;
1885 case Qt::Key_J: 1917 case Qt::Key_J:
1886 mView->viewManager()->showJournalView(); 1918 mView->viewManager()->showJournalView();
1887 break; 1919 break;
1888 case Qt::Key_B: 1920 case Qt::Key_B:
1889 mView->editIncidenceDescription();; 1921 mView->editIncidenceDescription();;
1890 break; 1922 break;
1891 // case Qt::Key_Return: 1923 // case Qt::Key_Return:
1892 case Qt::Key_E: 1924 case Qt::Key_E:
1893 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1925 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1894 mView->newEvent(); 1926 mView->newEvent();
1895 else 1927 else
1896 mView->editIncidence(); 1928 mView->editIncidence();
1897 break; 1929 break;
1898 case Qt::Key_Plus: 1930 case Qt::Key_Plus:
1899 size = p->mHourSize +2; 1931 size = p->mHourSize +2;
1900 if ( size <= 22 ) 1932 if ( size <= 22 )
1901 configureAgenda( size ); 1933 configureAgenda( size );
1902 break; 1934 break;
1903 case Qt::Key_Minus: 1935 case Qt::Key_Minus:
1904 size = p->mHourSize - 2; 1936 size = p->mHourSize - 2;
1905 if ( size >= 4 ) 1937 if ( size >= 4 )
1906 configureAgenda( size ); 1938 configureAgenda( size );
1907 break; 1939 break;
1908 1940
1909 1941
1910 default: 1942 default:
1911 e->ignore(); 1943 e->ignore();
1912 } 1944 }
1913 if ( pro > 0 ) { 1945 if ( pro > 0 ) {
1914 mView->selectFilter( pro-1 ); 1946 mView->selectFilter( pro-1 );
1915 } 1947 }
1916 if ( showSelectedDates ) { 1948 if ( showSelectedDates ) {
1917 ;// setCaptionToDates(); 1949 ;// setCaptionToDates();
1918 } 1950 }
1919 1951
1920} 1952}
1921 1953
1922void MainWindow::fillFilterMenu() 1954void MainWindow::fillFilterMenu()
1923{ 1955{
1924 selectFilterMenu->clear(); 1956 selectFilterMenu->clear();
1925 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1957 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1926 selectFilterMenu->insertSeparator(); 1958 selectFilterMenu->insertSeparator();
1927 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 1959 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
1928 1960
1929 selectFilterMenu->insertSeparator(); 1961 selectFilterMenu->insertSeparator();
1930 QPtrList<CalFilter> fili = mView->filters(); 1962 QPtrList<CalFilter> fili = mView->filters();
1931 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1963 CalFilter *curfilter = mView->filterView()->selectedFilter();
1932 CalFilter *filter = fili.first(); 1964 CalFilter *filter = fili.first();
1933 int iii = 2; 1965 int iii = 2;
1934 bool checkitem = mView->filterView()->filtersEnabled(); 1966 bool checkitem = mView->filterView()->filtersEnabled();
1935 while(filter) { 1967 while(filter) {
1936 selectFilterMenu->insertItem( filter->name(), iii ); 1968 selectFilterMenu->insertItem( filter->name(), iii );
1937 if ( filter == curfilter) 1969 if ( filter == curfilter)
1938 selectFilterMenu->setItemChecked( iii, checkitem ); 1970 selectFilterMenu->setItemChecked( iii, checkitem );
1939 filter = fili.next(); 1971 filter = fili.next();
1940 ++iii; 1972 ++iii;
1941 } 1973 }
1942 if ( !checkitem ) 1974 if ( !checkitem )
1943 selectFilterMenu->setItemChecked( 1, true ); 1975 selectFilterMenu->setItemChecked( 1, true );
1944} 1976}
1945void MainWindow::fillFilterMenuPopup() 1977void MainWindow::fillFilterMenuPopup()
1946{ 1978{
1947 filterPopupMenu->clear(); 1979 filterPopupMenu->clear();
1948 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 1980 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
1949 1981
1950 filterPopupMenu->insertSeparator(); 1982 filterPopupMenu->insertSeparator();
1951 QPtrList<CalFilter> fili = mView->filters(); 1983 QPtrList<CalFilter> fili = mView->filters();
1952 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1984 CalFilter *curfilter = mView->filterView()->selectedFilter();
1953 CalFilter *filter = fili.first(); 1985 CalFilter *filter = fili.first();
1954 int iii = 1; 1986 int iii = 1;
1955 bool checkitem = mView->filterView()->filtersEnabled(); 1987 bool checkitem = mView->filterView()->filtersEnabled();
1956 while(filter) { 1988 while(filter) {
1957 filterPopupMenu->insertItem( filter->name(), iii ); 1989 filterPopupMenu->insertItem( filter->name(), iii );
1958 if ( filter == curfilter) 1990 if ( filter == curfilter)
1959 filterPopupMenu->setItemChecked( iii, checkitem ); 1991 filterPopupMenu->setItemChecked( iii, checkitem );
1960 filter = fili.next(); 1992 filter = fili.next();
1961 ++iii; 1993 ++iii;
1962 } 1994 }
1963 if ( !checkitem ) 1995 if ( !checkitem )
1964 filterPopupMenu->setItemChecked( 0, true ); 1996 filterPopupMenu->setItemChecked( 0, true );
1965} 1997}
1966void MainWindow::selectFilter( int fil ) 1998void MainWindow::selectFilter( int fil )
1967{ 1999{
1968 2000
1969 if ( fil == 0 ) { 2001 if ( fil == 0 ) {
1970 mView->editFilters( ); 2002 mView->editFilters( );
1971 } else if ( fil == 1 ){ 2003 } else if ( fil == 1 ){
1972 if ( mView->filterView()->filtersEnabled() ) 2004 if ( mView->filterView()->filtersEnabled() )
1973 mView->toggleFilerEnabled( ); 2005 mView->toggleFilerEnabled( );
1974 } else { 2006 } else {
1975 if ( !mView->filterView()->filtersEnabled() ) { 2007 if ( !mView->filterView()->filtersEnabled() ) {
1976 mView->filterView()->blockSignals( true ); 2008 mView->filterView()->blockSignals( true );
1977 mView->toggleFilerEnabled( ); 2009 mView->toggleFilerEnabled( );
1978 mView->filterView()->blockSignals( false ); 2010 mView->filterView()->blockSignals( false );
1979 } 2011 }
1980 mView->selectFilter( fil-2 ); 2012 mView->selectFilter( fil-2 );
1981 } 2013 }
1982} 2014}
1983void MainWindow::updateFilterToolbar() 2015void MainWindow::updateFilterToolbar()
1984{ 2016{
1985 if ( filterMenubar ) { 2017 if ( filterMenubar ) {
1986 if ( !mView->filterView()->filtersEnabled() ) { 2018 if ( !mView->filterView()->filtersEnabled() ) {
1987 filterMenubar->changeItem( 0, i18n("No Filter") ); 2019 filterMenubar->changeItem( 0, i18n("No Filter") );
1988 } else { 2020 } else {
1989 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2021 CalFilter *curfilter = mView->filterView()->selectedFilter();
1990 if ( curfilter ) { 2022 if ( curfilter ) {
1991 filterMenubar->changeItem( 0, curfilter->name() ); 2023 filterMenubar->changeItem( 0, curfilter->name() );
1992 } 2024 }
1993 } 2025 }
1994 } 2026 }
1995} 2027}
1996void MainWindow::selectFilterPopup( int fil ) 2028void MainWindow::selectFilterPopup( int fil )
1997{ 2029{
1998 selectFilter( fil + 1 ); 2030 selectFilter( fil + 1 );
1999 2031
2000} 2032}
2001void MainWindow::configureToolBar( int item ) 2033void MainWindow::configureToolBar( int item )
2002{ 2034{
2003 2035
2004 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2036 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2005 KOPrefs *p = KOPrefs::instance(); 2037 KOPrefs *p = KOPrefs::instance();
2006 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2038 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2007 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2039 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2008 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2040 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2009 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2041 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2010 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2042 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2011 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2043 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2012 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2044 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2013 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2045 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2014 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2046 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2015 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2047 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2016 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2048 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2017 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2049 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2018 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2050 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2019 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2051 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2020 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2052 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2021 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2053 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2022 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2054 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2023 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2055 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2024 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2056 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2025 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2057 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2026 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2058 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2027 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2059 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2028 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2060 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2029 // initActions(); 2061 // initActions();
2030} 2062}
2031void MainWindow::setCaption ( const QString & c ) 2063void MainWindow::setCaption ( const QString & c )
2032{ 2064{
2033 QString cap = c; 2065 QString cap = c;
2034 cap.replace( QRegExp("\n"), " " ); 2066 cap.replace( QRegExp("\n"), " " );
2035 cap = cap.stripWhiteSpace(); 2067 cap = cap.stripWhiteSpace();
2036 if ( cap.isEmpty() ) 2068 if ( cap.isEmpty() )
2037 cap = "KO/Pi"; 2069 cap = "KO/Pi";
2038 QWidget::setCaption( cap ); 2070 QWidget::setCaption( cap );
2039} 2071}
2040void MainWindow::setCaptionToDates() 2072void MainWindow::setCaptionToDates()
2041{ 2073{
2042 QString selDates; 2074 QString selDates;
2043 QDate date = mView->startDate(); 2075 QDate date = mView->startDate();
2044 if ( ! date.isValid() ) { 2076 if ( ! date.isValid() ) {
2045 setCaption(""); 2077 setCaption("");
2046 return; 2078 return;
2047 } 2079 }
2048 selDates = KGlobal::locale()->formatDate( date, true); 2080 selDates = KGlobal::locale()->formatDate( date, true);
2049 if (mView->startDate() < mView->endDate() ) 2081 if (mView->startDate() < mView->endDate() )
2050 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2082 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2051 else { 2083 else {
2052 QString addString; 2084 QString addString;
2053 if ( date == QDateTime::currentDateTime().date() ) 2085 if ( date == QDateTime::currentDateTime().date() )
2054 addString = i18n("Today"); 2086 addString = i18n("Today");
2055 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2087 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2056 addString = i18n("Tomorrow"); 2088 addString = i18n("Tomorrow");
2057 if ( !addString.isEmpty() ) 2089 if ( !addString.isEmpty() )
2058 selDates = addString+", "+selDates ; 2090 selDates = addString+", "+selDates ;
2059 } 2091 }
2060 setCaption( i18n("Dates: ") + selDates ); 2092 setCaption( i18n("Dates: ") + selDates );
2061 2093
2062} 2094}
2063void MainWindow::showConfigureAgenda( ) 2095void MainWindow::showConfigureAgenda( )
2064{ 2096{
2065 int iii; 2097 int iii;
2066 for ( iii = 1;iii<= 10 ;++iii ){ 2098 for ( iii = 1;iii<= 10 ;++iii ){
2067 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2099 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2068 } 2100 }
2069 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2101 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2070} 2102}
2071void MainWindow::configureAgenda( int item ) 2103void MainWindow::configureAgenda( int item )
2072{ 2104{
2073 if ( KOPrefs::instance()->mHourSize == item ) 2105 if ( KOPrefs::instance()->mHourSize == item )
2074 return; 2106 return;
2075 KOPrefs::instance()->mHourSize=item; 2107 KOPrefs::instance()->mHourSize=item;
2076 mView->viewManager()->agendaView()->updateConfig(); 2108 mView->viewManager()->agendaView()->updateConfig();
2077} 2109}
2078 2110
2079void MainWindow::saveCalendar() 2111void MainWindow::saveCalendar()
2080{ 2112{
2081 QString fn = KOPrefs::instance()->mLastSaveFile; 2113 QString fn = KOPrefs::instance()->mLastSaveFile;
2082 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2114 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2083 2115
2084 if ( fn == "" ) 2116 if ( fn == "" )
2085 return; 2117 return;
2086 QFileInfo info; 2118 QFileInfo info;
2087 info.setFile( fn ); 2119 info.setFile( fn );
2088 QString mes; 2120 QString mes;
2089 bool createbup = true; 2121 bool createbup = true;
2090 if ( info. exists() ) { 2122 if ( info. exists() ) {
2091 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2123 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2092 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2124 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2093 i18n("Overwrite!"), i18n("Cancel"), 0, 2125 i18n("Overwrite!"), i18n("Cancel"), 0,
2094 0, 1 ); 2126 0, 1 );
2095 if ( result != 0 ) { 2127 if ( result != 0 ) {
2096 createbup = false; 2128 createbup = false;
2097 } 2129 }
2098 } 2130 }
2099 if ( createbup ) { 2131 if ( createbup ) {
2100 mView->saveCalendar( fn ); 2132 mView->saveCalendar( fn );
2101 mes = i18n("KO/Pi:Saved %1").arg(fn); 2133 mes = i18n("KO/Pi:Saved %1").arg(fn);
2102 KOPrefs::instance()->mLastSaveFile = fn; 2134 KOPrefs::instance()->mLastSaveFile = fn;
2103 setCaption(mes); 2135 setCaption(mes);
2104 } 2136 }
2105} 2137}
2106void MainWindow::loadCalendar() 2138void MainWindow::loadCalendar()
2107{ 2139{
2108 2140
2109 QString fn = KOPrefs::instance()->mLastLoadFile; 2141 QString fn = KOPrefs::instance()->mLastLoadFile;
2110 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2142 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2111 2143
2112 if ( fn == "" ) 2144 if ( fn == "" )
2113 return; 2145 return;
2114 QFileInfo info; 2146 QFileInfo info;
2115 info.setFile( fn ); 2147 info.setFile( fn );
2116 QString mess; 2148 QString mess;
2117 bool loadbup = true; 2149 bool loadbup = true;
2118 if ( info. exists() ) { 2150 if ( info. exists() ) {
2119 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2151 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2120 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2152 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2121 mess, 2153 mess,
2122 i18n("Load!"), i18n("Cancel"), 0, 2154 i18n("Load!"), i18n("Cancel"), 0,
2123 0, 1 ); 2155 0, 1 );
2124 if ( result != 0 ) { 2156 if ( result != 0 ) {
2125 loadbup = false; 2157 loadbup = false;
2126 } 2158 }
2127 } else { 2159 } else {
2128 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2160 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2129 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2161 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2130 0, 1 ); 2162 0, 1 );
2131 2163
2132 return; 2164 return;
2133 } 2165 }
2134 if ( loadbup ) { 2166 if ( loadbup ) {
2135 mView->openCalendar( fn ); 2167 mView->openCalendar( fn );
2136 KOPrefs::instance()->mLastLoadFile = fn; 2168 KOPrefs::instance()->mLastLoadFile = fn;
2137 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2169 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2138 setCaption(mess); 2170 setCaption(mess);
2139 } 2171 }
2140 2172
2141} 2173}
2142void MainWindow::quickImportIcal() 2174void MainWindow::quickImportIcal()
2143{ 2175{
2144 importFile( KOPrefs::instance()->mLastImportFile, false ); 2176 importFile( KOPrefs::instance()->mLastImportFile, false );
2145} 2177}
2146void MainWindow::importFile( QString fn, bool quick ) 2178void MainWindow::importFile( QString fn, bool quick )
2147{ 2179{
2148 QFileInfo info; 2180 QFileInfo info;
2149 info.setFile( fn ); 2181 info.setFile( fn );
2150 QString mess; 2182 QString mess;
2151 bool loadbup = true; 2183 bool loadbup = true;
2152 if ( !info. exists() ) { 2184 if ( !info. exists() ) {
2153 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2185 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2154 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2186 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2155 mess ); 2187 mess );
2156 return; 2188 return;
2157 } 2189 }
2158 int result = 0; 2190 int result = 0;
2159 if ( !quick ) { 2191 if ( !quick ) {
2160 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 )); 2192 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 ));
2161 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2193 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2162 mess, 2194 mess,
2163 "Import", "Cancel", 0, 2195 "Import", "Cancel", 0,
2164 0, 1 ); 2196 0, 1 );
2165 } 2197 }
2166 if ( result == 0 ) { 2198 if ( result == 0 ) {
2167 if ( mView->openCalendar( fn, true )) { 2199 if ( mView->openCalendar( fn, true )) {
2168 KOPrefs::instance()->mLastImportFile = fn; 2200 KOPrefs::instance()->mLastImportFile = fn;
2169 setCaption(i18n("Imported file successfully")); 2201 setCaption(i18n("Imported file successfully"));
2170 } else { 2202 } else {
2171 setCaption(i18n("Error importing file")); 2203 setCaption(i18n("Error importing file"));
2172 } 2204 }
2173 } 2205 }
2174} 2206}
2175 2207
2176void MainWindow::importIcal() 2208void MainWindow::importIcal()
2177{ 2209{
2178 2210
2179 QString fn =KOPrefs::instance()->mLastImportFile; 2211 QString fn =KOPrefs::instance()->mLastImportFile;
2180 2212
2181 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2213 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2182 if ( fn == "" ) 2214 if ( fn == "" )
2183 return; 2215 return;
2184 importFile( fn, true ); 2216 importFile( fn, true );
2185 2217
2186} 2218}
2187 2219
2188void MainWindow::exportVCalendar() 2220void MainWindow::exportVCalendar()
2189{ 2221{
2190 QString fn = KOPrefs::instance()->mLastVcalFile; 2222 QString fn = KOPrefs::instance()->mLastVcalFile;
2191 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2223 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2192 if ( fn == "" ) 2224 if ( fn == "" )
2193 return; 2225 return;
2194 QFileInfo info; 2226 QFileInfo info;
2195 info.setFile( fn ); 2227 info.setFile( fn );
2196 QString mes; 2228 QString mes;
2197 bool createbup = true; 2229 bool createbup = true;
2198 if ( info. exists() ) { 2230 if ( info. exists() ) {
2199 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2231 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2200 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2232 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2201 i18n("Overwrite!"), i18n("Cancel"), 0, 2233 i18n("Overwrite!"), i18n("Cancel"), 0,
2202 0, 1 ); 2234 0, 1 );
2203 if ( result != 0 ) { 2235 if ( result != 0 ) {
2204 createbup = false; 2236 createbup = false;
2205 } 2237 }
2206 } 2238 }
2207 if ( createbup ) { 2239 if ( createbup ) {
2208 if ( mView->exportVCalendar( fn ) ) { 2240 if ( mView->exportVCalendar( fn ) ) {
2209 KOPrefs::instance()->mLastVcalFile = fn; 2241 KOPrefs::instance()->mLastVcalFile = fn;
2210 if ( fn.length() > 20 ) 2242 if ( fn.length() > 20 )
2211 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2243 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2212 else 2244 else
2213 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2245 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2214 setCaption(mes); 2246 setCaption(mes);
2215 } 2247 }
2216 } 2248 }
2217 2249
2218} 2250}
2219QString MainWindow::sentSyncFile() 2251QString MainWindow::sentSyncFile()
2220{ 2252{
2221#ifdef DESKTOP_VERSION 2253#ifdef DESKTOP_VERSION
2222 return locateLocal( "tmp", "copysynccal.ics" ); 2254 return locateLocal( "tmp", "copysynccal.ics" );
2223#else 2255#else
2224 return QString( "/tmp/copysynccal.ics" ); 2256 return QString( "/tmp/copysynccal.ics" );
2225#endif 2257#endif
2226} 2258}
2227 2259
2228void MainWindow::syncFileRequest() 2260void MainWindow::syncFileRequest()
2229{ 2261{
2230 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2262 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2231 mSyncManager->slotSyncMenu( 999 ); 2263 mSyncManager->slotSyncMenu( 999 );
2232 } 2264 }
2233 2265
2234 setCaption(i18n("Saving Data to temp file ..." )); 2266 setCaption(i18n("Saving Data to temp file ..." ));
2235 mView->saveCalendar( sentSyncFile() ); 2267 mView->saveCalendar( sentSyncFile() );
2236 setCaption(i18n("Data saved to temp file!" )); 2268 setCaption(i18n("Data saved to temp file!" ));
2237 2269
2238} 2270}
2239void MainWindow::getFile( bool success ) 2271void MainWindow::getFile( bool success )
2240{ 2272{
2241 if ( ! success ) { 2273 if ( ! success ) {
2242 setCaption( i18n("Error receiving file. Nothing changed!") ); 2274 setCaption( i18n("Error receiving file. Nothing changed!") );
2243 return; 2275 return;
2244 } 2276 }
2245 mView->openCalendar( sentSyncFile() ); 2277 mView->openCalendar( sentSyncFile() );
2246 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2278 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2247 mSyncManager->slotSyncMenu( 999 ); 2279 mSyncManager->slotSyncMenu( 999 );
2248 } 2280 }
2249 setCaption( i18n("Pi-Sync successful!") ); 2281 setCaption( i18n("Pi-Sync successful!") );
2250} 2282}
2251 2283
2252void MainWindow::printSel( ) 2284void MainWindow::printSel( )
2253{ 2285{
2254 mView->viewManager()->agendaView()->agenda()->printSelection(); 2286 mView->viewManager()->agendaView()->agenda()->printSelection();
2255} 2287}
2256 2288
2257void MainWindow::printCal() 2289void MainWindow::printCal()
2258{ 2290{
2259 mView->print();//mCp->showDialog(); 2291 mView->print();//mCp->showDialog();
2260} 2292}
2261 2293
2262 2294
2263#include "libkdepim/kdatepicker.h" 2295#include "libkdepim/kdatepicker.h"
2264#include <kdatetbl.h> 2296#include <kdatetbl.h>
2265void MainWindow::weekAction() 2297void MainWindow::weekAction()
2266{ 2298{
2267 int month; 2299 int month;
2268 KPopupFrame* popup = new KPopupFrame(this); 2300 KPopupFrame* popup = new KPopupFrame(this);
2269 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2301 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2270 // ----- 2302 // -----
2271 picker->resize(picker->sizeHint()); 2303 picker->resize(picker->sizeHint());
2272 popup->setMainWidget(picker); 2304 popup->setMainWidget(picker);
2273 picker->setFocus(); 2305 picker->setFocus();
2274 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2306 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2275 int x = 0; 2307 int x = 0;
2276 int y = iconToolBar->height(); 2308 int y = iconToolBar->height();
2277 int dX = 0; 2309 int dX = 0;
2278 int dY = 0; 2310 int dY = 0;
2279 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2311 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2280 if ( iconToolBar->y() > height()/2 ) { 2312 if ( iconToolBar->y() > height()/2 ) {
2281 dY = picker->sizeHint().height()+8; 2313 dY = picker->sizeHint().height()+8;
2282 y = 0; 2314 y = 0;
2283 } 2315 }
2284 } else { 2316 } else {
2285 if ( iconToolBar->x() > width()/2 ) { // right side 2317 if ( iconToolBar->x() > width()/2 ) { // right side
2286 x=0; 2318 x=0;
2287 dX= picker->sizeHint().width()+8; 2319 dX= picker->sizeHint().width()+8;
2288 y = 0; 2320 y = 0;
2289 } else { 2321 } else {
2290 x= iconToolBar->width(); 2322 x= iconToolBar->width();
2291 y = 0; 2323 y = 0;
2292 } 2324 }
2293 } 2325 }
2294 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2326 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2295 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2327 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2296 { 2328 {
2297 month = picker->getResult(); 2329 month = picker->getResult();
2298 emit selectWeek ( month ); 2330 emit selectWeek ( month );
2299 //qDebug("weekSelected %d ", month); 2331 //qDebug("weekSelected %d ", month);
2300 } 2332 }
2301 delete popup; 2333 delete popup;
2302} 2334}
2303 2335
2304void MainWindow::hideEvent ( QHideEvent * ) 2336void MainWindow::hideEvent ( QHideEvent * )
2305{ 2337{
2306 QString message; 2338 QString message;
2307 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2339 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2308 if ( nextA.isValid() ) { 2340 if ( nextA.isValid() ) {
2309 QString sum = mCalendar->nextSummary(); 2341 QString sum = mCalendar->nextSummary();
2310 2342
2311 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2343 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2312 setCaption( message ); 2344 setCaption( message );
2313 } 2345 }
2314} 2346}