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