summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp7
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index aa30b52..3bc6081 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1013 +1,1018 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qapp.h> 11#include <qapp.h>
12#include <qfileinfo.h> 12#include <qfileinfo.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qmap.h> 14#include <qmap.h>
15#include <qwmatrix.h> 15#include <qwmatrix.h>
16#include <qtextbrowser.h> 16#include <qtextbrowser.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#ifndef DESKTOP_VERSION 18#ifndef DESKTOP_VERSION
19#include <qpe/global.h> 19#include <qpe/global.h>
20#include <qpe/qpemenubar.h> 20#include <qpe/qpemenubar.h>
21#include <qpe/qpetoolbar.h> 21#include <qpe/qpetoolbar.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qtopia/alarmserver.h> 24#include <qtopia/alarmserver.h>
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#else 26#else
27#include <qmenubar.h> 27#include <qmenubar.h>
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qapplication.h> 29#include <qapplication.h>
30//#include <resource.h> 30//#include <resource.h>
31 31
32#endif 32#endif
33#include <libkcal/calendarlocal.h> 33#include <libkcal/calendarlocal.h>
34#include <libkcal/todo.h> 34#include <libkcal/todo.h>
35#include <libkdepim/ksyncprofile.h> 35#include <libkdepim/ksyncprofile.h>
36#include <libkdepim/kincidenceformatter.h> 36#include <libkdepim/kincidenceformatter.h>
37 37
38#include "calendarview.h" 38#include "calendarview.h"
39#include "koviewmanager.h" 39#include "koviewmanager.h"
40#include "datenavigator.h" 40#include "datenavigator.h"
41#include "koagendaview.h" 41#include "koagendaview.h"
42#include "koagenda.h" 42#include "koagenda.h"
43#include "kodialogmanager.h" 43#include "kodialogmanager.h"
44#include "kdialogbase.h" 44#include "kdialogbase.h"
45#include "kapplication.h" 45#include "kapplication.h"
46#include "kofilterview.h" 46#include "kofilterview.h"
47#include "kstandarddirs.h" 47#include "kstandarddirs.h"
48#include "koprefs.h" 48#include "koprefs.h"
49#include "kfiledialog.h" 49#include "kfiledialog.h"
50#include "koglobals.h" 50#include "koglobals.h"
51#include "kglobal.h" 51#include "kglobal.h"
52#include "klocale.h" 52#include "klocale.h"
53#include "kconfig.h" 53#include "kconfig.h"
54#include "simplealarmclient.h" 54#include "simplealarmclient.h"
55#include "externalapphandler.h" 55#include "externalapphandler.h"
56 56
57using namespace KCal; 57using namespace KCal;
58#ifndef _WIN32_ 58#ifndef _WIN32_
59#include <unistd.h> 59#include <unistd.h>
60#else 60#else
61#include "koimportoldialog.h" 61#include "koimportoldialog.h"
62#endif 62#endif
63#include "mainwindow.h" 63#include "mainwindow.h"
64 64
65int globalFlagBlockStartup; 65int globalFlagBlockStartup;
66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
67 QMainWindow( parent, name ) 67 QMainWindow( parent, name )
68{ 68{
69 69
70#ifdef DESKTOP_VERSION 70#ifdef DESKTOP_VERSION
71 setFont( QFont("Arial"), 14 ); 71 setFont( QFont("Arial"), 14 );
72#endif 72#endif
73 73
74 mClosed = false;
74 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 75 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
75 QString confFile = locateLocal("config","korganizerrc"); 76 QString confFile = locateLocal("config","korganizerrc");
76 QFileInfo finf ( confFile ); 77 QFileInfo finf ( confFile );
77 bool showWarning = !finf.exists(); 78 bool showWarning = !finf.exists();
78 setIcon(SmallIcon( "ko24" ) ); 79 setIcon(SmallIcon( "ko24" ) );
79 mBlockAtStartup = true; 80 mBlockAtStartup = true;
80 mFlagKeyPressed = false; 81 mFlagKeyPressed = false;
81 setCaption("KOrganizer/Pi"); 82 setCaption("KOrganizer/Pi");
82 KOPrefs *p = KOPrefs::instance(); 83 KOPrefs *p = KOPrefs::instance();
83 // if ( QApplication::desktop()->height() > 480 ) { 84 // if ( QApplication::desktop()->height() > 480 ) {
84// if ( p->mHourSize == 4 ) 85// if ( p->mHourSize == 4 )
85// p->mHourSize = 6; 86// p->mHourSize = 6;
86// } 87// }
87 if ( p->mHourSize > 18 ) 88 if ( p->mHourSize > 18 )
88 p->mHourSize = 18; 89 p->mHourSize = 18;
89 QMainWindow::ToolBarDock tbd; 90 QMainWindow::ToolBarDock tbd;
90 if ( p->mToolBarHor ) { 91 if ( p->mToolBarHor ) {
91 if ( p->mToolBarUp ) 92 if ( p->mToolBarUp )
92 tbd = Bottom; 93 tbd = Bottom;
93 else 94 else
94 tbd = Top; 95 tbd = Top;
95 } 96 }
96 else { 97 else {
97 if ( p->mToolBarUp ) 98 if ( p->mToolBarUp )
98 tbd = Right; 99 tbd = Right;
99 else 100 else
100 tbd = Left; 101 tbd = Left;
101 } 102 }
102 if ( KOPrefs::instance()->mUseAppColors ) 103 if ( KOPrefs::instance()->mUseAppColors )
103 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 104 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
104 globalFlagBlockStartup = 1; 105 globalFlagBlockStartup = 1;
105 iconToolBar = new QPEToolBar( this ); 106 iconToolBar = new QPEToolBar( this );
106 addToolBar (iconToolBar , tbd ); 107 addToolBar (iconToolBar , tbd );
107 mBlockSaveFlag = false; 108 mBlockSaveFlag = false;
108 mCalendarModifiedFlag = false; 109 mCalendarModifiedFlag = false;
109 110
110 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 111 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
111 splash->setAlignment ( AlignCenter ); 112 splash->setAlignment ( AlignCenter );
112 setCentralWidget( splash ); 113 setCentralWidget( splash );
113#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
114 showMaximized(); 115 showMaximized();
115#endif 116#endif
116 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 117 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
117 setDefaultPreferences(); 118 setDefaultPreferences();
118 mCalendar = new CalendarLocal(); 119 mCalendar = new CalendarLocal();
119 mView = new CalendarView( mCalendar, this,"mCalendar " ); 120 mView = new CalendarView( mCalendar, this,"mCalendar " );
120 mView->hide(); 121 mView->hide();
121 //mView->resize(splash->size() ); 122 //mView->resize(splash->size() );
122 initActions(); 123 initActions();
123#ifndef DESKTOP_VERSION 124#ifndef DESKTOP_VERSION
124 iconToolBar->show(); 125 iconToolBar->show();
125 qApp->processEvents(); 126 qApp->processEvents();
126#endif 127#endif
127 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 128 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
128 int vh = height() ; 129 int vh = height() ;
129 int vw = width(); 130 int vw = width();
130 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 131 //qDebug("Toolbar hei %d ",iconToolBar->height() );
131 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 132 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
132 vh -= iconToolBar->height(); 133 vh -= iconToolBar->height();
133 } else { 134 } else {
134 vw -= iconToolBar->height(); 135 vw -= iconToolBar->height();
135 } 136 }
136 //mView->setMaximumSize( splash->size() ); 137 //mView->setMaximumSize( splash->size() );
137 //mView->resize( splash->size() ); 138 //mView->resize( splash->size() );
138 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 139 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
139 mView->readSettings(); 140 mView->readSettings();
140 bool oldOpened = false; 141 bool oldOpened = false;
141 bool newFile = false; 142 bool newFile = false;
142 if( !QFile::exists( defaultFileName() ) ) { 143 if( !QFile::exists( defaultFileName() ) ) {
143 QFileInfo finfo ( defaultFileName() ); 144 QFileInfo finfo ( defaultFileName() );
144 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 145 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
145 qDebug("oldfile %s ", oldFile.latin1()); 146 qDebug("oldfile %s ", oldFile.latin1());
146 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"; 147 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
147 finfo.setFile( oldFile ); 148 finfo.setFile( oldFile );
148 if (finfo.exists() ) { 149 if (finfo.exists() ) {
149 KMessageBox::information( this, message); 150 KMessageBox::information( this, message);
150 mView->openCalendar( oldFile ); 151 mView->openCalendar( oldFile );
151 qApp->processEvents(); 152 qApp->processEvents();
152 } else { 153 } else {
153 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 154 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
154 finfo.setFile( oldFile ); 155 finfo.setFile( oldFile );
155 if (finfo.exists() ) { 156 if (finfo.exists() ) {
156 KMessageBox::information( this, message); 157 KMessageBox::information( this, message);
157 mView->openCalendar( oldFile ); 158 mView->openCalendar( oldFile );
158 qApp->processEvents(); 159 qApp->processEvents();
159 } 160 }
160 } 161 }
161 mView->saveCalendar( defaultFileName() ); 162 mView->saveCalendar( defaultFileName() );
162 newFile = true; 163 newFile = true;
163 } 164 }
164 165
165 QTime neededSaveTime = QDateTime::currentDateTime().time(); 166 QTime neededSaveTime = QDateTime::currentDateTime().time();
166 if ( ! oldOpened ) 167 if ( ! oldOpened )
167 mView->openCalendar( defaultFileName() ); 168 mView->openCalendar( defaultFileName() );
168 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 169 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
169 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 170 qDebug("KO: Calendar loading time: %d ms",msNeeded );
170 171
171 if ( KOPrefs::instance()->mLanguageChanged ) { 172 if ( KOPrefs::instance()->mLanguageChanged ) {
172 KOPrefs::instance()->setCategoryDefaults(); 173 KOPrefs::instance()->setCategoryDefaults();
173 int count = mView->addCategories(); 174 int count = mView->addCategories();
174 KOPrefs::instance()->mLanguageChanged = false; 175 KOPrefs::instance()->mLanguageChanged = false;
175 } 176 }
176 processIncidenceSelection( 0 ); 177 processIncidenceSelection( 0 );
177 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 178 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
178 SLOT( processIncidenceSelection( Incidence * ) ) ); 179 SLOT( processIncidenceSelection( Incidence * ) ) );
179 connect( mView, SIGNAL( modifiedChanged( bool ) ), 180 connect( mView, SIGNAL( modifiedChanged( bool ) ),
180 SLOT( slotModifiedChanged( bool ) ) ); 181 SLOT( slotModifiedChanged( bool ) ) );
181 182
182 183
183 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 184 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
184 mView->setModified( false ); 185 mView->setModified( false );
185 mBlockAtStartup = false; 186 mBlockAtStartup = false;
186 mView->setModified( false ); 187 mView->setModified( false );
187 setCentralWidget( mView ); 188 setCentralWidget( mView );
188 globalFlagBlockStartup = 0; 189 globalFlagBlockStartup = 0;
189 mView->show(); 190 mView->show();
190 delete splash; 191 delete splash;
191 if ( newFile ) 192 if ( newFile )
192 mView->updateConfig(); 193 mView->updateConfig();
193 // qApp->processEvents(); 194 // qApp->processEvents();
194 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 195 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
195 fillSyncMenu(); 196 fillSyncMenu();
196 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 197 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
197 if ( showWarning ) { 198 if ( showWarning ) {
198 KMessageBox::information( this, 199 KMessageBox::information( this,
199 "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"); 200 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
200 qApp->processEvents(); 201 qApp->processEvents();
201 mView->dialogManager()->showSyncOptions(); 202 mView->dialogManager()->showSyncOptions();
202 } 203 }
203 204
204 //US listen for result adressed from Ka/Pi 205 //US listen for result adressed from Ka/Pi
205#ifndef DESKTOP_VERSION 206#ifndef DESKTOP_VERSION
206 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 207 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
207#endif 208#endif
208} 209}
209MainWindow::~MainWindow() 210MainWindow::~MainWindow()
210{ 211{
211 //qDebug("MainWindow::~MainWindow() "); 212 //qDebug("MainWindow::~MainWindow() ");
212 //save toolbar location 213 //save toolbar location
213 214
214 delete mCalendar; 215 delete mCalendar;
215 delete KOPrefs::instance(); 216 delete KOPrefs::instance();
216 delete KIncidenceFormatter::instance(); 217 delete KIncidenceFormatter::instance();
217 218
218 219
219} 220}
220void MainWindow::showMaximized () 221void MainWindow::showMaximized ()
221{ 222{
222#ifndef DESKTOP_VERSION 223#ifndef DESKTOP_VERSION
223 if ( ! globalFlagBlockStartup ) 224 if ( ! globalFlagBlockStartup )
224 mView->goToday(); 225 if ( mClosed )
226 mView->goToday();
225#endif 227#endif
226 QWidget::showMaximized () ; 228 QWidget::showMaximized () ;
229 mClosed = false;
227} 230}
228void MainWindow::closeEvent( QCloseEvent* ce ) 231void MainWindow::closeEvent( QCloseEvent* ce )
229{ 232{
230 233
231 234
232 235
233 if ( ! KOPrefs::instance()->mAskForQuit ) { 236 if ( ! KOPrefs::instance()->mAskForQuit ) {
234 saveOnClose(); 237 saveOnClose();
238 mClosed = true;
235 ce->accept(); 239 ce->accept();
236 return; 240 return;
237 241
238 } 242 }
239 243
240 switch( QMessageBox::information( this, "KO/Pi", 244 switch( QMessageBox::information( this, "KO/Pi",
241 i18n("Do you really want\nto close KO/Pi?"), 245 i18n("Do you really want\nto close KO/Pi?"),
242 i18n("Close"), i18n("No"), 246 i18n("Close"), i18n("No"),
243 0, 0 ) ) { 247 0, 0 ) ) {
244 case 0: 248 case 0:
245 saveOnClose(); 249 saveOnClose();
250 mClosed = true;
246 ce->accept(); 251 ce->accept();
247 break; 252 break;
248 case 1: 253 case 1:
249 ce->ignore(); 254 ce->ignore();
250 break; 255 break;
251 case 2: 256 case 2:
252 257
253 default: 258 default:
254 break; 259 break;
255 } 260 }
256 261
257 262
258} 263}
259 264
260void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 265void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
261{ 266{
262 QDataStream stream( data, IO_ReadOnly ); 267 QDataStream stream( data, IO_ReadOnly );
263 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 268 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
264 //QString datamess; 269 //QString datamess;
265 //qDebug("message "); 270 //qDebug("message ");
266 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 271 qDebug("KO: QCOP message received: %s ", cmsg.data() );
267 272
268 if ( cmsg == "-writeFile" ) { 273 if ( cmsg == "-writeFile" ) {
269 // I made from the "-writeFile" an "-writeAlarm" 274 // I made from the "-writeFile" an "-writeAlarm"
270 mView->viewManager()->showWhatsNextView(); 275 mView->viewManager()->showWhatsNextView();
271 mCalendar->checkAlarmForIncidence( 0, true); 276 mCalendar->checkAlarmForIncidence( 0, true);
272 showMaximized(); 277 showMaximized();
273 raise(); 278 raise();
274 return; 279 return;
275 } 280 }
276 281
277 if ( cmsg == "-writeFile" ) { 282 if ( cmsg == "-writeFile" ) {
278 // I made from the "-writeFile" an "-writeAlarm" 283 // I made from the "-writeFile" an "-writeAlarm"
279 mView->viewManager()->showWhatsNextView(); 284 mView->viewManager()->showWhatsNextView();
280 mCalendar->checkAlarmForIncidence( 0, true); 285 mCalendar->checkAlarmForIncidence( 0, true);
281 showMaximized(); 286 showMaximized();
282 raise(); 287 raise();
283 return; 288 return;
284 289
285 } 290 }
286 if ( cmsg == "-writeFileSilent" ) { 291 if ( cmsg == "-writeFileSilent" ) {
287 // I made from the "-writeFile" an "-writeAlarm" 292 // I made from the "-writeFile" an "-writeAlarm"
288 // mView->viewManager()->showWhatsNextView(); 293 // mView->viewManager()->showWhatsNextView();
289 mCalendar->checkAlarmForIncidence( 0, true); 294 mCalendar->checkAlarmForIncidence( 0, true);
290 //showMaximized(); 295 //showMaximized();
291 //raise(); 296 //raise();
292 hide(); 297 hide();
293 return; 298 return;
294 } 299 }
295 if ( cmsg == "-newCountdown" ) { 300 if ( cmsg == "-newCountdown" ) {
296 qDebug("newCountdown "); 301 qDebug("newCountdown ");
297 302
298 } 303 }
299 QString msg ; 304 QString msg ;
300 QString allmsg = cmsg; 305 QString allmsg = cmsg;
301 while ( allmsg.length() > 0 ) { 306 while ( allmsg.length() > 0 ) {
302 int nextC = allmsg.find( "-", 1 ); 307 int nextC = allmsg.find( "-", 1 );
303 if ( nextC == -1 ) { 308 if ( nextC == -1 ) {
304 msg = allmsg; 309 msg = allmsg;
305 allmsg = ""; 310 allmsg = "";
306 } else{ 311 } else{
307 msg = allmsg.left( nextC ); 312 msg = allmsg.left( nextC );
308 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 313 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
309 } 314 }
310 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 315 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
311 if ( msg == "-newEvent" ) { 316 if ( msg == "-newEvent" ) {
312 mView->newEvent(); 317 mView->newEvent();
313 } 318 }
314 if ( msg == "-newTodo" ) { 319 if ( msg == "-newTodo" ) {
315 mView->newTodo(); 320 mView->newTodo();
316 321
317 } 322 }
318 if ( msg == "-showWN" ) { 323 if ( msg == "-showWN" ) {
319 mView->viewManager()->showWhatsNextView(); 324 mView->viewManager()->showWhatsNextView();
320 } 325 }
321 if ( msg == "-showTodo" ) { 326 if ( msg == "-showTodo" ) {
322 mView->viewManager()->showTodoView(); 327 mView->viewManager()->showTodoView();
323 } 328 }
324 if ( msg == "-showList" ) { 329 if ( msg == "-showList" ) {
325 mView->viewManager()->showListView(); 330 mView->viewManager()->showListView();
326 } 331 }
327 else if ( msg == "-showDay" ) { 332 else if ( msg == "-showDay" ) {
328 mView->viewManager()->showDayView(); 333 mView->viewManager()->showDayView();
329 } 334 }
330 else if ( msg == "-showWWeek" ) { 335 else if ( msg == "-showWWeek" ) {
331 mView->viewManager()->showWorkWeekView(); 336 mView->viewManager()->showWorkWeekView();
332 } 337 }
333 else if ( msg == "-ringSync" ) { 338 else if ( msg == "-ringSync" ) {
334 multiSync( false ); 339 multiSync( false );
335 } 340 }
336 else if ( msg == "-showWeek" ) { 341 else if ( msg == "-showWeek" ) {
337 mView->viewManager()->showWeekView(); 342 mView->viewManager()->showWeekView();
338 } 343 }
339 else if ( msg == "-showTodo" ) { 344 else if ( msg == "-showTodo" ) {
340 mView->viewManager()->showTodoView(); 345 mView->viewManager()->showTodoView();
341 } 346 }
342 else if ( msg == "-showJournal" ) { 347 else if ( msg == "-showJournal" ) {
343 mView->dateNavigator()->selectDates( 1 ); 348 mView->dateNavigator()->selectDates( 1 );
344 mView->dateNavigator()->selectToday(); 349 mView->dateNavigator()->selectToday();
345 mView->viewManager()->showJournalView(); 350 mView->viewManager()->showJournalView();
346 } 351 }
347 else if ( msg == "-showKO" ) { 352 else if ( msg == "-showKO" ) {
348 mView->viewManager()->showNextXView(); 353 mView->viewManager()->showNextXView();
349 } 354 }
350 else if ( msg == "-showWNext" || msg == "nextView()" ) { 355 else if ( msg == "-showWNext" || msg == "nextView()" ) {
351 mView->viewManager()->showWhatsNextView(); 356 mView->viewManager()->showWhatsNextView();
352 } 357 }
353 else if ( msg == "-showNextXView" ) { 358 else if ( msg == "-showNextXView" ) {
354 mView->viewManager()->showNextXView(); 359 mView->viewManager()->showNextXView();
355 } 360 }
356 361
357 362
358 } 363 }
359 364
360 showMaximized(); 365 showMaximized();
361 raise(); 366 raise();
362} 367}
363 368
364QPixmap MainWindow::loadPixmap( QString name ) 369QPixmap MainWindow::loadPixmap( QString name )
365{ 370{
366 return SmallIcon( name ); 371 return SmallIcon( name );
367 372
368} 373}
369void MainWindow::initActions() 374void MainWindow::initActions()
370{ 375{
371 //KOPrefs::instance()->mShowFullMenu 376 //KOPrefs::instance()->mShowFullMenu
372 iconToolBar->clear(); 377 iconToolBar->clear();
373 KOPrefs *p = KOPrefs::instance(); 378 KOPrefs *p = KOPrefs::instance();
374 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 379 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
375 380
376 QPopupMenu *viewMenu = new QPopupMenu( this ); 381 QPopupMenu *viewMenu = new QPopupMenu( this );
377 QPopupMenu *actionMenu = new QPopupMenu( this ); 382 QPopupMenu *actionMenu = new QPopupMenu( this );
378 QPopupMenu *importMenu = new QPopupMenu( this ); 383 QPopupMenu *importMenu = new QPopupMenu( this );
379 selectFilterMenu = new QPopupMenu( this ); 384 selectFilterMenu = new QPopupMenu( this );
380 selectFilterMenu->setCheckable( true ); 385 selectFilterMenu->setCheckable( true );
381 syncMenu = new QPopupMenu( this ); 386 syncMenu = new QPopupMenu( this );
382 configureAgendaMenu = new QPopupMenu( this ); 387 configureAgendaMenu = new QPopupMenu( this );
383 configureToolBarMenu = new QPopupMenu( this ); 388 configureToolBarMenu = new QPopupMenu( this );
384 QPopupMenu *helpMenu = new QPopupMenu( this ); 389 QPopupMenu *helpMenu = new QPopupMenu( this );
385 if ( KOPrefs::instance()->mShowFullMenu ) { 390 if ( KOPrefs::instance()->mShowFullMenu ) {
386 QMenuBar *menuBar1; 391 QMenuBar *menuBar1;
387 menuBar1 = menuBar(); 392 menuBar1 = menuBar();
388 menuBar1->insertItem( i18n("File"), importMenu ); 393 menuBar1->insertItem( i18n("File"), importMenu );
389 menuBar1->insertItem( i18n("View"), viewMenu ); 394 menuBar1->insertItem( i18n("View"), viewMenu );
390 menuBar1->insertItem( i18n("Actions"), actionMenu ); 395 menuBar1->insertItem( i18n("Actions"), actionMenu );
391 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 396 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
392 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 397 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
393 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 398 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
394 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 399 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
395 menuBar1->insertItem( i18n("Help"), helpMenu ); 400 menuBar1->insertItem( i18n("Help"), helpMenu );
396 } else { 401 } else {
397 QPEMenuBar *menuBar1; 402 QPEMenuBar *menuBar1;
398 menuBar1 = new QPEMenuBar( iconToolBar ); 403 menuBar1 = new QPEMenuBar( iconToolBar );
399 QPopupMenu *menuBar = new QPopupMenu( this ); 404 QPopupMenu *menuBar = new QPopupMenu( this );
400 menuBar1->insertItem( i18n("ME"), menuBar); 405 menuBar1->insertItem( i18n("ME"), menuBar);
401 menuBar->insertItem( i18n("File"), importMenu ); 406 menuBar->insertItem( i18n("File"), importMenu );
402 menuBar->insertItem( i18n("View"), viewMenu ); 407 menuBar->insertItem( i18n("View"), viewMenu );
403 menuBar->insertItem( i18n("Actions"), actionMenu ); 408 menuBar->insertItem( i18n("Actions"), actionMenu );
404 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 409 menuBar->insertItem( i18n("Synchronize"), syncMenu );
405 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 410 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
406 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 411 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
407 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 412 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
408 menuBar->insertItem( i18n("Help"), helpMenu ); 413 menuBar->insertItem( i18n("Help"), helpMenu );
409 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 414 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
410 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 415 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
411 } 416 }
412 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 417 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
413 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 418 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
414 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 419 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
415 420
416 // ****************** 421 // ******************
417 QAction *action; 422 QAction *action;
418 QIconSet icon; 423 QIconSet icon;
419 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 424 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
420 configureToolBarMenu->setCheckable( true ); 425 configureToolBarMenu->setCheckable( true );
421 426
422 QString pathString = ""; 427 QString pathString = "";
423 if ( !p->mToolBarMiniIcons ) { 428 if ( !p->mToolBarMiniIcons ) {
424 if ( QApplication::desktop()->width() < 480 ) 429 if ( QApplication::desktop()->width() < 480 )
425 pathString += "icons16/"; 430 pathString += "icons16/";
426 } else 431 } else
427 pathString += "iconsmini/"; 432 pathString += "iconsmini/";
428 configureAgendaMenu->setCheckable( true ); 433 configureAgendaMenu->setCheckable( true );
429 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 434 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
430 configureAgendaMenu->insertSeparator(); 435 configureAgendaMenu->insertSeparator();
431 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 436 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
432 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 437 configureAgendaMenu->insertItem(i18n("Small"), 6 );
433 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 438 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
434 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 439 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
435 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 440 configureAgendaMenu->insertItem(i18n("Large"), 12 );
436 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 441 configureAgendaMenu->insertItem(i18n("Big"), 14 );
437 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 442 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
438 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 443 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
439 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 444 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
440 445
441 icon = loadPixmap( pathString + "configure" ); 446 icon = loadPixmap( pathString + "configure" );
442 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 447 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
443 action->addTo( actionMenu ); 448 action->addTo( actionMenu );
444 connect( action, SIGNAL( activated() ), 449 connect( action, SIGNAL( activated() ),
445 mView, SLOT( edit_options() ) ); 450 mView, SLOT( edit_options() ) );
446 actionMenu->insertSeparator(); 451 actionMenu->insertSeparator();
447 icon = loadPixmap( pathString + "newevent" ); 452 icon = loadPixmap( pathString + "newevent" );
448 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 453 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
449 configureToolBarMenu->insertSeparator(); 454 configureToolBarMenu->insertSeparator();
450 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 455 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
451 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 456 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
452 ne_action->addTo( actionMenu ); 457 ne_action->addTo( actionMenu );
453 connect( ne_action, SIGNAL( activated() ), 458 connect( ne_action, SIGNAL( activated() ),
454 mView, SLOT( newEvent() ) ); 459 mView, SLOT( newEvent() ) );
455 icon = loadPixmap( pathString + "newtodo" ); 460 icon = loadPixmap( pathString + "newtodo" );
456 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 461 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
457 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 462 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
458 nt_action->addTo( actionMenu ); 463 nt_action->addTo( actionMenu );
459 connect( nt_action, SIGNAL( activated() ), 464 connect( nt_action, SIGNAL( activated() ),
460 mView, SLOT( newTodo() ) ); 465 mView, SLOT( newTodo() ) );
461 icon = loadPixmap( pathString + "navi" ); 466 icon = loadPixmap( pathString + "navi" );
462 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 467 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
463 action->addTo( viewMenu ); 468 action->addTo( viewMenu );
464 connect( action, SIGNAL( activated() ), 469 connect( action, SIGNAL( activated() ),
465 mView, SLOT( toggleDateNavigatorWidget() ) ); 470 mView, SLOT( toggleDateNavigatorWidget() ) );
466 icon = loadPixmap( pathString + "filter" ); 471 icon = loadPixmap( pathString + "filter" );
467 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 472 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
468 action->addTo( viewMenu ); 473 action->addTo( viewMenu );
469 connect( action, SIGNAL( activated() ), 474 connect( action, SIGNAL( activated() ),
470 mView, SLOT( toggleFilter() ) ); 475 mView, SLOT( toggleFilter() ) );
471 476
472 477
473 viewMenu->insertSeparator(); 478 viewMenu->insertSeparator();
474 icon = loadPixmap( pathString + "picker" ); 479 icon = loadPixmap( pathString + "picker" );
475 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 480 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
476 action->addTo( viewMenu ); 481 action->addTo( viewMenu );
477 connect( action, SIGNAL( activated() ), 482 connect( action, SIGNAL( activated() ),
478 mView, SLOT( showDatePicker() ) ); 483 mView, SLOT( showDatePicker() ) );
479 action->addTo( iconToolBar ); 484 action->addTo( iconToolBar );
480 viewMenu->insertSeparator(); 485 viewMenu->insertSeparator();
481 icon = loadPixmap( pathString + "list" ); 486 icon = loadPixmap( pathString + "list" );
482 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 487 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
483 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 488 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
484 showlist_action->addTo( viewMenu ); 489 showlist_action->addTo( viewMenu );
485 connect( showlist_action, SIGNAL( activated() ), 490 connect( showlist_action, SIGNAL( activated() ),
486 mView->viewManager(), SLOT( showListView() ) ); 491 mView->viewManager(), SLOT( showListView() ) );
487 492
488 493
489 icon = loadPixmap( pathString + "day" ); 494 icon = loadPixmap( pathString + "day" );
490 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 495 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
491 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 496 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
492 day1_action->addTo( viewMenu ); 497 day1_action->addTo( viewMenu );
493 // action->addTo( toolBar ); 498 // action->addTo( toolBar );
494 connect( day1_action, SIGNAL( activated() ), 499 connect( day1_action, SIGNAL( activated() ),
495 mView->viewManager(), SLOT( showDayView() ) ); 500 mView->viewManager(), SLOT( showDayView() ) );
496 501
497 icon = loadPixmap( pathString + "workweek" ); 502 icon = loadPixmap( pathString + "workweek" );
498 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 503 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
499 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 504 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
500 day5_action->addTo( viewMenu ); 505 day5_action->addTo( viewMenu );
501 connect( day5_action, SIGNAL( activated() ), 506 connect( day5_action, SIGNAL( activated() ),
502 mView->viewManager(), SLOT( showWorkWeekView() ) ); 507 mView->viewManager(), SLOT( showWorkWeekView() ) );
503 508
504 icon = loadPixmap( pathString + "week" ); 509 icon = loadPixmap( pathString + "week" );
505 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 510 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
506 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 511 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
507 day7_action->addTo( viewMenu ); 512 day7_action->addTo( viewMenu );
508 connect( day7_action, SIGNAL( activated() ), 513 connect( day7_action, SIGNAL( activated() ),
509 mView->viewManager(), SLOT( showWeekView() ) ); 514 mView->viewManager(), SLOT( showWeekView() ) );
510 515
511 icon = loadPixmap( pathString + "month" ); 516 icon = loadPixmap( pathString + "month" );
512 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 517 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
513 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 518 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
514 month_action->addTo( viewMenu ); 519 month_action->addTo( viewMenu );
515 connect( month_action, SIGNAL( activated() ), 520 connect( month_action, SIGNAL( activated() ),
516 mView->viewManager(), SLOT( showMonthView() ) ); 521 mView->viewManager(), SLOT( showMonthView() ) );
517 522
518 icon = loadPixmap( pathString + "todo" ); 523 icon = loadPixmap( pathString + "todo" );
519 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 524 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
520 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 525 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
521 todoview_action->addTo( viewMenu ); 526 todoview_action->addTo( viewMenu );
522 connect( todoview_action, SIGNAL( activated() ), 527 connect( todoview_action, SIGNAL( activated() ),
523 mView->viewManager(), SLOT( showTodoView() ) ); 528 mView->viewManager(), SLOT( showTodoView() ) );
524 529
525 icon = loadPixmap( pathString + "journal" ); 530 icon = loadPixmap( pathString + "journal" );
526 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 531 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
527 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 532 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
528 viewjournal_action->addTo( viewMenu ); 533 viewjournal_action->addTo( viewMenu );
529 connect( viewjournal_action, SIGNAL( activated() ), 534 connect( viewjournal_action, SIGNAL( activated() ),
530 mView->viewManager(), SLOT( showJournalView() ) ); 535 mView->viewManager(), SLOT( showJournalView() ) );
531 536
532 icon = loadPixmap( pathString + "xdays" ); 537 icon = loadPixmap( pathString + "xdays" );
533 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 538 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
534 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 539 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
535 xdays_action->addTo( viewMenu ); 540 xdays_action->addTo( viewMenu );
536 connect( xdays_action, SIGNAL( activated() ), 541 connect( xdays_action, SIGNAL( activated() ),
537 mView->viewManager(), SLOT( showNextXView() ) ); 542 mView->viewManager(), SLOT( showNextXView() ) );
538 543
539 icon = loadPixmap( pathString + "whatsnext" ); 544 icon = loadPixmap( pathString + "whatsnext" );
540 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 545 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
541 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 546 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
542 whatsnext_action->addTo( viewMenu ); 547 whatsnext_action->addTo( viewMenu );
543 connect( whatsnext_action, SIGNAL( activated() ), 548 connect( whatsnext_action, SIGNAL( activated() ),
544 mView->viewManager(), SLOT( showWhatsNextView() ) ); 549 mView->viewManager(), SLOT( showWhatsNextView() ) );
545 550
546#if 0 551#if 0
547 action = new QAction( "view_timespan", "Time Span", 0, this ); 552 action = new QAction( "view_timespan", "Time Span", 0, this );
548 action->addTo( viewMenu ); 553 action->addTo( viewMenu );
549 connect( action, SIGNAL( activated() ), 554 connect( action, SIGNAL( activated() ),
550 mView->viewManager(), SLOT( showTimeSpanView() ) ); 555 mView->viewManager(), SLOT( showTimeSpanView() ) );
551#endif 556#endif
552 557
553 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 558 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
554 this ); 559 this );
555 mNewSubTodoAction->addTo( actionMenu ); 560 mNewSubTodoAction->addTo( actionMenu );
556 connect( mNewSubTodoAction, SIGNAL( activated() ), 561 connect( mNewSubTodoAction, SIGNAL( activated() ),
557 mView, SLOT( newSubTodo() ) ); 562 mView, SLOT( newSubTodo() ) );
558 563
559 actionMenu->insertSeparator(); 564 actionMenu->insertSeparator();
560 565
561 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 566 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
562 mShowAction->addTo( actionMenu ); 567 mShowAction->addTo( actionMenu );
563 connect( mShowAction, SIGNAL( activated() ), 568 connect( mShowAction, SIGNAL( activated() ),
564 mView, SLOT( showIncidence() ) ); 569 mView, SLOT( showIncidence() ) );
565 570
566 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 571 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
567 mEditAction->addTo( actionMenu ); 572 mEditAction->addTo( actionMenu );
568 connect( mEditAction, SIGNAL( activated() ), 573 connect( mEditAction, SIGNAL( activated() ),
569 mView, SLOT( editIncidence() ) ); 574 mView, SLOT( editIncidence() ) );
570 575
571 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 576 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
572 mDeleteAction->addTo( actionMenu ); 577 mDeleteAction->addTo( actionMenu );
573 connect( mDeleteAction, SIGNAL( activated() ), 578 connect( mDeleteAction, SIGNAL( activated() ),
574 mView, SLOT( deleteIncidence() ) ); 579 mView, SLOT( deleteIncidence() ) );
575 580
576 actionMenu->insertSeparator(); 581 actionMenu->insertSeparator();
577 582
578 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 583 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
579 this ); 584 this );
580 action->addTo( actionMenu ); 585 action->addTo( actionMenu );
581 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 586 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
582 587
583 icon = loadPixmap( pathString + "search" ); 588 icon = loadPixmap( pathString + "search" );
584 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 589 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
585 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 590 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
586 search_action->addTo( actionMenu ); 591 search_action->addTo( actionMenu );
587 connect( search_action, SIGNAL( activated() ), 592 connect( search_action, SIGNAL( activated() ),
588 mView->dialogManager(), SLOT( showSearchDialog() ) ); 593 mView->dialogManager(), SLOT( showSearchDialog() ) );
589 594
590 icon = loadPixmap( pathString + "today" ); 595 icon = loadPixmap( pathString + "today" );
591 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 596 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
592 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 597 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
593 today_action->addTo( actionMenu ); 598 today_action->addTo( actionMenu );
594 connect( today_action, SIGNAL( activated() ), 599 connect( today_action, SIGNAL( activated() ),
595 mView, SLOT( goToday() ) ); 600 mView, SLOT( goToday() ) );
596 601
597 if ( KOPrefs::instance()->mShowFullMenu ) { 602 if ( KOPrefs::instance()->mShowFullMenu ) {
598 actionMenu->insertSeparator(); 603 actionMenu->insertSeparator();
599 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 604 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
600 605
601 } 606 }
602 // actionMenu->insertSeparator(); 607 // actionMenu->insertSeparator();
603 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 608 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
604 this ); 609 this );
605 action->addTo( importMenu ); 610 action->addTo( importMenu );
606 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 611 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
607 action = new QAction( "import_quick", i18n("Import last file"), 0, 612 action = new QAction( "import_quick", i18n("Import last file"), 0,
608 this ); 613 this );
609 action->addTo( importMenu ); 614 action->addTo( importMenu );
610 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 615 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
611 importMenu->insertSeparator(); 616 importMenu->insertSeparator();
612 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 617 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
613 this ); 618 this );
614 action->addTo( importMenu ); 619 action->addTo( importMenu );
615 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 620 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
616#ifndef DESKTOP_VERSION 621#ifndef DESKTOP_VERSION
617 importMenu->insertSeparator(); 622 importMenu->insertSeparator();
618 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 623 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
619 this ); 624 this );
620 action->addTo( importMenu ); 625 action->addTo( importMenu );
621 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 626 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
622#else 627#else
623#ifdef _WIN32_ 628#ifdef _WIN32_
624 importMenu->insertSeparator(); 629 importMenu->insertSeparator();
625 action = new QAction( "import_ol", i18n("Import from OL"), 0, 630 action = new QAction( "import_ol", i18n("Import from OL"), 0,
626 this ); 631 this );
627 action->addTo( importMenu ); 632 action->addTo( importMenu );
628 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 633 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
629#endif 634#endif
630#endif 635#endif
631 636
632 importMenu->insertSeparator(); 637 importMenu->insertSeparator();
633 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 638 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
634 this ); 639 this );
635 action->addTo( importMenu ); 640 action->addTo( importMenu );
636 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 641 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
637 642
638 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 643 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
639 this ); 644 this );
640 action->addTo( importMenu ); 645 action->addTo( importMenu );
641 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 646 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
642 647
643 importMenu->insertSeparator(); 648 importMenu->insertSeparator();
644 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 649 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
645 this ); 650 this );
646 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 651 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
647 importMenu->insertSeparator(); 652 importMenu->insertSeparator();
648 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 653 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
649 this ); 654 this );
650 action->addTo( importMenu ); 655 action->addTo( importMenu );
651 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 656 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
652#ifndef DESKTOP_VERSION 657#ifndef DESKTOP_VERSION
653 importMenu->insertSeparator(); 658 importMenu->insertSeparator();
654 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 659 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
655 this ); 660 this );
656 action->addTo( importMenu ); 661 action->addTo( importMenu );
657 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 662 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
658 663
659 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 664 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
660 this ); 665 this );
661 action->addTo( importMenu ); 666 action->addTo( importMenu );
662 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 667 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
663#else 668#else
664 importMenu->insertSeparator(); 669 importMenu->insertSeparator();
665 icon = loadPixmap( pathString + "print" ); 670 icon = loadPixmap( pathString + "print" );
666 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 671 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
667 action->addTo( importMenu ); 672 action->addTo( importMenu );
668 connect( action, SIGNAL( activated() ), 673 connect( action, SIGNAL( activated() ),
669 this, SLOT( printCal() ) ); 674 this, SLOT( printCal() ) );
670 675
671 icon = loadPixmap( pathString + "print" ); 676 icon = loadPixmap( pathString + "print" );
672 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 677 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
673 action->addTo( importMenu ); 678 action->addTo( importMenu );
674 connect( action, SIGNAL( activated() ), 679 connect( action, SIGNAL( activated() ),
675 this, SLOT( printSel() ) ); 680 this, SLOT( printSel() ) );
676#endif 681#endif
677 importMenu->insertSeparator(); 682 importMenu->insertSeparator();
678 action = new QAction( "beam all", i18n("Save"), 0, 683 action = new QAction( "beam all", i18n("Save"), 0,
679 this ); 684 this );
680 action->addTo( importMenu ); 685 action->addTo( importMenu );
681 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 686 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
682 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 687 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
683 this ); 688 this );
684 action->addTo( importMenu ); 689 action->addTo( importMenu );
685 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 690 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
686 691
687 //menuBar->insertItem( "Configure",configureMenu ); 692 //menuBar->insertItem( "Configure",configureMenu );
688 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 693 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
689 icon = loadPixmap( "korganizer/korganizer" ); 694 icon = loadPixmap( "korganizer/korganizer" );
690 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 695 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
691 action->addTo( helpMenu ); 696 action->addTo( helpMenu );
692 connect( action, SIGNAL( activated() ), 697 connect( action, SIGNAL( activated() ),
693 SLOT( keyBindings() ) ); 698 SLOT( keyBindings() ) );
694 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 699 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
695 action->addTo( helpMenu ); 700 action->addTo( helpMenu );
696 connect( action, SIGNAL( activated() ), 701 connect( action, SIGNAL( activated() ),
697 SLOT( features() ) ); 702 SLOT( features() ) );
698 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 703 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
699 action->addTo( helpMenu ); 704 action->addTo( helpMenu );
700 connect( action, SIGNAL( activated() ), 705 connect( action, SIGNAL( activated() ),
701 SLOT( aboutAutoSaving() ) ); 706 SLOT( aboutAutoSaving() ) );
702 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 707 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
703 action->addTo( helpMenu ); 708 action->addTo( helpMenu );
704 connect( action, SIGNAL( activated() ), 709 connect( action, SIGNAL( activated() ),
705 SLOT( aboutKnownBugs() ) ); 710 SLOT( aboutKnownBugs() ) );
706 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 711 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
707 action->addTo( helpMenu ); 712 action->addTo( helpMenu );
708 connect( action, SIGNAL( activated() ), 713 connect( action, SIGNAL( activated() ),
709 SLOT( usertrans() ) ); 714 SLOT( usertrans() ) );
710 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 715 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
711 action->addTo( helpMenu ); 716 action->addTo( helpMenu );
712 connect( action, SIGNAL( activated() ), 717 connect( action, SIGNAL( activated() ),
713 SLOT( synchowto() ) ); 718 SLOT( synchowto() ) );
714 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 719 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
715 action->addTo( helpMenu ); 720 action->addTo( helpMenu );
716 connect( action, SIGNAL( activated() ), 721 connect( action, SIGNAL( activated() ),
717 SLOT( whatsNew() ) ); 722 SLOT( whatsNew() ) );
718 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 723 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
719 action->addTo( helpMenu ); 724 action->addTo( helpMenu );
720 connect( action, SIGNAL( activated() ), 725 connect( action, SIGNAL( activated() ),
721 SLOT( faq() ) ); 726 SLOT( faq() ) );
722 727
723 728
724 action = new QAction( "about", i18n("About..."), 0, this ); 729 action = new QAction( "about", i18n("About..."), 0, this );
725 action->addTo( helpMenu ); 730 action->addTo( helpMenu );
726 connect( action, SIGNAL( activated() ), 731 connect( action, SIGNAL( activated() ),
727 SLOT( about() ) ); 732 SLOT( about() ) );
728 action = new QAction( "licence", i18n("Licence..."), 0, this ); 733 action = new QAction( "licence", i18n("Licence..."), 0, this );
729 action->addTo( helpMenu ); 734 action->addTo( helpMenu );
730 connect( action, SIGNAL( activated() ), 735 connect( action, SIGNAL( activated() ),
731 SLOT( licence() ) ); 736 SLOT( licence() ) );
732 //menuBar->insertSeparator(); 737 //menuBar->insertSeparator();
733 738
734 // ****************************************************** 739 // ******************************************************
735 // menubar icons 740 // menubar icons
736 741
737 742
738 iconToolBar->setHorizontalStretchable (true ); 743 iconToolBar->setHorizontalStretchable (true );
739 //menuBar->insertItem( iconToolBar ); 744 //menuBar->insertItem( iconToolBar );
740 //xdays_action 745 //xdays_action
741 if (p-> mShowIconNewEvent) 746 if (p-> mShowIconNewEvent)
742 ne_action->addTo( iconToolBar ); 747 ne_action->addTo( iconToolBar );
743 if (p->mShowIconNewTodo ) 748 if (p->mShowIconNewTodo )
744 nt_action->addTo( iconToolBar ); 749 nt_action->addTo( iconToolBar );
745 if (p-> mShowIconSearch) 750 if (p-> mShowIconSearch)
746 search_action->addTo( iconToolBar ); 751 search_action->addTo( iconToolBar );
747 if (p-> mShowIconNext) 752 if (p-> mShowIconNext)
748 whatsnext_action->addTo( iconToolBar ); 753 whatsnext_action->addTo( iconToolBar );
749 if (p-> mShowIconNextDays) 754 if (p-> mShowIconNextDays)
750 xdays_action->addTo( iconToolBar ); 755 xdays_action->addTo( iconToolBar );
751 if (p-> mShowIconList) 756 if (p-> mShowIconList)
752 showlist_action->addTo( iconToolBar ); 757 showlist_action->addTo( iconToolBar );
753 if (p-> mShowIconDay1) 758 if (p-> mShowIconDay1)
754 day1_action->addTo( iconToolBar ); 759 day1_action->addTo( iconToolBar );
755 if (p-> mShowIconDay5) 760 if (p-> mShowIconDay5)
756 day5_action->addTo( iconToolBar ); 761 day5_action->addTo( iconToolBar );
757 if (p-> mShowIconDay7) 762 if (p-> mShowIconDay7)
758 day7_action->addTo( iconToolBar ); 763 day7_action->addTo( iconToolBar );
759 if (p-> mShowIconMonth) 764 if (p-> mShowIconMonth)
760 month_action->addTo( iconToolBar ); 765 month_action->addTo( iconToolBar );
761 if (p-> mShowIconTodoview) 766 if (p-> mShowIconTodoview)
762 todoview_action->addTo( iconToolBar ); 767 todoview_action->addTo( iconToolBar );
763 if (p-> mShowIconJournal) 768 if (p-> mShowIconJournal)
764 viewjournal_action->addTo( iconToolBar ); 769 viewjournal_action->addTo( iconToolBar );
765 icon = loadPixmap( pathString + "2leftarrowB" ); 770 icon = loadPixmap( pathString + "2leftarrowB" );
766 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 771 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
767 if (p-> mShowIconBackFast) { 772 if (p-> mShowIconBackFast) {
768 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 773 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
769 connect( action, SIGNAL( activated() ), 774 connect( action, SIGNAL( activated() ),
770 mView, SLOT( goPreviousMonth() ) ); 775 mView, SLOT( goPreviousMonth() ) );
771 action->addTo( iconToolBar ); 776 action->addTo( iconToolBar );
772 } 777 }
773 icon = loadPixmap( pathString + "1leftarrowB" ); 778 icon = loadPixmap( pathString + "1leftarrowB" );
774 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 779 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
775 if (p-> mShowIconBack) { 780 if (p-> mShowIconBack) {
776 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 781 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
777 connect( action, SIGNAL( activated() ), 782 connect( action, SIGNAL( activated() ),
778 mView, SLOT( goPrevious() ) ); 783 mView, SLOT( goPrevious() ) );
779 action->addTo( iconToolBar ); 784 action->addTo( iconToolBar );
780 } 785 }
781 if (p-> mShowIconToday) 786 if (p-> mShowIconToday)
782 today_action->addTo( iconToolBar ); 787 today_action->addTo( iconToolBar );
783 icon = loadPixmap( pathString + "1rightarrowB" ); 788 icon = loadPixmap( pathString + "1rightarrowB" );
784 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 789 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
785 if (p-> mShowIconForward) { 790 if (p-> mShowIconForward) {
786 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 791 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
787 connect( action, SIGNAL( activated() ), 792 connect( action, SIGNAL( activated() ),
788 mView, SLOT( goNext() ) ); 793 mView, SLOT( goNext() ) );
789 action->addTo( iconToolBar ); 794 action->addTo( iconToolBar );
790 } 795 }
791 icon = loadPixmap( pathString + "2rightarrowB" ); 796 icon = loadPixmap( pathString + "2rightarrowB" );
792 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 797 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
793 if (p-> mShowIconForwardFast) { 798 if (p-> mShowIconForwardFast) {
794 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 799 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
795 connect( action, SIGNAL( activated() ), 800 connect( action, SIGNAL( activated() ),
796 mView, SLOT( goNextMonth() ) ); 801 mView, SLOT( goNextMonth() ) );
797 action->addTo( iconToolBar ); 802 action->addTo( iconToolBar );
798 } 803 }
799 804
800 805
801 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 806 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
802 807
803 if (p-> mShowIconNewEvent) 808 if (p-> mShowIconNewEvent)
804 configureToolBarMenu->setItemChecked( 10, true ); 809 configureToolBarMenu->setItemChecked( 10, true );
805 if (p->mShowIconNewTodo ) 810 if (p->mShowIconNewTodo )
806 configureToolBarMenu->setItemChecked( 20, true ); 811 configureToolBarMenu->setItemChecked( 20, true );
807 if (p-> mShowIconSearch) 812 if (p-> mShowIconSearch)
808 configureToolBarMenu->setItemChecked( 120, true ); 813 configureToolBarMenu->setItemChecked( 120, true );
809 if (p-> mShowIconList) 814 if (p-> mShowIconList)
810 configureToolBarMenu->setItemChecked( 30, true ); 815 configureToolBarMenu->setItemChecked( 30, true );
811 if (p-> mShowIconDay1) 816 if (p-> mShowIconDay1)
812 configureToolBarMenu->setItemChecked( 40, true ); 817 configureToolBarMenu->setItemChecked( 40, true );
813 if (p-> mShowIconDay5) 818 if (p-> mShowIconDay5)
814 configureToolBarMenu->setItemChecked( 50, true ); 819 configureToolBarMenu->setItemChecked( 50, true );
815 if (p-> mShowIconDay7) 820 if (p-> mShowIconDay7)
816 configureToolBarMenu->setItemChecked( 60, true ); 821 configureToolBarMenu->setItemChecked( 60, true );
817 if (p-> mShowIconMonth) 822 if (p-> mShowIconMonth)
818 configureToolBarMenu->setItemChecked( 70, true ); 823 configureToolBarMenu->setItemChecked( 70, true );
819 if (p-> mShowIconTodoview) 824 if (p-> mShowIconTodoview)
820 configureToolBarMenu->setItemChecked( 80, true ); 825 configureToolBarMenu->setItemChecked( 80, true );
821 if (p-> mShowIconBackFast) 826 if (p-> mShowIconBackFast)
822 configureToolBarMenu->setItemChecked( 200, true ); 827 configureToolBarMenu->setItemChecked( 200, true );
823 if (p-> mShowIconBack) 828 if (p-> mShowIconBack)
824 configureToolBarMenu->setItemChecked( 210, true ); 829 configureToolBarMenu->setItemChecked( 210, true );
825 if (p-> mShowIconToday) 830 if (p-> mShowIconToday)
826 configureToolBarMenu->setItemChecked( 130, true ); 831 configureToolBarMenu->setItemChecked( 130, true );
827 if (p-> mShowIconForward) 832 if (p-> mShowIconForward)
828 configureToolBarMenu->setItemChecked( 220, true ); 833 configureToolBarMenu->setItemChecked( 220, true );
829 if (p-> mShowIconForwardFast) 834 if (p-> mShowIconForwardFast)
830 configureToolBarMenu->setItemChecked( 230, true ); 835 configureToolBarMenu->setItemChecked( 230, true );
831 if (p-> mShowIconNextDays) 836 if (p-> mShowIconNextDays)
832 configureToolBarMenu->setItemChecked( 100, true ); 837 configureToolBarMenu->setItemChecked( 100, true );
833 if (p-> mShowIconNext) 838 if (p-> mShowIconNext)
834 configureToolBarMenu->setItemChecked( 110, true ); 839 configureToolBarMenu->setItemChecked( 110, true );
835 if (p-> mShowIconJournal) 840 if (p-> mShowIconJournal)
836 configureToolBarMenu->setItemChecked( 90, true ); 841 configureToolBarMenu->setItemChecked( 90, true );
837 if (p-> mShowIconWhatsThis) 842 if (p-> mShowIconWhatsThis)
838 configureToolBarMenu->setItemChecked( 300, true ); 843 configureToolBarMenu->setItemChecked( 300, true );
839 844
840 QLabel* dummy = new QLabel( iconToolBar ); 845 QLabel* dummy = new QLabel( iconToolBar );
841 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 846 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
842 if (!p-> mShowIconStretch) 847 if (!p-> mShowIconStretch)
843 iconToolBar->setStretchableWidget ( dummy ) ; 848 iconToolBar->setStretchableWidget ( dummy ) ;
844 else 849 else
845 configureToolBarMenu->setItemChecked( 5, true ); 850 configureToolBarMenu->setItemChecked( 5, true );
846 if (p-> mShowIconWhatsThis) 851 if (p-> mShowIconWhatsThis)
847 QWhatsThis::whatsThisButton ( iconToolBar ); 852 QWhatsThis::whatsThisButton ( iconToolBar );
848 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 853 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
849 configureAgenda( p->mHourSize ); 854 configureAgenda( p->mHourSize );
850 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 855 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
851} 856}
852void MainWindow::fillSyncMenu() 857void MainWindow::fillSyncMenu()
853{ 858{
854 if ( syncMenu->count() ) 859 if ( syncMenu->count() )
855 syncMenu->clear(); 860 syncMenu->clear();
856 syncMenu->insertItem( i18n("Configure..."), 0 ); 861 syncMenu->insertItem( i18n("Configure..."), 0 );
857 syncMenu->insertSeparator(); 862 syncMenu->insertSeparator();
858 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 863 syncMenu->insertItem( i18n("Multiple sync"), 1 );
859 syncMenu->insertSeparator(); 864 syncMenu->insertSeparator();
860 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 865 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
861 config.setGroup("General"); 866 config.setGroup("General");
862 QStringList prof = config.readListEntry("SyncProfileNames"); 867 QStringList prof = config.readListEntry("SyncProfileNames");
863 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 868 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
864 if ( prof.count() < 3 ) { 869 if ( prof.count() < 3 ) {
865 prof.clear(); 870 prof.clear();
866 prof << i18n("Sharp_DTM"); 871 prof << i18n("Sharp_DTM");
867 prof << i18n("Local_file"); 872 prof << i18n("Local_file");
868 prof << i18n("Last_file"); 873 prof << i18n("Last_file");
869 KSyncProfile* temp = new KSyncProfile (); 874 KSyncProfile* temp = new KSyncProfile ();
870 temp->setName( prof[0] ); 875 temp->setName( prof[0] );
871 temp->writeConfig(&config); 876 temp->writeConfig(&config);
872 temp->setName( prof[1] ); 877 temp->setName( prof[1] );
873 temp->writeConfig(&config); 878 temp->writeConfig(&config);
874 temp->setName( prof[2] ); 879 temp->setName( prof[2] );
875 temp->writeConfig(&config); 880 temp->writeConfig(&config);
876 config.setGroup("General"); 881 config.setGroup("General");
877 config.writeEntry("SyncProfileNames",prof); 882 config.writeEntry("SyncProfileNames",prof);
878 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 883 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
879 config.sync(); 884 config.sync();
880 delete temp; 885 delete temp;
881 } 886 }
882 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 887 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
883 KOPrefs::instance()->mSyncProfileNames = prof; 888 KOPrefs::instance()->mSyncProfileNames = prof;
884 int i; 889 int i;
885 for ( i = 0; i < prof.count(); ++i ) { 890 for ( i = 0; i < prof.count(); ++i ) {
886 891
887 syncMenu->insertItem( prof[i], 1000+i ); 892 syncMenu->insertItem( prof[i], 1000+i );
888 if ( i == 2 ) 893 if ( i == 2 )
889 syncMenu->insertSeparator(); 894 syncMenu->insertSeparator();
890 } 895 }
891 QDir app_dir; 896 QDir app_dir;
892 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 897 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
893 syncMenu->setItemEnabled( false , 1000 ); 898 syncMenu->setItemEnabled( false , 1000 );
894 } 899 }
895 mView->setupExternSyncProfiles(); 900 mView->setupExternSyncProfiles();
896} 901}
897 902
898int MainWindow::ringSync() 903int MainWindow::ringSync()
899{ 904{
900 int syncedProfiles = 0; 905 int syncedProfiles = 0;
901 int i; 906 int i;
902 QTime timer; 907 QTime timer;
903 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 908 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
904 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 909 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
905 KSyncProfile* temp = new KSyncProfile (); 910 KSyncProfile* temp = new KSyncProfile ();
906 KOPrefs::instance()->mAskForPreferences = false; 911 KOPrefs::instance()->mAskForPreferences = false;
907 for ( i = 0; i < syncProfileNames.count(); ++i ) { 912 for ( i = 0; i < syncProfileNames.count(); ++i ) {
908 mCurrentSyncProfile = i; 913 mCurrentSyncProfile = i;
909 temp->setName(syncProfileNames[mCurrentSyncProfile]); 914 temp->setName(syncProfileNames[mCurrentSyncProfile]);
910 temp->readConfig(&config); 915 temp->readConfig(&config);
911 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 916 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
912 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 917 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
913 ++syncedProfiles; 918 ++syncedProfiles;
914 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 919 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
915 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 920 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
916 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 921 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
917 KOPrefs::instance()->mWriteBackInFuture = 0; 922 KOPrefs::instance()->mWriteBackInFuture = 0;
918 if ( temp->getWriteBackFuture() ) 923 if ( temp->getWriteBackFuture() )
919 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 924 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
920 KOPrefs::instance()->mShowSyncSummary = false; 925 KOPrefs::instance()->mShowSyncSummary = false;
921 mView->setSyncDevice(syncProfileNames[i] ); 926 mView->setSyncDevice(syncProfileNames[i] );
922 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 927 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
923 if ( i == 0 ) { 928 if ( i == 0 ) {
924 syncSharp(); 929 syncSharp();
925 } else { 930 } else {
926 if ( temp->getIsLocalFileSync() ) { 931 if ( temp->getIsLocalFileSync() ) {
927 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 932 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
928 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 933 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
929 } else { 934 } else {
930 if ( temp->getIsPhoneSync() ) { 935 if ( temp->getIsPhoneSync() ) {
931 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 936 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
932 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 937 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
933 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 938 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
934 syncPhone(); 939 syncPhone();
935 } else 940 } else
936 syncRemote( temp, false ); 941 syncRemote( temp, false );
937 942
938 } 943 }
939 } 944 }
940 timer.start(); 945 timer.start();
941 setCaption(i18n("Multiple sync in progress ... please wait!") ); 946 setCaption(i18n("Multiple sync in progress ... please wait!") );
942 while ( timer.elapsed () < 2000 ) { 947 while ( timer.elapsed () < 2000 ) {
943 qApp->processEvents(); 948 qApp->processEvents();
944#ifndef _WIN32_ 949#ifndef _WIN32_
945 sleep (1); 950 sleep (1);
946#endif 951#endif
947 } 952 }
948 953
949 } 954 }
950 955
951 } 956 }
952 delete temp; 957 delete temp;
953 return syncedProfiles; 958 return syncedProfiles;
954} 959}
955 960
956void MainWindow::multiSync( bool askforPrefs ) 961void MainWindow::multiSync( bool askforPrefs )
957{ 962{
958 if (mBlockSaveFlag) 963 if (mBlockSaveFlag)
959 return; 964 return;
960 mBlockSaveFlag = true; 965 mBlockSaveFlag = true;
961 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 966 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
962 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 967 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
963 question, 968 question,
964 i18n("Yes"), i18n("No"), 969 i18n("Yes"), i18n("No"),
965 0, 0 ) != 0 ) { 970 0, 0 ) != 0 ) {
966 mBlockSaveFlag = false; 971 mBlockSaveFlag = false;
967 setCaption(i18n("Aborted! Nothing synced!")); 972 setCaption(i18n("Aborted! Nothing synced!"));
968 return; 973 return;
969 } 974 }
970 mView->setSyncDevice(i18n("Multiple profiles") ); 975 mView->setSyncDevice(i18n("Multiple profiles") );
971 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 976 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
972 if ( askforPrefs ) { 977 if ( askforPrefs ) {
973 mView->edit_sync_options(); 978 mView->edit_sync_options();
974 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 979 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
975 } 980 }
976 setCaption(i18n("Multiple sync started.") ); 981 setCaption(i18n("Multiple sync started.") );
977 qApp->processEvents(); 982 qApp->processEvents();
978 int num = ringSync() ; 983 int num = ringSync() ;
979 if ( num > 1 ) 984 if ( num > 1 )
980 ringSync(); 985 ringSync();
981 mBlockSaveFlag = false; 986 mBlockSaveFlag = false;
982 if ( num ) 987 if ( num )
983 save(); 988 save();
984 if ( num ) 989 if ( num )
985 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 990 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
986 else 991 else
987 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 992 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
988 return; 993 return;
989} 994}
990void MainWindow::slotSyncMenu( int action ) 995void MainWindow::slotSyncMenu( int action )
991{ 996{
992 //qDebug("syncaction %d ", action); 997 //qDebug("syncaction %d ", action);
993 if ( action == 0 ) { 998 if ( action == 0 ) {
994 999
995 // seems to be a Qt2 event handling bug 1000 // seems to be a Qt2 event handling bug
996 // syncmenu.clear causes a segfault at first time 1001 // syncmenu.clear causes a segfault at first time
997 // when we call it after the main event loop, it is ok 1002 // when we call it after the main event loop, it is ok
998 // same behaviour when calling OM/Pi via QCOP for the first time 1003 // same behaviour when calling OM/Pi via QCOP for the first time
999 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 1004 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
1000 //confSync(); 1005 //confSync();
1001 1006
1002 return; 1007 return;
1003 } 1008 }
1004 if ( action == 1 ) { 1009 if ( action == 1 ) {
1005 multiSync( true ); 1010 multiSync( true );
1006 return; 1011 return;
1007 } 1012 }
1008 1013
1009 if (mBlockSaveFlag) 1014 if (mBlockSaveFlag)
1010 return; 1015 return;
1011 mBlockSaveFlag = true; 1016 mBlockSaveFlag = true;
1012 mCurrentSyncProfile = action - 1000 ; 1017 mCurrentSyncProfile = action - 1000 ;
1013 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 1018 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 3e854cb..47a7a90 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,122 +1,123 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7 7
8#include <libkcal/incidence.h> 8#include <libkcal/incidence.h>
9#include "simplealarmclient.h" 9#include "simplealarmclient.h"
10 10
11class QAction; 11class QAction;
12class CalendarView; 12class CalendarView;
13class KSyncProfile; 13class KSyncProfile;
14#ifdef DESKTOP_VERSION 14#ifdef DESKTOP_VERSION
15 15
16#define QPEToolBar QToolBar 16#define QPEToolBar QToolBar
17#define QPEMenuBar QMenuBar 17#define QPEMenuBar QMenuBar
18#endif 18#endif
19class QPEToolBar; 19class QPEToolBar;
20 20
21namespace KCal { 21namespace KCal {
22class CalendarLocal; 22class CalendarLocal;
23} 23}
24 24
25using namespace KCal; 25using namespace KCal;
26 26
27class MainWindow : public QMainWindow 27class MainWindow : public QMainWindow
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 public: 30 public:
31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
32 ~MainWindow(); 32 ~MainWindow();
33 public slots: 33 public slots:
34 virtual void showMaximized (); 34 virtual void showMaximized ();
35 void configureAgenda( int ); 35 void configureAgenda( int );
36 void recieve( const QCString& msg, const QByteArray& data ); 36 void recieve( const QCString& msg, const QByteArray& data );
37 static QString defaultFileName(); 37 static QString defaultFileName();
38 static QString resourcePath(); 38 static QString resourcePath();
39 protected slots: 39 protected slots:
40 void setCaptionToDates(); 40 void setCaptionToDates();
41 int ringSync(); 41 int ringSync();
42 void multiSync( bool askforPrefs = false ); 42 void multiSync( bool askforPrefs = false );
43 void about(); 43 void about();
44 void licence(); 44 void licence();
45 void faq(); 45 void faq();
46 void usertrans(); 46 void usertrans();
47 void features(); 47 void features();
48 void synchowto(); 48 void synchowto();
49 void whatsNew(); 49 void whatsNew();
50 void keyBindings(); 50 void keyBindings();
51 void aboutAutoSaving();; 51 void aboutAutoSaving();;
52 void aboutKnownBugs(); 52 void aboutKnownBugs();
53 53
54 void processIncidenceSelection( Incidence * ); 54 void processIncidenceSelection( Incidence * );
55 55
56 void importQtopia(); 56 void importQtopia();
57 void importBday(); 57 void importBday();
58 void importOL(); 58 void importOL();
59 void importIcal(); 59 void importIcal();
60 void importFile( QString, bool ); 60 void importFile( QString, bool );
61 void quickImportIcal(); 61 void quickImportIcal();
62 62
63 void slotModifiedChanged( bool ); 63 void slotModifiedChanged( bool );
64 64
65 void save(); 65 void save();
66 void configureToolBar( int ); 66 void configureToolBar( int );
67 void printSel(); 67 void printSel();
68 void printCal(); 68 void printCal();
69 void saveCalendar(); 69 void saveCalendar();
70 void loadCalendar(); 70 void loadCalendar();
71 void exportVCalendar(); 71 void exportVCalendar();
72 void fillFilterMenu(); 72 void fillFilterMenu();
73 void selectFilter( int ); 73 void selectFilter( int );
74 74
75 void slotSyncMenu( int ); 75 void slotSyncMenu( int );
76 void syncSSH(); 76 void syncSSH();
77 void confSync(); 77 void confSync();
78 void syncSharp(); 78 void syncSharp();
79 void syncPhone(); 79 void syncPhone();
80 void syncLocalFile(); 80 void syncLocalFile();
81 bool syncWithFile( QString, bool ); 81 bool syncWithFile( QString, bool );
82 void quickSyncLocalFile(); 82 void quickSyncLocalFile();
83 83
84 84
85 protected: 85 protected:
86 void displayText( QString, QString); 86 void displayText( QString, QString);
87 void displayFile( QString, QString); 87 void displayFile( QString, QString);
88 88
89 void enableIncidenceActions( bool ); 89 void enableIncidenceActions( bool );
90 90
91 private: 91 private:
92 bool mClosed;
92 void saveOnClose(); 93 void saveOnClose();
93 int mCurrentSyncProfile; 94 int mCurrentSyncProfile;
94 void syncRemote( KSyncProfile* , bool ask = true); 95 void syncRemote( KSyncProfile* , bool ask = true);
95 void fillSyncMenu(); 96 void fillSyncMenu();
96 bool mFlagKeyPressed; 97 bool mFlagKeyPressed;
97 bool mBlockAtStartup; 98 bool mBlockAtStartup;
98 QPEToolBar *iconToolBar; 99 QPEToolBar *iconToolBar;
99 void initActions(); 100 void initActions();
100 void setDefaultPreferences(); 101 void setDefaultPreferences();
101 void keyPressEvent ( QKeyEvent * ) ; 102 void keyPressEvent ( QKeyEvent * ) ;
102 void keyReleaseEvent ( QKeyEvent * ) ; 103 void keyReleaseEvent ( QKeyEvent * ) ;
103 QPopupMenu *configureToolBarMenu; 104 QPopupMenu *configureToolBarMenu;
104 QPopupMenu *selectFilterMenu; 105 QPopupMenu *selectFilterMenu;
105 QPopupMenu *configureAgendaMenu, *syncMenu; 106 QPopupMenu *configureAgendaMenu, *syncMenu;
106 CalendarLocal *mCalendar; 107 CalendarLocal *mCalendar;
107 CalendarView *mView; 108 CalendarView *mView;
108 QString getPassword(); 109 QString getPassword();
109 QAction *mNewSubTodoAction; 110 QAction *mNewSubTodoAction;
110 111
111 QAction *mShowAction; 112 QAction *mShowAction;
112 QAction *mEditAction; 113 QAction *mEditAction;
113 QAction *mDeleteAction; 114 QAction *mDeleteAction;
114 void closeEvent( QCloseEvent* ce ); 115 void closeEvent( QCloseEvent* ce );
115 SimpleAlarmClient mAlarmClient; 116 SimpleAlarmClient mAlarmClient;
116 QTimer mSaveTimer; 117 QTimer mSaveTimer;
117 bool mBlockSaveFlag; 118 bool mBlockSaveFlag;
118 bool mCalendarModifiedFlag; 119 bool mCalendarModifiedFlag;
119 QPixmap loadPixmap( QString ); 120 QPixmap loadPixmap( QString );
120}; 121};
121 122
122#endif 123#endif