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