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