summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fb0b4ad..1776dcc 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1981 +1,1978 @@
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 setCentralWidget( mView ); 303 setCentralWidget( mView );
304 //mView->hide(); 304 //mView->hide();
305 //mView->resize(splash->size() ); 305 //mView->resize(splash->size() );
306 initActions(); 306 initActions();
307 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);
308 mSyncManager->setBlockSave(false); 308 mSyncManager->setBlockSave(false);
309 mView->setSyncManager(mSyncManager); 309 mView->setSyncManager(mSyncManager);
310#ifndef DESKTOP_VERSION 310#ifndef DESKTOP_VERSION
311 //iconToolBar->show(); 311 //iconToolBar->show();
312 //qApp->processEvents(); 312 //qApp->processEvents();
313#endif 313#endif
314 //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 ());
315 int vh = height() ; 315 int vh = height() ;
316 int vw = width(); 316 int vw = width();
317 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 317 //qDebug("Toolbar hei %d ",iconToolBar->height() );
318 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 318 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
319 vh -= iconToolBar->height(); 319 vh -= iconToolBar->height();
320 } else { 320 } else {
321 vw -= iconToolBar->height(); 321 vw -= iconToolBar->height();
322 } 322 }
323 //mView->setMaximumSize( splash->size() ); 323 //mView->setMaximumSize( splash->size() );
324 //mView->resize( splash->size() ); 324 //mView->resize( splash->size() );
325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
326 mView->readSettings(); 326 mView->readSettings();
327 bool newFile = false; 327 bool newFile = false;
328 if( !QFile::exists( defaultFileName() ) ) { 328 if( !QFile::exists( defaultFileName() ) ) {
329 QFileInfo finfo ( defaultFileName() ); 329 QFileInfo finfo ( defaultFileName() );
330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
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 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";
332 finfo.setFile( oldFile ); 332 finfo.setFile( oldFile );
333 if (finfo.exists() ) { 333 if (finfo.exists() ) {
334 KMessageBox::information( this, message); 334 KMessageBox::information( this, message);
335 mView->openCalendar( oldFile ); 335 mView->openCalendar( oldFile );
336 qApp->processEvents(); 336 qApp->processEvents();
337 } else { 337 } else {
338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
339 finfo.setFile( oldFile ); 339 finfo.setFile( oldFile );
340 if (finfo.exists() ) { 340 if (finfo.exists() ) {
341 KMessageBox::information( this, message); 341 KMessageBox::information( this, message);
342 mView->openCalendar( oldFile ); 342 mView->openCalendar( oldFile );
343 qApp->processEvents(); 343 qApp->processEvents();
344 } 344 }
345 } 345 }
346 mView->saveCalendar( defaultFileName() ); 346 mView->saveCalendar( defaultFileName() );
347 newFile = true; 347 newFile = true;
348 } 348 }
349 349
350 //QTime neededSaveTime = QDateTime::currentDateTime().time(); 350 //QTime neededSaveTime = QDateTime::currentDateTime().time();
351 //mView->loadCalendars(); 351 //mView->loadCalendars();
352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
353 //qDebug("KO: Calendar loading time: %d ms",msNeeded ); 353 //qDebug("KO: Calendar loading time: %d ms",msNeeded );
354 354
355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
356 KOPrefs::instance()->setAllDefaults(); 356 KOPrefs::instance()->setAllDefaults();
357 } 357 }
358 358
359 359
360 connect( mView, SIGNAL( tempDisableBR(bool) ), 360 connect( mView, SIGNAL( tempDisableBR(bool) ),
361 SLOT( disableBR(bool) ) ); 361 SLOT( disableBR(bool) ) );
362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
363 setCentralWidget( mView ); 363 setCentralWidget( mView );
364 globalFlagBlockStartup = 0; 364 globalFlagBlockStartup = 0;
365 //mView->show(); 365 //mView->show();
366 //delete splash; 366 //delete splash;
367 if ( newFile ) 367 if ( newFile )
368 mView->updateConfig(); 368 mView->updateConfig();
369 // qApp->processEvents(); 369 // qApp->processEvents();
370 //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 ());
371 //fillSyncMenu(); 371 //fillSyncMenu();
372 372
373 373
374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
378 mSyncManager->setDefaultFileName( sentSyncFile()); 378 mSyncManager->setDefaultFileName( sentSyncFile());
379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
380 mSyncManager->fillSyncMenu(); 380 mSyncManager->fillSyncMenu();
381 381
382 382
383 383
384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
385 if ( showWarning ) { 385 if ( showWarning ) {
386 KMessageBox::information( this, 386 KMessageBox::information( this,
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 "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");
388 //qApp->processEvents(); 388 //qApp->processEvents();
389 mView->dialogManager()->showSyncOptions(); 389 mView->dialogManager()->showSyncOptions();
390 } 390 }
391 391
392 //US listen for result adressed from Ka/Pi 392 //US listen for result adressed from Ka/Pi
393 393
394#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
395 infrared = 0; 395 infrared = 0;
396#endif 396#endif
397 updateFilterToolbar(); 397 updateFilterToolbar();
398 updateWeek( mView->startDate() ); 398 updateWeek( mView->startDate() );
399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
400 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 400 SLOT( updateWeekNum( const KCal::DateList & ) ) );
401 mBRdisabled = false; 401 mBRdisabled = false;
402 //toggleBeamReceive(); 402 //toggleBeamReceive();
403 403
404 setCaption(i18n("Loading calendar files ... please wait" )); 404 setCaption(i18n("Loading calendar files ... please wait" ));
405 mSaveDelay = 0; 405 mSaveDelay = 0;
406 QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); 406 QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() ));
407} 407}
408MainWindow::~MainWindow() 408MainWindow::~MainWindow()
409{ 409{
410 //qDebug("MainWindow::~MainWindow() "); 410 //qDebug("MainWindow::~MainWindow() ");
411 //save toolbar location 411 //save toolbar location
412 delete mCalendar; 412 delete mCalendar;
413 delete mSyncManager; 413 delete mSyncManager;
414#ifndef DESKTOP_VERSION 414#ifndef DESKTOP_VERSION
415 if ( infrared ) 415 if ( infrared )
416 delete infrared; 416 delete infrared;
417#endif 417#endif
418 418
419 419
420} 420}
421 421
422void MainWindow::loadDataAfterStart() 422void MainWindow::loadDataAfterStart()
423{ 423{
424
425 qDebug("KO: Start loading files..." ); 424 qDebug("KO: Start loading files..." );
426 QTime neededSaveTime = QDateTime::currentDateTime().time(); 425 QTime neededSaveTime = QDateTime::currentDateTime().time();
427 mView->loadCalendars(); 426 mView->loadCalendars();
428 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
429 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 428 qDebug("KO: Calendar loading time: %d ms",msNeeded );
430 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
431 mView->setModified( false ); 430 mView->setModified( false );
432 mBlockAtStartup = false; 431 mBlockAtStartup = false;
433 mView->setModified( false ); 432 mView->setModified( false );
434 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
435 processIncidenceSelection( 0 ); 434 processIncidenceSelection( 0 );
436 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
437 SLOT( processIncidenceSelection( Incidence * ) ) ); 436 SLOT( processIncidenceSelection( Incidence * ) ) );
438 connect( mView, SIGNAL( modifiedChanged( bool ) ), 437 connect( mView, SIGNAL( modifiedChanged( bool ) ),
439 SLOT( slotModifiedChanged( bool ) ) ); 438 SLOT( slotModifiedChanged( bool ) ) );
440
441#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
442 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 440 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
443 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); 441 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& )));
444 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); 442 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& )));
445 ((QPEApplication*) qApp)->showMainWidget( this );
446 if ( !mCStringMess.isEmpty() ) 443 if ( !mCStringMess.isEmpty() )
447 recieve( mCStringMess, mByteData ); 444 recieve( mCStringMess, mByteData );
448#endif 445#endif
449 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 446 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
450} 447}
451 448
452void MainWindow::slotResetFocus() 449void MainWindow::slotResetFocus()
453{ 450{
454 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 451 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
455 mFocusLoop = 3; 452 mFocusLoop = 3;
456 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 453 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
457} 454}
458void MainWindow::slotResetFocusLoop() 455void MainWindow::slotResetFocusLoop()
459{ 456{
460 --mFocusLoop; 457 --mFocusLoop;
461 QWidget* fw = mView->viewManager()->currentView(); 458 QWidget* fw = mView->viewManager()->currentView();
462 if ( fw ) { 459 if ( fw ) {
463 //qDebug("loop "); 460 //qDebug("loop ");
464 fw->setFocus(); 461 fw->setFocus();
465 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 462 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
466 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 463 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
467 } 464 }
468 465
469} 466}
470void MainWindow::disableBR(bool b) 467void MainWindow::disableBR(bool b)
471{ 468{
472#ifndef DESKTOP_VERSION 469#ifndef DESKTOP_VERSION
473 if ( b ) { 470 if ( b ) {
474 if ( infrared ) { 471 if ( infrared ) {
475 toggleBeamReceive(); 472 toggleBeamReceive();
476 mBRdisabled = true; 473 mBRdisabled = true;
477 } 474 }
478 mBRdisabled = true; 475 mBRdisabled = true;
479 } else { 476 } else {
480 if ( mBRdisabled ) { 477 if ( mBRdisabled ) {
481 mBRdisabled = false; 478 mBRdisabled = false;
482 //makes no sense,because other cal ap is probably running 479 //makes no sense,because other cal ap is probably running
483 // toggleBeamReceive(); 480 // toggleBeamReceive();
484 } 481 }
485 } 482 }
486#endif 483#endif
487 484
488} 485}
489bool MainWindow::beamReceiveEnabled() 486bool MainWindow::beamReceiveEnabled()
490{ 487{
491#ifndef DESKTOP_VERSION 488#ifndef DESKTOP_VERSION
492 return ( infrared != 0 ); 489 return ( infrared != 0 );
493#endif 490#endif
494 return false; 491 return false;
495} 492}
496 493
497void MainWindow::toggleBeamReceive() 494void MainWindow::toggleBeamReceive()
498{ 495{
499 if ( mBRdisabled ) 496 if ( mBRdisabled )
500 return; 497 return;
501#ifndef DESKTOP_VERSION 498#ifndef DESKTOP_VERSION
502 if ( infrared ) { 499 if ( infrared ) {
503 qDebug("KO: Disable BeamReceive "); 500 qDebug("KO: Disable BeamReceive ");
504 delete infrared; 501 delete infrared;
505 infrared = 0; 502 infrared = 0;
506 brAction->setOn(false); 503 brAction->setOn(false);
507 return; 504 return;
508 } 505 }
509 qDebug("KO: Enable BeamReceive "); 506 qDebug("KO: Enable BeamReceive ");
510 brAction->setOn(true); 507 brAction->setOn(true);
511 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 508 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
512 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 509 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
513#endif 510#endif
514} 511}
515void MainWindow::showMaximized () 512void MainWindow::showMaximized ()
516{ 513{
517#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
518 if ( ! globalFlagBlockStartup ) 515 if ( ! globalFlagBlockStartup )
519 if ( mClosed ) 516 if ( mClosed )
520 mView->goToday(); 517 mView->goToday();
521#endif 518#endif
522 QWidget::showMaximized () ; 519 QWidget::showMaximized () ;
523 mClosed = false; 520 mClosed = false;
524} 521}
525 522
526bool MainWindow::askForQuitOnSaveError() 523bool MainWindow::askForQuitOnSaveError()
527{ 524{
528 bool retval = false; 525 bool retval = false;
529 switch( QMessageBox::information( this, "KO/Pi", 526 switch( QMessageBox::information( this, "KO/Pi",
530 i18n("Error saving data") + "!\n" + 527 i18n("Error saving data") + "!\n" +
531 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + 528 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" +
532 i18n("Do you really want\nto close KO/Pi?"), 529 i18n("Do you really want\nto close KO/Pi?"),
533 i18n(" Yes, close "), i18n("No"), 530 i18n(" Yes, close "), i18n("No"),
534 0, 1 ) ) { 531 0, 1 ) ) {
535 case 0: 532 case 0:
536 retval = true; 533 retval = true;
537 break; 534 break;
538 default: 535 default:
539 break; 536 break;
540 } 537 }
541 return retval; 538 return retval;
542} 539}
543 540
544void MainWindow::closeEvent( QCloseEvent* ce ) 541void MainWindow::closeEvent( QCloseEvent* ce )
545{ 542{
546 543
547 544
548 545
549 if ( ! KOPrefs::instance()->mAskForQuit ) { 546 if ( ! KOPrefs::instance()->mAskForQuit ) {
550 saveOnClose(); 547 saveOnClose();
551 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
552 ce->ignore(); 549 ce->ignore();
553 return; 550 return;
554 } 551 }
555 mClosed = true; 552 mClosed = true;
556 ce->accept(); 553 ce->accept();
557 return; 554 return;
558 555
559 } 556 }
560 557
561 switch( QMessageBox::information( this, "KO/Pi", 558 switch( QMessageBox::information( this, "KO/Pi",
562 i18n("Do you really want\nto close KO/Pi?"), 559 i18n("Do you really want\nto close KO/Pi?"),
563 i18n("Close"), i18n("No"), 560 i18n("Close"), i18n("No"),
564 0, 0 ) ) { 561 0, 0 ) ) {
565 case 0: 562 case 0:
566 saveOnClose(); 563 saveOnClose();
567 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
568 ce->ignore(); 565 ce->ignore();
569 return; 566 return;
570 } 567 }
571 mClosed = true; 568 mClosed = true;
572 ce->accept(); 569 ce->accept();
573 break; 570 break;
574 case 1: 571 case 1:
575 ce->ignore(); 572 ce->ignore();
576 break; 573 break;
577 case 2: 574 case 2:
578 575
579 default: 576 default:
580 break; 577 break;
581 } 578 }
582 579
583 580
584} 581}
585void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
586{ 583{
587 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 584 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
588 mCStringMess = cmsg; 585 mCStringMess = cmsg;
589 mByteData = data; 586 mByteData = data;
590} 587}
591void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
592{ 589{
593 QDataStream stream( data, IO_ReadOnly ); 590 QDataStream stream( data, IO_ReadOnly );
594 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 591 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
595 //QString datamess; 592 //QString datamess;
596 //qDebug("message "); 593 //qDebug("message ");
597 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 594 qDebug("KO: QCOP message received: %s ", cmsg.data() );
598 595
599 if ( cmsg == "setDocument(QString)" ) { 596 if ( cmsg == "setDocument(QString)" ) {
600 QDataStream stream( data, IO_ReadOnly ); 597 QDataStream stream( data, IO_ReadOnly );
601 QString fileName; 598 QString fileName;
602 stream >> fileName; 599 stream >> fileName;
603 //qDebug("filename %s ", fileName.latin1()); 600 //qDebug("filename %s ", fileName.latin1());
604 showMaximized(); 601 showMaximized();
605 raise(); 602 raise();
606 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 603 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
607 mSyncManager->slotSyncMenu( 1002 ); 604 mSyncManager->slotSyncMenu( 1002 );
608 return; 605 return;
609 } 606 }
610 607
611 if ( cmsg == "-writeFile" ) { 608 if ( cmsg == "-writeFile" ) {
612 // I made from the "-writeFile" an "-writeAlarm" 609 // I made from the "-writeFile" an "-writeAlarm"
613 mView->viewManager()->showWhatsNextView(); 610 mView->viewManager()->showWhatsNextView();
614 mCalendar->checkAlarmForIncidence( 0, true); 611 mCalendar->checkAlarmForIncidence( 0, true);
615 showMaximized(); 612 showMaximized();
616 raise(); 613 raise();
617 return; 614 return;
618 615
619 } 616 }
620 if ( cmsg == "-writeFileSilent" ) { 617 if ( cmsg == "-writeFileSilent" ) {
621 // I made from the "-writeFile" an "-writeAlarm" 618 // I made from the "-writeFile" an "-writeAlarm"
622 // mView->viewManager()->showWhatsNextView(); 619 // mView->viewManager()->showWhatsNextView();
623 mCalendar->checkAlarmForIncidence( 0, true); 620 mCalendar->checkAlarmForIncidence( 0, true);
624 //showMaximized(); 621 //showMaximized();
625 //raise(); 622 //raise();
626 hide(); 623 hide();
627 return; 624 return;
628 } 625 }
629 if ( cmsg == "-newCountdown" ) { 626 if ( cmsg == "-newCountdown" ) {
630 qDebug("newCountdown "); 627 qDebug("newCountdown ");
631 628
632 } 629 }
633 QString msg ; 630 QString msg ;
634 QString allmsg = cmsg; 631 QString allmsg = cmsg;
635 while ( allmsg.length() > 0 ) { 632 while ( allmsg.length() > 0 ) {
636 int nextC = allmsg.find( "-", 1 ); 633 int nextC = allmsg.find( "-", 1 );
637 if ( nextC == -1 ) { 634 if ( nextC == -1 ) {
638 msg = allmsg; 635 msg = allmsg;
639 allmsg = ""; 636 allmsg = "";
640 } else{ 637 } else{
641 msg = allmsg.left( nextC ); 638 msg = allmsg.left( nextC );
642 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 639 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
643 } 640 }
644 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 641 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
645 if ( msg == "-newEvent" ) { 642 if ( msg == "-newEvent" ) {
646 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 643 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
647 } 644 }
648 if ( msg == "-newTodo" ) { 645 if ( msg == "-newTodo" ) {
649 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 646 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
650 } 647 }
651 if ( msg == "-showWN" ) { 648 if ( msg == "-showWN" ) {
652 mView->viewManager()->showWhatsNextView(); 649 mView->viewManager()->showWhatsNextView();
653 } 650 }
654 if ( msg == "-showTodo" ) { 651 if ( msg == "-showTodo" ) {
655 mView->viewManager()->showTodoView(); 652 mView->viewManager()->showTodoView();
656 } 653 }
657 if ( msg == "-showList" ) { 654 if ( msg == "-showList" ) {
658 mView->viewManager()->showListView(); 655 mView->viewManager()->showListView();
659 } 656 }
660 else if ( msg == "-showDay" ) { 657 else if ( msg == "-showDay" ) {
661 mView->viewManager()->showDayView(); 658 mView->viewManager()->showDayView();
662 } 659 }
663 else if ( msg == "-showWWeek" ) { 660 else if ( msg == "-showWWeek" ) {
664 mView->viewManager()->showWorkWeekView(); 661 mView->viewManager()->showWorkWeekView();
665 } 662 }
666 else if ( msg == "-ringSync" ) { 663 else if ( msg == "-ringSync" ) {
667 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 664 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
668 } 665 }
669 else if ( msg == "-showWeek" ) { 666 else if ( msg == "-showWeek" ) {
670 mView->viewManager()->showWeekView(); 667 mView->viewManager()->showWeekView();
671 } 668 }
672 else if ( msg == "-showTodo" ) { 669 else if ( msg == "-showTodo" ) {
673 mView->viewManager()->showTodoView(); 670 mView->viewManager()->showTodoView();
674 } 671 }
675 else if ( msg == "-showJournal" ) { 672 else if ( msg == "-showJournal" ) {
676 mView->dateNavigator()->selectDates( 1 ); 673 mView->dateNavigator()->selectDates( 1 );
677 mView->dateNavigator()->selectToday(); 674 mView->dateNavigator()->selectToday();
678 mView->viewManager()->showJournalView(); 675 mView->viewManager()->showJournalView();
679 } 676 }
680 else if ( msg == "-showKO" ) { 677 else if ( msg == "-showKO" ) {
681 mView->viewManager()->showNextXView(); 678 mView->viewManager()->showNextXView();
682 } 679 }
683 else if ( msg == "-showWNext" ) { 680 else if ( msg == "-showWNext" ) {
684 mView->viewManager()->showWhatsNextView(); 681 mView->viewManager()->showWhatsNextView();
685 } 682 }
686 else if ( msg == "nextView()" ) { 683 else if ( msg == "nextView()" ) {
687 mView->viewManager()->showNextView(); 684 mView->viewManager()->showNextView();
688 } 685 }
689 else if ( msg == "-showNextXView" ) { 686 else if ( msg == "-showNextXView" ) {
690 mView->viewManager()->showNextXView(); 687 mView->viewManager()->showNextXView();
691 } 688 }
692 689
693 690
694 } 691 }
695 692
696 showMaximized(); 693 showMaximized();
697 raise(); 694 raise();
698} 695}
699void MainWindow::startMultiSync() 696void MainWindow::startMultiSync()
700{ 697{
701 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 698 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
702 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 699 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
703 question, 700 question,
704 i18n("Yes"), i18n("No"), 701 i18n("Yes"), i18n("No"),
705 0, 0 ) != 0 ) { 702 0, 0 ) != 0 ) {
706 setCaption(i18n("Aborted! Nothing synced!")); 703 setCaption(i18n("Aborted! Nothing synced!"));
707 return; 704 return;
708 } 705 }
709 mSyncManager->multiSync( false ); 706 mSyncManager->multiSync( false );
710#ifndef DESKTOP_VERSION 707#ifndef DESKTOP_VERSION
711 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 708 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
712#endif 709#endif
713} 710}
714QPixmap MainWindow::loadPixmap( QString name ) 711QPixmap MainWindow::loadPixmap( QString name )
715{ 712{
716 return SmallIcon( name ); 713 return SmallIcon( name );
717 714
718} 715}
719void MainWindow::setUsesBigPixmaps ( bool b ) 716void MainWindow::setUsesBigPixmaps ( bool b )
720{ 717{
721 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 718 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
722 if ( b ) 719 if ( b )
723 qDebug("KO: BigPixmaps are not supported "); 720 qDebug("KO: BigPixmaps are not supported ");
724} 721}
725void MainWindow::initActions() 722void MainWindow::initActions()
726{ 723{
727 //KOPrefs::instance()->mShowFullMenu 724 //KOPrefs::instance()->mShowFullMenu
728 iconToolBar->clear(); 725 iconToolBar->clear();
729 KOPrefs *p = KOPrefs::instance(); 726 KOPrefs *p = KOPrefs::instance();
730 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 727 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
731 728
732 QPopupMenu *viewMenu = new QPopupMenu( this ); 729 QPopupMenu *viewMenu = new QPopupMenu( this );
733 QPopupMenu *actionMenu = new QPopupMenu( this ); 730 QPopupMenu *actionMenu = new QPopupMenu( this );
734 mCurrentItemMenu = new QPopupMenu ( this ); 731 mCurrentItemMenu = new QPopupMenu ( this );
735 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 732 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
736 QPopupMenu *importMenu = new QPopupMenu( this ); 733 QPopupMenu *importMenu = new QPopupMenu( this );
737 QPopupMenu *importMenu_X = new QPopupMenu( this ); 734 QPopupMenu *importMenu_X = new QPopupMenu( this );
738 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 735 QPopupMenu *exportMenu_X = new QPopupMenu( this );
739 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 736 QPopupMenu *beamMenu_X = new QPopupMenu( this );
740 selectFilterMenu = new QPopupMenu( this ); 737 selectFilterMenu = new QPopupMenu( this );
741 selectFilterMenu->setCheckable( true ); 738 selectFilterMenu->setCheckable( true );
742 syncMenu = new QPopupMenu( this ); 739 syncMenu = new QPopupMenu( this );
743 configureAgendaMenu = new QPopupMenu( this ); 740 configureAgendaMenu = new QPopupMenu( this );
744 configureToolBarMenu = new QPopupMenu( this ); 741 configureToolBarMenu = new QPopupMenu( this );
745 QPopupMenu *helpMenu = new QPopupMenu( this ); 742 QPopupMenu *helpMenu = new QPopupMenu( this );
746 QIconSet icon; 743 QIconSet icon;
747 int pixWid = 22, pixHei = 22; 744 int pixWid = 22, pixHei = 22;
748 QString pathString = ""; 745 QString pathString = "";
749 if ( !p->mToolBarMiniIcons ) { 746 if ( !p->mToolBarMiniIcons ) {
750 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 747 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
751 pathString += "icons16/"; 748 pathString += "icons16/";
752 pixWid = 18; pixHei = 16; 749 pixWid = 18; pixHei = 16;
753 } 750 }
754 } else { 751 } else {
755 pathString += "iconsmini/"; 752 pathString += "iconsmini/";
756 pixWid = 18; pixHei = 16; 753 pixWid = 18; pixHei = 16;
757 } 754 }
758 755
759 if ( KOPrefs::instance()->mShowFullMenu ) { 756 if ( KOPrefs::instance()->mShowFullMenu ) {
760 menuBar1 = new KMenuBar( this );//menuBar(); 757 menuBar1 = new KMenuBar( this );//menuBar();
761 //setMenuBar( menuBar1 ); 758 //setMenuBar( menuBar1 );
762 menuBar1->show(); 759 menuBar1->show();
763 menuBar1->insertItem( i18n("File"), importMenu ); 760 menuBar1->insertItem( i18n("File"), importMenu );
764 menuBar1->insertItem( i18n("View"), viewMenu ); 761 menuBar1->insertItem( i18n("View"), viewMenu );
765 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 762 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
766 menuBar1->insertItem( i18n("Action"), actionMenu ); 763 menuBar1->insertItem( i18n("Action"), actionMenu );
767#ifdef DESKTOP_VERSION 764#ifdef DESKTOP_VERSION
768 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 765 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
769 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 766 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
770#else 767#else
771 menuBar1->insertItem( i18n("Sync"), syncMenu ); 768 menuBar1->insertItem( i18n("Sync"), syncMenu );
772 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 769 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
773#endif 770#endif
774 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 771 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
775 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 772 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
776 menuBar1->insertItem( i18n("Help"), helpMenu ); 773 menuBar1->insertItem( i18n("Help"), helpMenu );
777 } else { 774 } else {
778 menuBar1 = new KMenuBar( iconToolBar ); 775 menuBar1 = new KMenuBar( iconToolBar );
779 QPopupMenu *menuBar = new QPopupMenu( this ); 776 QPopupMenu *menuBar = new QPopupMenu( this );
780 icon = loadPixmap( pathString + "z_menu" ); 777 icon = loadPixmap( pathString + "z_menu" );
781 menuBar1->insertItem( icon.pixmap(), menuBar); 778 menuBar1->insertItem( icon.pixmap(), menuBar);
782 //menuBar1->insertItem( i18n("ME"), menuBar); 779 //menuBar1->insertItem( i18n("ME"), menuBar);
783 menuBar->insertItem( i18n("File"), importMenu ); 780 menuBar->insertItem( i18n("File"), importMenu );
784 menuBar->insertItem( i18n("View"), viewMenu ); 781 menuBar->insertItem( i18n("View"), viewMenu );
785 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 782 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
786 menuBar->insertItem( i18n("Action"), actionMenu ); 783 menuBar->insertItem( i18n("Action"), actionMenu );
787 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 784 menuBar->insertItem( i18n("Synchronize"), syncMenu );
788 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 785 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
789 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 786 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
790 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 787 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
791 menuBar->insertItem( i18n("Help"), helpMenu ); 788 menuBar->insertItem( i18n("Help"), helpMenu );
792 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 789 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
793 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 790 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
794 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 791 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
795 } 792 }
796 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 793 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
797 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 794 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
798 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 795 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
799 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 796 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
800 797
801 798
802 mWeekBgColor = iconToolBar->backgroundColor(); 799 mWeekBgColor = iconToolBar->backgroundColor();
803 mWeekPixmap.resize( pixWid , pixHei ); 800 mWeekPixmap.resize( pixWid , pixHei );
804 mWeekPixmap.fill( mWeekBgColor ); 801 mWeekPixmap.fill( mWeekBgColor );
805 icon = mWeekPixmap; 802 icon = mWeekPixmap;
806 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 803 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
807 if ( p-> mShowIconWeekNum ) 804 if ( p-> mShowIconWeekNum )
808 mWeekAction->addTo( iconToolBar ); 805 mWeekAction->addTo( iconToolBar );
809 mWeekFont = font(); 806 mWeekFont = font();
810 807
811 int fontPoint = mWeekFont.pointSize(); 808 int fontPoint = mWeekFont.pointSize();
812 QFontMetrics f( mWeekFont ); 809 QFontMetrics f( mWeekFont );
813 int fontWid = f.width( "30" ); 810 int fontWid = f.width( "30" );
814 while ( fontWid > pixWid ) { 811 while ( fontWid > pixWid ) {
815 --fontPoint; 812 --fontPoint;
816 mWeekFont.setPointSize( fontPoint ); 813 mWeekFont.setPointSize( fontPoint );
817 QFontMetrics f( mWeekFont ); 814 QFontMetrics f( mWeekFont );
818 fontWid = f.width( "30" ); 815 fontWid = f.width( "30" );
819 //qDebug("dec-- "); 816 //qDebug("dec-- ");
820 } 817 }
821 818
822 connect( mWeekAction, SIGNAL( activated() ), 819 connect( mWeekAction, SIGNAL( activated() ),
823 this, SLOT( weekAction() ) ); 820 this, SLOT( weekAction() ) );
824 821
825 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 822 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
826 if ( p->mShowIconFilterview ) { 823 if ( p->mShowIconFilterview ) {
827 icon = loadPixmap( pathString + "filter" ); 824 icon = loadPixmap( pathString + "filter" );
828 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 825 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
829 connect( actionFilterMenuTB, SIGNAL( activated() ), 826 connect( actionFilterMenuTB, SIGNAL( activated() ),
830 this, SLOT( fillFilterMenuTB() ) ); 827 this, SLOT( fillFilterMenuTB() ) );
831 actionFilterMenuTB->addTo( iconToolBar ); 828 actionFilterMenuTB->addTo( iconToolBar );
832 selectFilterMenuTB = new QPopupMenu( this ); 829 selectFilterMenuTB = new QPopupMenu( this );
833 selectFilterMenuTB->setCheckable( true ); 830 selectFilterMenuTB->setCheckable( true );
834 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 831 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
835 } 832 }
836 833
837 //#endif 834 //#endif
838 // ****************** 835 // ******************
839 QAction *action; 836 QAction *action;
840 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 837 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
841 configureToolBarMenu->setCheckable( true ); 838 configureToolBarMenu->setCheckable( true );
842 839
843 840
844 configureAgendaMenu->setCheckable( true ); 841 configureAgendaMenu->setCheckable( true );
845 int iii ; 842 int iii ;
846 for ( iii = 1;iii<= 10 ;++iii ){ 843 for ( iii = 1;iii<= 10 ;++iii ){
847 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 844 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
848 } 845 }
849 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 846 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
850 847
851 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 848 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
852 this, SLOT( showConfigureAgenda( ) ) ); 849 this, SLOT( showConfigureAgenda( ) ) );
853 icon = loadPixmap( pathString + "today" ); 850 icon = loadPixmap( pathString + "today" );
854 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 851 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
855 today_action->addTo( actionMenu ); 852 today_action->addTo( actionMenu );
856 connect( today_action, SIGNAL( activated() ), 853 connect( today_action, SIGNAL( activated() ),
857 mView, SLOT( goToday() ) ); 854 mView, SLOT( goToday() ) );
858 855
859 icon = loadPixmap( pathString + "picker" ); 856 icon = loadPixmap( pathString + "picker" );
860 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 857 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
861 dPickerAction->addTo( actionMenu ); 858 dPickerAction->addTo( actionMenu );
862 connect( dPickerAction, SIGNAL( activated() ), 859 connect( dPickerAction, SIGNAL( activated() ),
863 mView, SLOT( showDatePicker() ) ); 860 mView, SLOT( showDatePicker() ) );
864 861
865 icon = loadPixmap( pathString + "search" ); 862 icon = loadPixmap( pathString + "search" );
866 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 863 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
867 search_action->addTo( actionMenu ); 864 search_action->addTo( actionMenu );
868 connect( search_action, SIGNAL( activated() ), 865 connect( search_action, SIGNAL( activated() ),
869 mView->dialogManager(), SLOT( showSearchDialog() ) ); 866 mView->dialogManager(), SLOT( showSearchDialog() ) );
870 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 867 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
871 868
872 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 869 action = new QAction( "Undo Delete", i18n("All events"), 0, this );
873 action->addTo( nextConflictMenu ); 870 action->addTo( nextConflictMenu );
874 connect( action, SIGNAL( activated() ), 871 connect( action, SIGNAL( activated() ),
875 mView, SLOT( conflictAll() ) ); 872 mView, SLOT( conflictAll() ) );
876 873
877 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 874 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
878 action->addTo( nextConflictMenu ); 875 action->addTo( nextConflictMenu );
879 connect( action, SIGNAL( activated() ), 876 connect( action, SIGNAL( activated() ),
880 mView, SLOT( conflictAllday() ) ); 877 mView, SLOT( conflictAllday() ) );
881 878
882 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 879 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
883 action->addTo( nextConflictMenu ); 880 action->addTo( nextConflictMenu );
884 connect( action, SIGNAL( activated() ), 881 connect( action, SIGNAL( activated() ),
885 mView, SLOT( conflictNotAll() ) ); 882 mView, SLOT( conflictNotAll() ) );
886 883
887 actionMenu->insertSeparator(); 884 actionMenu->insertSeparator();
888 885
889 icon = loadPixmap( pathString + "newevent" ); 886 icon = loadPixmap( pathString + "newevent" );
890 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 887 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
891 ne_action->addTo( mCurrentItemMenu ); 888 ne_action->addTo( mCurrentItemMenu );
892 connect( ne_action, SIGNAL( activated() ), 889 connect( ne_action, SIGNAL( activated() ),
893 mView, SLOT( newEvent() ) ); 890 mView, SLOT( newEvent() ) );
894 icon = loadPixmap( pathString + "newtodo" ); 891 icon = loadPixmap( pathString + "newtodo" );
895 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 892 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
896 nt_action->addTo( mCurrentItemMenu ); 893 nt_action->addTo( mCurrentItemMenu );
897 connect( nt_action, SIGNAL( activated() ), 894 connect( nt_action, SIGNAL( activated() ),
898 mView, SLOT( newTodo() ) ); 895 mView, SLOT( newTodo() ) );
899 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 896 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
900 this ); 897 this );
901 mNewSubTodoAction->addTo( mCurrentItemMenu ); 898 mNewSubTodoAction->addTo( mCurrentItemMenu );
902 connect( mNewSubTodoAction, SIGNAL( activated() ), 899 connect( mNewSubTodoAction, SIGNAL( activated() ),
903 mView, SLOT( newSubTodo() ) ); 900 mView, SLOT( newSubTodo() ) );
904 901
905 mCurrentItemMenu->insertSeparator(); 902 mCurrentItemMenu->insertSeparator();
906 icon = loadPixmap( pathString + "newevent" ); 903 icon = loadPixmap( pathString + "newevent" );
907 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 904 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
908 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 905 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
909 configureToolBarMenu->insertSeparator(); 906 configureToolBarMenu->insertSeparator();
910 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 907 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
911 configureToolBarMenu->insertSeparator(); 908 configureToolBarMenu->insertSeparator();
912 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 909 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
913 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 910 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
914 icon = loadPixmap( pathString + "newtodo" ); 911 icon = loadPixmap( pathString + "newtodo" );
915 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 912 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
916 913
917 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 914 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
918 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 915 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
919 mShowAction->addTo( mCurrentItemMenu ); 916 mShowAction->addTo( mCurrentItemMenu );
920 connect( mShowAction, SIGNAL( activated() ), 917 connect( mShowAction, SIGNAL( activated() ),
921 mView, SLOT( showIncidence() ) ); 918 mView, SLOT( showIncidence() ) );
922 919
923 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 920 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
924 mEditAction->addTo( mCurrentItemMenu ); 921 mEditAction->addTo( mCurrentItemMenu );
925 connect( mEditAction, SIGNAL( activated() ), 922 connect( mEditAction, SIGNAL( activated() ),
926 mView, SLOT( editIncidence() ) ); 923 mView, SLOT( editIncidence() ) );
927 924
928 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 925 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
929 mDeleteAction->addTo( mCurrentItemMenu ); 926 mDeleteAction->addTo( mCurrentItemMenu );
930 connect( mDeleteAction, SIGNAL( activated() ), 927 connect( mDeleteAction, SIGNAL( activated() ),
931 mView, SLOT( deleteIncidence() ) ); 928 mView, SLOT( deleteIncidence() ) );
932 929
933 930
934 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 931 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
935 mCloneAction->addTo( mCurrentItemMenu ); 932 mCloneAction->addTo( mCurrentItemMenu );
936 connect( mCloneAction, SIGNAL( activated() ), 933 connect( mCloneAction, SIGNAL( activated() ),
937 mView, SLOT( cloneIncidence() ) ); 934 mView, SLOT( cloneIncidence() ) );
938 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 935 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
939 mMoveAction->addTo( mCurrentItemMenu ); 936 mMoveAction->addTo( mCurrentItemMenu );
940 connect( mMoveAction, SIGNAL( activated() ), 937 connect( mMoveAction, SIGNAL( activated() ),
941 mView, SLOT( moveIncidence() ) ); 938 mView, SLOT( moveIncidence() ) );
942#ifndef DESKTOP_VERSION 939#ifndef DESKTOP_VERSION
943 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 940 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
944 mBeamAction->addTo(mCurrentItemMenu ); 941 mBeamAction->addTo(mCurrentItemMenu );
945 connect( mBeamAction, SIGNAL( activated() ), 942 connect( mBeamAction, SIGNAL( activated() ),
946 mView, SLOT( beamIncidence() ) ); 943 mView, SLOT( beamIncidence() ) );
947#endif 944#endif
948 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 945 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
949 mCancelAction->addTo( mCurrentItemMenu ); 946 mCancelAction->addTo( mCurrentItemMenu );
950 connect( mCancelAction, SIGNAL( activated() ), 947 connect( mCancelAction, SIGNAL( activated() ),
951 mView, SLOT( toggleCancelIncidence() ) ); 948 mView, SLOT( toggleCancelIncidence() ) );
952 949
953 950
954 mCurrentItemMenu->insertSeparator(); 951 mCurrentItemMenu->insertSeparator();
955 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 952 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
956 action->addTo( mCurrentItemMenu ); 953 action->addTo( mCurrentItemMenu );
957 connect( action, SIGNAL( activated() ), 954 connect( action, SIGNAL( activated() ),
958 mView, SLOT( undo_delete() ) ); 955 mView, SLOT( undo_delete() ) );
959 956
960 // *********************** 957 // ***********************
961 if ( KOPrefs::instance()->mVerticalScreen ) { 958 if ( KOPrefs::instance()->mVerticalScreen ) {
962 icon = SmallIcon( "1updownarrow" ); 959 icon = SmallIcon( "1updownarrow" );
963 } else { 960 } else {
964 icon = SmallIcon("1leftrightarrow" ); 961 icon = SmallIcon("1leftrightarrow" );
965 } 962 }
966 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 963 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
967 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 964 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
968 FSaction->addTo( viewMenu ); 965 FSaction->addTo( viewMenu );
969 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 966 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
970 967
971 968
972 icon = loadPixmap( pathString + "filter" ); 969 icon = loadPixmap( pathString + "filter" );
973 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 970 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
974 icon = loadPixmap( pathString + "configure" ); 971 icon = loadPixmap( pathString + "configure" );
975 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 972 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
976 action->addTo( viewMenu ); 973 action->addTo( viewMenu );
977 connect( action, SIGNAL( activated() ), 974 connect( action, SIGNAL( activated() ),
978 mView, SLOT( toggleFilter() ) ); 975 mView, SLOT( toggleFilter() ) );
979 mToggleFilter = action; 976 mToggleFilter = action;
980 icon = loadPixmap( pathString + "navi" ); 977 icon = loadPixmap( pathString + "navi" );
981 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 978 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
982 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 979 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
983 action->addTo( viewMenu ); 980 action->addTo( viewMenu );
984 connect( action, SIGNAL( activated() ), 981 connect( action, SIGNAL( activated() ),
985 mView, SLOT( toggleDateNavigatorWidget() ) ); 982 mView, SLOT( toggleDateNavigatorWidget() ) );
986 mToggleNav = action ; 983 mToggleNav = action ;
987 icon = loadPixmap( pathString + "allday" ); 984 icon = loadPixmap( pathString + "allday" );
988 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 985 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
989 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 986 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
990 action->addTo( viewMenu ); 987 action->addTo( viewMenu );
991 connect( action, SIGNAL( activated() ), 988 connect( action, SIGNAL( activated() ),
992 mView, SLOT( toggleAllDaySize() ) ); 989 mView, SLOT( toggleAllDaySize() ) );
993 mToggleAllday = action; 990 mToggleAllday = action;
994 991
995 992
996 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 993 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
997 mToggleNav, SLOT( setEnabled ( bool ) ) ); 994 mToggleNav, SLOT( setEnabled ( bool ) ) );
998 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 995 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
999 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 996 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
1000 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 997 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
1001 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 998 mToggleAllday, SLOT( setEnabled ( bool ) ) );
1002 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 999 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
1003 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 1000 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
1004 1001
1005 1002
1006 dPickerAction->addTo( iconToolBar ); 1003 dPickerAction->addTo( iconToolBar );
1007 viewMenu->insertSeparator(); 1004 viewMenu->insertSeparator();
1008 1005
1009 if ( p-> mShowIconToggleFull ) 1006 if ( p-> mShowIconToggleFull )
1010 FSaction->addTo( iconToolBar ); 1007 FSaction->addTo( iconToolBar );
1011 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 1008 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
1012 1009
1013 //******************** 1010 //********************
1014 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 1011 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
1015 1012
1016 1013
1017 icon = loadPixmap( pathString + "whatsnext" ); 1014 icon = loadPixmap( pathString + "whatsnext" );
1018 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 1015 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
1019 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 1016 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
1020 whatsnext_action->addTo( viewMenu ); 1017 whatsnext_action->addTo( viewMenu );
1021 connect( whatsnext_action, SIGNAL( activated() ), 1018 connect( whatsnext_action, SIGNAL( activated() ),
1022 mView->viewManager(), SLOT( showWhatsNextView() ) ); 1019 mView->viewManager(), SLOT( showWhatsNextView() ) );
1023 1020
1024 icon = loadPixmap( pathString + "xdays" ); 1021 icon = loadPixmap( pathString + "xdays" );
1025 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 1022 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
1026 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 1023 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
1027 xdays_action->addTo( viewMenu ); 1024 xdays_action->addTo( viewMenu );
1028 connect( xdays_action, SIGNAL( activated() ), 1025 connect( xdays_action, SIGNAL( activated() ),
1029 mView->viewManager(), SLOT( showNextXView() ) ); 1026 mView->viewManager(), SLOT( showNextXView() ) );
1030 1027
1031 1028
1032 icon = loadPixmap( pathString + "journal" ); 1029 icon = loadPixmap( pathString + "journal" );
1033 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 1030 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
1034 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 1031 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
1035 viewjournal_action->addTo( viewMenu ); 1032 viewjournal_action->addTo( viewMenu );
1036 connect( viewjournal_action, SIGNAL( activated() ), 1033 connect( viewjournal_action, SIGNAL( activated() ),
1037 mView->viewManager(), SLOT( showJournalView() ) ); 1034 mView->viewManager(), SLOT( showJournalView() ) );
1038 1035
1039 1036
1040 icon = loadPixmap( pathString + "day" ); 1037 icon = loadPixmap( pathString + "day" );
1041 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 1038 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
1042 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 1039 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
1043 day1_action->addTo( viewMenu ); 1040 day1_action->addTo( viewMenu );
1044 // action->addTo( toolBar ); 1041 // action->addTo( toolBar );
1045 connect( day1_action, SIGNAL( activated() ), 1042 connect( day1_action, SIGNAL( activated() ),
1046 mView->viewManager(), SLOT( showDayView() ) ); 1043 mView->viewManager(), SLOT( showDayView() ) );
1047 1044
1048 icon = loadPixmap( pathString + "workweek" ); 1045 icon = loadPixmap( pathString + "workweek" );
1049 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 1046 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
1050 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 1047 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
1051 day5_action->addTo( viewMenu ); 1048 day5_action->addTo( viewMenu );
1052 connect( day5_action, SIGNAL( activated() ), 1049 connect( day5_action, SIGNAL( activated() ),
1053 mView->viewManager(), SLOT( showWorkWeekView() ) ); 1050 mView->viewManager(), SLOT( showWorkWeekView() ) );
1054 1051
1055 icon = loadPixmap( pathString + "week" ); 1052 icon = loadPixmap( pathString + "week" );
1056 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 1053 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
1057 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 1054 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
1058 day7_action->addTo( viewMenu ); 1055 day7_action->addTo( viewMenu );
1059 connect( day7_action, SIGNAL( activated() ), 1056 connect( day7_action, SIGNAL( activated() ),
1060 mView->viewManager(), SLOT( showWeekView() ) ); 1057 mView->viewManager(), SLOT( showWeekView() ) );
1061 1058
1062 icon = loadPixmap( pathString + "workweek2" ); 1059 icon = loadPixmap( pathString + "workweek2" );
1063 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1060 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
1064 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1061 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
1065 day6_action->addTo( viewMenu ); 1062 day6_action->addTo( viewMenu );
1066 connect( day6_action, SIGNAL( activated() ), 1063 connect( day6_action, SIGNAL( activated() ),
1067 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1064 mView->viewManager(), SLOT( showMonthViewWeek() ) );
1068 1065
1069 icon = loadPixmap( pathString + "month" ); 1066 icon = loadPixmap( pathString + "month" );
1070 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1067 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
1071 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1068 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
1072 month_action->addTo( viewMenu ); 1069 month_action->addTo( viewMenu );
1073 connect( month_action, SIGNAL( activated() ), 1070 connect( month_action, SIGNAL( activated() ),
1074 mView->viewManager(), SLOT( showMonthView() ) ); 1071 mView->viewManager(), SLOT( showMonthView() ) );
1075 1072
1076 icon = loadPixmap( pathString + "list" ); 1073 icon = loadPixmap( pathString + "list" );
1077 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1074 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1078 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1075 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
1079 showlist_action->addTo( viewMenu ); 1076 showlist_action->addTo( viewMenu );
1080 connect( showlist_action, SIGNAL( activated() ), 1077 connect( showlist_action, SIGNAL( activated() ),
1081 mView->viewManager(), SLOT( showListView() ) ); 1078 mView->viewManager(), SLOT( showListView() ) );
1082 1079
1083 icon = loadPixmap( pathString + "todo" ); 1080 icon = loadPixmap( pathString + "todo" );
1084 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1081 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1085 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1082 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1086 todoview_action->addTo( viewMenu ); 1083 todoview_action->addTo( viewMenu );
1087 connect( todoview_action, SIGNAL( activated() ), 1084 connect( todoview_action, SIGNAL( activated() ),
1088 mView->viewManager(), SLOT( showTodoView() ) ); 1085 mView->viewManager(), SLOT( showTodoView() ) );
1089 1086
1090 1087
1091 1088
1092#if 0 1089#if 0
1093 action = new QAction( "view_timespan", "Time Span", 0, this ); 1090 action = new QAction( "view_timespan", "Time Span", 0, this );
1094 action->addTo( viewMenu ); 1091 action->addTo( viewMenu );
1095 connect( action, SIGNAL( activated() ), 1092 connect( action, SIGNAL( activated() ),
1096 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1093 mView->viewManager(), SLOT( showTimeSpanView() ) );
1097#endif 1094#endif
1098 1095
1099 1096
1100 1097
1101 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1098 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
1102 this ); 1099 this );
1103 action->addTo( actionMenu ); 1100 action->addTo( actionMenu );
1104 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1101 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1105 1102
1106 1103
1107 icon = loadPixmap( pathString + "search" ); 1104 icon = loadPixmap( pathString + "search" );
1108 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1105 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1109 1106
1110 1107
1111 1108
1112 actionMenu->insertSeparator(); 1109 actionMenu->insertSeparator();
1113 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1110 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1114 this ); 1111 this );
1115 action->addTo( actionMenu ); 1112 action->addTo( actionMenu );
1116 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1113 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1117 1114
1118 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1115 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1119 this ); 1116 this );
1120 action->addTo( actionMenu ); 1117 action->addTo( actionMenu );
1121 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1118 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1122 1119
1123 1120
1124 actionMenu->insertSeparator(); 1121 actionMenu->insertSeparator();
1125 icon = loadPixmap( pathString + "configure" ); 1122 icon = loadPixmap( pathString + "configure" );
1126 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1123 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1127 action->addTo( actionMenu ); 1124 action->addTo( actionMenu );
1128 connect( action, SIGNAL( activated() ), 1125 connect( action, SIGNAL( activated() ),
1129 mView, SLOT( edit_options() ) ); 1126 mView, SLOT( edit_options() ) );
1130 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1127 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1131 action->addTo( actionMenu ); 1128 action->addTo( actionMenu );
1132 connect( action, SIGNAL( activated() ), 1129 connect( action, SIGNAL( activated() ),
1133 this, SLOT( calHint() ) ); 1130 this, SLOT( calHint() ) );
1134 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1131 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1135 action->addTo( actionMenu ); 1132 action->addTo( actionMenu );
1136 connect( action, SIGNAL( activated() ), 1133 connect( action, SIGNAL( activated() ),
1137 mView, SLOT( edit_global_options() ) ); 1134 mView, SLOT( edit_global_options() ) );
1138 if ( KOPrefs::instance()->mShowFullMenu ) { 1135 if ( KOPrefs::instance()->mShowFullMenu ) {
1139 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1136 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1140 1137
1141 } 1138 }
1142 // actionMenu->insertSeparator(); 1139 // actionMenu->insertSeparator();
1143 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1140 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1144 this ); 1141 this );
1145 action->addTo( importMenu_X ); 1142 action->addTo( importMenu_X );
1146 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1143 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1147 action = new QAction( "import_quick", i18n("Import last file"), 0, 1144 action = new QAction( "import_quick", i18n("Import last file"), 0,
1148 this ); 1145 this );
1149 action->addTo( importMenu_X ); 1146 action->addTo( importMenu_X );
1150 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1147 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1151 importMenu_X->insertSeparator(); 1148 importMenu_X->insertSeparator();
1152 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1149 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1153 this ); 1150 this );
1154 action->addTo( importMenu_X ); 1151 action->addTo( importMenu_X );
1155 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1152 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1156 //#ifndef DESKTOP_VERSION 1153 //#ifndef DESKTOP_VERSION
1157 importMenu_X->insertSeparator(); 1154 importMenu_X->insertSeparator();
1158 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1155 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1159 this ); 1156 this );
1160 action->addTo( importMenu_X ); 1157 action->addTo( importMenu_X );
1161 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1158 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1162 //#else 1159 //#else
1163#ifdef _OL_IMPORT_ 1160#ifdef _OL_IMPORT_
1164 importMenu_X->insertSeparator(); 1161 importMenu_X->insertSeparator();
1165 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1162 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1166 this ); 1163 this );
1167 action->addTo( importMenu_X ); 1164 action->addTo( importMenu_X );
1168 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1165 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1169#endif 1166#endif
1170 //#endif 1167 //#endif
1171 1168
1172 //importMenu->insertSeparator(); 1169 //importMenu->insertSeparator();
1173#if 0 1170#if 0
1174 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1171 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1175 this ); 1172 this );
1176 action->addTo( importMenu ); 1173 action->addTo( importMenu );
1177 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1174 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1178#endif 1175#endif
1179 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1176 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1180 this ); 1177 this );
1181 action->addTo( importMenu ); 1178 action->addTo( importMenu );
1182 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1179 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1183 importMenu->insertSeparator(); 1180 importMenu->insertSeparator();
1184 importMenu->insertItem( i18n("Import"), importMenu_X ); 1181 importMenu->insertItem( i18n("Import"), importMenu_X );
1185 //importMenu->insertSeparator(); 1182 //importMenu->insertSeparator();
1186 action = new QAction( "export ical", i18n("Export All Data"), 0, 1183 action = new QAction( "export ical", i18n("Export All Data"), 0,
1187 this ); 1184 this );
1188 action->addTo( exportMenu_X ); 1185 action->addTo( exportMenu_X );
1189 connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); 1186 connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) );
1190 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1187 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1191 this ); 1188 this );
1192 action->addTo( exportMenu_X ); 1189 action->addTo( exportMenu_X );
1193 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1190 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1194 1191
1195 1192
1196 //LR 1193 //LR
1197 QPopupMenu *ex2phone = new QPopupMenu( this ); 1194 QPopupMenu *ex2phone = new QPopupMenu( this );
1198 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1195 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1199 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1196 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1200 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1197 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1201 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1198 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1202 1199
1203 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1200 importMenu->insertItem( i18n("Export"), exportMenu_X );
1204 mPrintSelAction = 0; 1201 mPrintSelAction = 0;
1205#ifndef DESKTOP_VERSION 1202#ifndef DESKTOP_VERSION
1206 //importMenu->insertSeparator(); 1203 //importMenu->insertSeparator();
1207 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1204 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1208 this ); 1205 this );
1209 brAction->addTo( beamMenu_X ); 1206 brAction->addTo( beamMenu_X );
1210 brAction->setToggleAction (true ) ; 1207 brAction->setToggleAction (true ) ;
1211 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1208 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1212 1209
1213 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1210 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1214 this ); 1211 this );
1215 action->addTo( beamMenu_X ); 1212 action->addTo( beamMenu_X );
1216 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1213 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1217 1214
1218 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1215 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1219 this ); 1216 this );
1220 action->addTo( beamMenu_X ); 1217 action->addTo( beamMenu_X );
1221 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1218 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1222 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1219 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1223#else 1220#else
1224 //importMenu->insertSeparator(); 1221 //importMenu->insertSeparator();
1225 icon = loadPixmap( pathString + "print" ); 1222 icon = loadPixmap( pathString + "print" );
1226 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1223 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1227 action->addTo( beamMenu_X ); 1224 action->addTo( beamMenu_X );
1228 connect( action, SIGNAL( activated() ), 1225 connect( action, SIGNAL( activated() ),
1229 this, SLOT( printCal() ) ); 1226 this, SLOT( printCal() ) );
1230 1227
1231 icon = loadPixmap( pathString + "week" ); 1228 icon = loadPixmap( pathString + "week" );
1232 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1229 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1233 action->addTo( beamMenu_X ); 1230 action->addTo( beamMenu_X );
1234 connect( action, SIGNAL( activated() ), 1231 connect( action, SIGNAL( activated() ),
1235 this, SLOT( printSel() ) ); 1232 this, SLOT( printSel() ) );
1236 icon = loadPixmap( pathString + "whatsnext" ); 1233 icon = loadPixmap( pathString + "whatsnext" );
1237 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1234 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1238 action->addTo( beamMenu_X ); 1235 action->addTo( beamMenu_X );
1239 connect( action, SIGNAL( activated() ), 1236 connect( action, SIGNAL( activated() ),
1240 mView->viewManager(), SLOT( slotprintWNV() ) ); 1237 mView->viewManager(), SLOT( slotprintWNV() ) );
1241 1238
1242 1239
1243 icon = loadPixmap( pathString + "list" ); 1240 icon = loadPixmap( pathString + "list" );
1244 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1241 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1245 action->addTo( beamMenu_X ); 1242 action->addTo( beamMenu_X );
1246 connect( action, SIGNAL( activated() ), 1243 connect( action, SIGNAL( activated() ),
1247 this, SLOT( printListView() ) ); 1244 this, SLOT( printListView() ) );
1248 1245
1249 icon = loadPixmap( pathString + "newevent" ); 1246 icon = loadPixmap( pathString + "newevent" );
1250 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1247 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1251 action->addTo( beamMenu_X ); 1248 action->addTo( beamMenu_X );
1252 connect( action, SIGNAL( activated() ), 1249 connect( action, SIGNAL( activated() ),
1253 mView, SLOT( slotprintSelInc() ) ); 1250 mView, SLOT( slotprintSelInc() ) );
1254 mPrintSelAction = action; 1251 mPrintSelAction = action;
1255 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1252 importMenu->insertItem( i18n("Print"), beamMenu_X );
1256#endif 1253#endif
1257 1254
1258 importMenu->insertSeparator(); 1255 importMenu->insertSeparator();
1259 action = new QAction( "beam all", i18n("Save"), 0, 1256 action = new QAction( "beam all", i18n("Save"), 0,
1260 this ); 1257 this );
1261 action->addTo( importMenu ); 1258 action->addTo( importMenu );
1262 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1259 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1263 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1260 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1264 this ); 1261 this );
1265 action->addTo( importMenu ); 1262 action->addTo( importMenu );
1266 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1263 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1267 1264
1268 //menuBar->insertItem( "Configure",configureMenu ); 1265 //menuBar->insertItem( "Configure",configureMenu );
1269 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1266 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1270 icon = loadPixmap( "korganizer/korganizer" ); 1267 icon = loadPixmap( "korganizer/korganizer" );
1271 1268
1272 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1269 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1273 action->addTo( helpMenu ); 1270 action->addTo( helpMenu );
1274 connect( action, SIGNAL( activated() ), 1271 connect( action, SIGNAL( activated() ),
1275 SLOT( whatsNew() ) ); 1272 SLOT( whatsNew() ) );
1276 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1273 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1277 action->addTo( helpMenu ); 1274 action->addTo( helpMenu );
1278 connect( action, SIGNAL( activated() ), 1275 connect( action, SIGNAL( activated() ),
1279 SLOT( features() ) ); 1276 SLOT( features() ) );
1280 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1277 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1281 action->addTo( helpMenu ); 1278 action->addTo( helpMenu );
1282 connect( action, SIGNAL( activated() ), 1279 connect( action, SIGNAL( activated() ),
1283 SLOT( keyBindings() ) ); 1280 SLOT( keyBindings() ) );
1284 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1281 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1285 action->addTo( helpMenu ); 1282 action->addTo( helpMenu );
1286 connect( action, SIGNAL( activated() ), 1283 connect( action, SIGNAL( activated() ),
1287 SLOT( storagehowto() ) ); 1284 SLOT( storagehowto() ) );
1288 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1285 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1289 action->addTo( helpMenu ); 1286 action->addTo( helpMenu );
1290 connect( action, SIGNAL( activated() ), 1287 connect( action, SIGNAL( activated() ),
1291 SLOT( timetrackinghowto() ) ); 1288 SLOT( timetrackinghowto() ) );
1292 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1289 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1293 action->addTo( helpMenu ); 1290 action->addTo( helpMenu );
1294 connect( action, SIGNAL( activated() ), 1291 connect( action, SIGNAL( activated() ),
1295 SLOT( synchowto() ) ); 1292 SLOT( synchowto() ) );
1296 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1293 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1297 action->addTo( helpMenu ); 1294 action->addTo( helpMenu );
1298 connect( action, SIGNAL( activated() ), 1295 connect( action, SIGNAL( activated() ),
1299 SLOT( kdesynchowto() ) ); 1296 SLOT( kdesynchowto() ) );
1300 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1297 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1301 action->addTo( helpMenu ); 1298 action->addTo( helpMenu );
1302 connect( action, SIGNAL( activated() ), 1299 connect( action, SIGNAL( activated() ),
1303 SLOT( multisynchowto() ) ); 1300 SLOT( multisynchowto() ) );
1304 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1301 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1305 action->addTo( helpMenu ); 1302 action->addTo( helpMenu );
1306 connect( action, SIGNAL( activated() ), 1303 connect( action, SIGNAL( activated() ),
1307 SLOT( aboutAutoSaving() ) ); 1304 SLOT( aboutAutoSaving() ) );
1308 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1305 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1309 action->addTo( helpMenu ); 1306 action->addTo( helpMenu );
1310 connect( action, SIGNAL( activated() ), 1307 connect( action, SIGNAL( activated() ),
1311 SLOT( aboutKnownBugs() ) ); 1308 SLOT( aboutKnownBugs() ) );
1312 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1309 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1313 action->addTo( helpMenu ); 1310 action->addTo( helpMenu );
1314 connect( action, SIGNAL( activated() ), 1311 connect( action, SIGNAL( activated() ),
1315 SLOT( usertrans() ) ); 1312 SLOT( usertrans() ) );
1316 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1313 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1317 action->addTo( helpMenu ); 1314 action->addTo( helpMenu );
1318 connect( action, SIGNAL( activated() ), 1315 connect( action, SIGNAL( activated() ),
1319 SLOT( faq() ) ); 1316 SLOT( faq() ) );
1320 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1317 action = new QAction( "licence", i18n("Licence..."), 0, this );
1321 action->addTo( helpMenu ); 1318 action->addTo( helpMenu );
1322 connect( action, SIGNAL( activated() ), 1319 connect( action, SIGNAL( activated() ),
1323 SLOT( licence() ) ); 1320 SLOT( licence() ) );
1324 action = new QAction( "about", i18n("About..."), 0, this ); 1321 action = new QAction( "about", i18n("About..."), 0, this );
1325 action->addTo( helpMenu ); 1322 action->addTo( helpMenu );
1326 connect( action, SIGNAL( activated() ), 1323 connect( action, SIGNAL( activated() ),
1327 SLOT( about() ) ); 1324 SLOT( about() ) );
1328 //menuBar->insertSeparator(); 1325 //menuBar->insertSeparator();
1329 1326
1330 // ****************************************************** 1327 // ******************************************************
1331 // menubar icons 1328 // menubar icons
1332 1329
1333 1330
1334 1331
1335 //menuBar->insertItem( iconToolBar ); 1332 //menuBar->insertItem( iconToolBar );
1336 //xdays_action 1333 //xdays_action
1337 if (p-> mShowIconNewEvent) 1334 if (p-> mShowIconNewEvent)
1338 ne_action->addTo( iconToolBar ); 1335 ne_action->addTo( iconToolBar );
1339 if (p->mShowIconNewTodo ) 1336 if (p->mShowIconNewTodo )
1340 nt_action->addTo( iconToolBar ); 1337 nt_action->addTo( iconToolBar );
1341 if (p-> mShowIconSearch) 1338 if (p-> mShowIconSearch)
1342 search_action->addTo( iconToolBar ); 1339 search_action->addTo( iconToolBar );
1343 if (p-> mShowIconWhatsThis) 1340 if (p-> mShowIconWhatsThis)
1344 QWhatsThis::whatsThisButton ( iconToolBar ); 1341 QWhatsThis::whatsThisButton ( iconToolBar );
1345 if (p-> mShowIconNext) 1342 if (p-> mShowIconNext)
1346 whatsnext_action->addTo( viewToolBar ); 1343 whatsnext_action->addTo( viewToolBar );
1347 if (p-> mShowIconNextDays) 1344 if (p-> mShowIconNextDays)
1348 xdays_action->addTo( viewToolBar ); 1345 xdays_action->addTo( viewToolBar );
1349 if (p-> mShowIconJournal) 1346 if (p-> mShowIconJournal)
1350 viewjournal_action->addTo( viewToolBar ); 1347 viewjournal_action->addTo( viewToolBar );
1351 if (p-> mShowIconDay1) 1348 if (p-> mShowIconDay1)
1352 day1_action->addTo( viewToolBar ); 1349 day1_action->addTo( viewToolBar );
1353 if (p-> mShowIconDay5) 1350 if (p-> mShowIconDay5)
1354 day5_action->addTo( viewToolBar ); 1351 day5_action->addTo( viewToolBar );
1355 if (p-> mShowIconDay7) 1352 if (p-> mShowIconDay7)
1356 day7_action->addTo( viewToolBar ); 1353 day7_action->addTo( viewToolBar );
1357 if (p-> mShowIconDay6) 1354 if (p-> mShowIconDay6)
1358 day6_action->addTo( viewToolBar ); 1355 day6_action->addTo( viewToolBar );
1359 if (p-> mShowIconMonth) 1356 if (p-> mShowIconMonth)
1360 month_action->addTo( viewToolBar ); 1357 month_action->addTo( viewToolBar );
1361 if (p-> mShowIconList) 1358 if (p-> mShowIconList)
1362 showlist_action->addTo( viewToolBar ); 1359 showlist_action->addTo( viewToolBar );
1363 if (p-> mShowIconTodoview) 1360 if (p-> mShowIconTodoview)
1364 todoview_action->addTo( viewToolBar ); 1361 todoview_action->addTo( viewToolBar );
1365 1362
1366 icon = loadPixmap( pathString + "2leftarrowB" ); 1363 icon = loadPixmap( pathString + "2leftarrowB" );
1367 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1364 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1368 if (p-> mShowIconBackFast) { 1365 if (p-> mShowIconBackFast) {
1369 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1366 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1370 connect( action, SIGNAL( activated() ), 1367 connect( action, SIGNAL( activated() ),
1371 mView, SLOT( goPreviousMonth() ) ); 1368 mView, SLOT( goPreviousMonth() ) );
1372 action->addTo( navigatorToolBar ); 1369 action->addTo( navigatorToolBar );
1373 } 1370 }
1374 icon = loadPixmap( pathString + "1leftarrowB" ); 1371 icon = loadPixmap( pathString + "1leftarrowB" );
1375 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1372 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1376 if (p-> mShowIconBack) { 1373 if (p-> mShowIconBack) {
1377 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1374 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1378 connect( action, SIGNAL( activated() ), 1375 connect( action, SIGNAL( activated() ),
1379 mView, SLOT( goPrevious() ) ); 1376 mView, SLOT( goPrevious() ) );
1380 action->addTo( navigatorToolBar ); 1377 action->addTo( navigatorToolBar );
1381 } 1378 }
1382 icon = loadPixmap( pathString + "today" ); 1379 icon = loadPixmap( pathString + "today" );
1383 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1380 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1384 if (p-> mShowIconToday) 1381 if (p-> mShowIconToday)
1385 today_action->addTo( navigatorToolBar ); 1382 today_action->addTo( navigatorToolBar );
1386 icon = loadPixmap( pathString + "1rightarrowB" ); 1383 icon = loadPixmap( pathString + "1rightarrowB" );
1387 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1384 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1388 if (p-> mShowIconForward) { 1385 if (p-> mShowIconForward) {
1389 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1386 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1390 connect( action, SIGNAL( activated() ), 1387 connect( action, SIGNAL( activated() ),
1391 mView, SLOT( goNext() ) ); 1388 mView, SLOT( goNext() ) );
1392 action->addTo( navigatorToolBar ); 1389 action->addTo( navigatorToolBar );
1393 } 1390 }
1394 icon = loadPixmap( pathString + "2rightarrowB" ); 1391 icon = loadPixmap( pathString + "2rightarrowB" );
1395 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1392 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1396 if (p-> mShowIconForwardFast) { 1393 if (p-> mShowIconForwardFast) {
1397 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1394 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1398 connect( action, SIGNAL( activated() ), 1395 connect( action, SIGNAL( activated() ),
1399 mView, SLOT( goNextMonth() ) ); 1396 mView, SLOT( goNextMonth() ) );
1400 action->addTo( navigatorToolBar ); 1397 action->addTo( navigatorToolBar );
1401 } 1398 }
1402 1399
1403 1400
1404 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1401 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1405 1402
1406 1403
1407 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1404 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1408 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1405 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1409 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1406 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1410 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1407 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1411 1408
1412 if (p-> mShowIconNewEvent) 1409 if (p-> mShowIconNewEvent)
1413 configureToolBarMenu->setItemChecked( 10, true ); 1410 configureToolBarMenu->setItemChecked( 10, true );
1414 if (p->mShowIconNewTodo ) 1411 if (p->mShowIconNewTodo )
1415 configureToolBarMenu->setItemChecked( 20, true ); 1412 configureToolBarMenu->setItemChecked( 20, true );
1416 if (p-> mShowIconSearch) 1413 if (p-> mShowIconSearch)
1417 configureToolBarMenu->setItemChecked( 120, true ); 1414 configureToolBarMenu->setItemChecked( 120, true );
1418 if (p-> mShowIconList) 1415 if (p-> mShowIconList)
1419 configureToolBarMenu->setItemChecked( 30, true ); 1416 configureToolBarMenu->setItemChecked( 30, true );
1420 if (p-> mShowIconDay1) 1417 if (p-> mShowIconDay1)
1421 configureToolBarMenu->setItemChecked( 40, true ); 1418 configureToolBarMenu->setItemChecked( 40, true );
1422 if (p-> mShowIconDay5) 1419 if (p-> mShowIconDay5)
1423 configureToolBarMenu->setItemChecked( 50, true ); 1420 configureToolBarMenu->setItemChecked( 50, true );
1424 if (p-> mShowIconDay6) 1421 if (p-> mShowIconDay6)
1425 configureToolBarMenu->setItemChecked( 75, true ); 1422 configureToolBarMenu->setItemChecked( 75, true );
1426 if (p-> mShowIconDay7) 1423 if (p-> mShowIconDay7)
1427 configureToolBarMenu->setItemChecked( 60, true ); 1424 configureToolBarMenu->setItemChecked( 60, true );
1428 if (p-> mShowIconMonth) 1425 if (p-> mShowIconMonth)
1429 configureToolBarMenu->setItemChecked( 70, true ); 1426 configureToolBarMenu->setItemChecked( 70, true );
1430 if (p-> mShowIconTodoview) 1427 if (p-> mShowIconTodoview)
1431 configureToolBarMenu->setItemChecked( 80, true ); 1428 configureToolBarMenu->setItemChecked( 80, true );
1432 if (p-> mShowIconBackFast) 1429 if (p-> mShowIconBackFast)
1433 configureToolBarMenu->setItemChecked( 200, true ); 1430 configureToolBarMenu->setItemChecked( 200, true );
1434 if (p-> mShowIconBack) 1431 if (p-> mShowIconBack)
1435 configureToolBarMenu->setItemChecked( 210, true ); 1432 configureToolBarMenu->setItemChecked( 210, true );
1436 if (p-> mShowIconToday) 1433 if (p-> mShowIconToday)
1437 configureToolBarMenu->setItemChecked( 130, true ); 1434 configureToolBarMenu->setItemChecked( 130, true );
1438 if (p-> mShowIconForward) 1435 if (p-> mShowIconForward)
1439 configureToolBarMenu->setItemChecked( 220, true ); 1436 configureToolBarMenu->setItemChecked( 220, true );
1440 if (p-> mShowIconForwardFast) 1437 if (p-> mShowIconForwardFast)
1441 configureToolBarMenu->setItemChecked( 230, true ); 1438 configureToolBarMenu->setItemChecked( 230, true );
1442 if (p-> mShowIconNextDays) 1439 if (p-> mShowIconNextDays)
1443 configureToolBarMenu->setItemChecked( 100, true ); 1440 configureToolBarMenu->setItemChecked( 100, true );
1444 if (p-> mShowIconNext) 1441 if (p-> mShowIconNext)
1445 configureToolBarMenu->setItemChecked( 110, true ); 1442 configureToolBarMenu->setItemChecked( 110, true );
1446 if (p-> mShowIconJournal) 1443 if (p-> mShowIconJournal)
1447 configureToolBarMenu->setItemChecked( 90, true ); 1444 configureToolBarMenu->setItemChecked( 90, true );
1448 if (p-> mShowIconWhatsThis) 1445 if (p-> mShowIconWhatsThis)
1449 configureToolBarMenu->setItemChecked( 300, true ); 1446 configureToolBarMenu->setItemChecked( 300, true );
1450 if (p-> mShowIconWeekNum) 1447 if (p-> mShowIconWeekNum)
1451 configureToolBarMenu->setItemChecked( 400, true ); 1448 configureToolBarMenu->setItemChecked( 400, true );
1452 if (!p-> mShowIconStretch) { 1449 if (!p-> mShowIconStretch) {
1453 QLabel* dummy = new QLabel( iconToolBar ); 1450 QLabel* dummy = new QLabel( iconToolBar );
1454 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1451 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1455 dummy->setMinimumWidth( 0 ); 1452 dummy->setMinimumWidth( 0 );
1456 iconToolBar->setStretchableWidget ( dummy ) ; 1453 iconToolBar->setStretchableWidget ( dummy ) ;
1457 } 1454 }
1458 else { 1455 else {
1459 iconToolBar->setHorizontalStretchable (true ); 1456 iconToolBar->setHorizontalStretchable (true );
1460 viewToolBar->setHorizontalStretchable (true ); 1457 viewToolBar->setHorizontalStretchable (true );
1461 navigatorToolBar->setHorizontalStretchable (true ); 1458 navigatorToolBar->setHorizontalStretchable (true );
1462 iconToolBar->setVerticalStretchable (true ); 1459 iconToolBar->setVerticalStretchable (true );
1463 viewToolBar->setVerticalStretchable (true ); 1460 viewToolBar->setVerticalStretchable (true );
1464 navigatorToolBar->setVerticalStretchable (true ); 1461 navigatorToolBar->setVerticalStretchable (true );
1465 configureToolBarMenu->setItemChecked( 5, true ); 1462 configureToolBarMenu->setItemChecked( 5, true );
1466 } 1463 }
1467 if (p-> mShowIconFilter) 1464 if (p-> mShowIconFilter)
1468 configureToolBarMenu->setItemChecked( 7, true ); 1465 configureToolBarMenu->setItemChecked( 7, true );
1469 if (p-> mShowIconOnetoolbar) 1466 if (p-> mShowIconOnetoolbar)
1470 configureToolBarMenu->setItemChecked( 6, true ); 1467 configureToolBarMenu->setItemChecked( 6, true );
1471 1468
1472 1469
1473 if ( filterMenubar ) { 1470 if ( filterMenubar ) {
1474 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1471 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1475 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1472 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1476 } 1473 }
1477 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1474 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1478 configureAgenda( p->mHourSize ); 1475 configureAgenda( p->mHourSize );
1479 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1476 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1480} 1477}
1481void MainWindow::calHint() 1478void MainWindow::calHint()
1482{ 1479{
1483 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>."); 1480 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>.");
1484 1481
1485 KMessageBox::information( this, message); 1482 KMessageBox::information( this, message);
1486} 1483}
1487void MainWindow::exportToPhone( int mode ) 1484void MainWindow::exportToPhone( int mode )
1488{ 1485{
1489 1486
1490 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1487 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1491 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1488 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1492 KOex2phonePrefs ex2phone; 1489 KOex2phonePrefs ex2phone;
1493 1490
1494 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1491 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1495 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1492 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1496 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1493 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1497 if ( mode == 1 ) 1494 if ( mode == 1 )
1498 ex2phone.setCaption(i18n("Export complete calendar")); 1495 ex2phone.setCaption(i18n("Export complete calendar"));
1499 if ( mode == 2 ) 1496 if ( mode == 2 )
1500 ex2phone.setCaption(i18n("Export filtered calendar")); 1497 ex2phone.setCaption(i18n("Export filtered calendar"));
1501 1498
1502 if ( !ex2phone.exec() ) { 1499 if ( !ex2phone.exec() ) {
1503 return; 1500 return;
1504 } 1501 }
1505 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1502 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1506 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1503 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1507 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1504 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1508 1505
1509 int inFuture = 0; 1506 int inFuture = 0;
1510 if ( ex2phone.mWriteBackFuture->isChecked() ) 1507 if ( ex2phone.mWriteBackFuture->isChecked() )
1511 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1508 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1512 QPtrList<Incidence> delSel; 1509 QPtrList<Incidence> delSel;
1513 if ( mode == 1 ) 1510 if ( mode == 1 )
1514 delSel = mCalendar->rawIncidences(); 1511 delSel = mCalendar->rawIncidences();
1515 if ( mode == 2 ) 1512 if ( mode == 2 )
1516 delSel = mCalendar->incidences(); 1513 delSel = mCalendar->incidences();
1517 CalendarLocal* cal = new CalendarLocal(); 1514 CalendarLocal* cal = new CalendarLocal();
1518 cal->setLocalTime(); 1515 cal->setLocalTime();
1519 Incidence *incidence = delSel.first(); 1516 Incidence *incidence = delSel.first();
1520 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1517 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1521 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1518 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1522 while ( incidence ) { 1519 while ( incidence ) {
1523 if ( incidence->typeID() != journalID ) { 1520 if ( incidence->typeID() != journalID ) {
1524 bool add = true; 1521 bool add = true;
1525 if ( inFuture ) { 1522 if ( inFuture ) {
1526 QDateTime dt; 1523 QDateTime dt;
1527 if ( incidence->typeID() == todoID ) { 1524 if ( incidence->typeID() == todoID ) {
1528 Todo * t = (Todo*)incidence; 1525 Todo * t = (Todo*)incidence;
1529 if ( t->hasDueDate() ) 1526 if ( t->hasDueDate() )
1530 dt = t->dtDue(); 1527 dt = t->dtDue();
1531 else 1528 else
1532 dt = cur.addSecs( 62 ); 1529 dt = cur.addSecs( 62 );
1533 } 1530 }
1534 else { 1531 else {
1535 bool ok; 1532 bool ok;
1536 dt = incidence->getNextOccurence( cur, &ok ); 1533 dt = incidence->getNextOccurence( cur, &ok );
1537 if ( !ok ) 1534 if ( !ok )
1538 dt = cur.addSecs( -62 ); 1535 dt = cur.addSecs( -62 );
1539 } 1536 }
1540 if ( dt < cur || dt > end ) { 1537 if ( dt < cur || dt > end ) {
1541 add = false; 1538 add = false;
1542 } 1539 }
1543 } 1540 }
1544 if ( add ) { 1541 if ( add ) {
1545 Incidence *in = incidence->clone(); 1542 Incidence *in = incidence->clone();
1546 cal->addIncidence( in ); 1543 cal->addIncidence( in );
1547 } 1544 }
1548 } 1545 }
1549 incidence = delSel.next(); 1546 incidence = delSel.next();
1550 } 1547 }
1551 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1548 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1552 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1549 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1553 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1550 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1554 1551
1555 setCaption( i18n("Writing to phone...")); 1552 setCaption( i18n("Writing to phone..."));
1556 if ( PhoneFormat::writeToPhone( cal ) ) 1553 if ( PhoneFormat::writeToPhone( cal ) )
1557 setCaption( i18n("Export to phone successful!")); 1554 setCaption( i18n("Export to phone successful!"));
1558 else 1555 else
1559 setCaption( i18n("Error exporting to phone!")); 1556 setCaption( i18n("Error exporting to phone!"));
1560 delete cal; 1557 delete cal;
1561} 1558}
1562 1559
1563 1560
1564void MainWindow::setDefaultPreferences() 1561void MainWindow::setDefaultPreferences()
1565{ 1562{
1566 KOPrefs *p = KOPrefs::instance(); 1563 KOPrefs *p = KOPrefs::instance();
1567 1564
1568 p->mCompactDialogs = true; 1565 p->mCompactDialogs = true;
1569 p->mConfirm = true; 1566 p->mConfirm = true;
1570 // p->mEnableQuickTodo = false; 1567 // p->mEnableQuickTodo = false;
1571 1568
1572} 1569}
1573 1570
1574QString MainWindow::resourcePath() 1571QString MainWindow::resourcePath()
1575{ 1572{
1576 return KGlobal::iconLoader()->iconPath(); 1573 return KGlobal::iconLoader()->iconPath();
1577} 1574}
1578 1575
1579void MainWindow::displayText( QString text ,QString cap ) 1576void MainWindow::displayText( QString text ,QString cap )
1580{ 1577{
1581 QDialog dia( this, "name", true ); ; 1578 QDialog dia( this, "name", true ); ;
1582 dia.setCaption( cap ); 1579 dia.setCaption( cap );
1583 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1580 QVBoxLayout* lay = new QVBoxLayout( &dia );
1584 lay->setSpacing( 3 ); 1581 lay->setSpacing( 3 );
1585 lay->setMargin( 3 ); 1582 lay->setMargin( 3 );
1586 QTextBrowser tb ( &dia ); 1583 QTextBrowser tb ( &dia );
1587 lay->addWidget( &tb ); 1584 lay->addWidget( &tb );
1588 tb.setText( text ); 1585 tb.setText( text );
1589#ifdef DESKTOP_VERSION 1586#ifdef DESKTOP_VERSION
1590 dia.resize( 640, 480); 1587 dia.resize( 640, 480);
1591#else 1588#else
1592 dia.showMaximized(); 1589 dia.showMaximized();
1593#endif 1590#endif
1594 dia.exec(); 1591 dia.exec();
1595} 1592}
1596 1593
1597void MainWindow::features() 1594void MainWindow::features()
1598{ 1595{
1599 1596
1600 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1597 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1601} 1598}
1602 1599
1603void MainWindow::usertrans() 1600void MainWindow::usertrans()
1604{ 1601{
1605 1602
1606 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1603 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1607} 1604}
1608 1605
1609void MainWindow::storagehowto() 1606void MainWindow::storagehowto()
1610{ 1607{
1611 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1608 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1612} 1609}
1613void MainWindow::timetrackinghowto() 1610void MainWindow::timetrackinghowto()
1614{ 1611{
1615 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1612 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1616} 1613}
1617void MainWindow::kdesynchowto() 1614void MainWindow::kdesynchowto()
1618{ 1615{
1619 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1616 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1620} 1617}
1621void MainWindow::multisynchowto() 1618void MainWindow::multisynchowto()
1622{ 1619{
1623 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1620 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1624} 1621}
1625void MainWindow::synchowto() 1622void MainWindow::synchowto()
1626{ 1623{
1627 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1624 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1628} 1625}
1629void MainWindow::faq() 1626void MainWindow::faq()
1630{ 1627{
1631 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1628 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1632 1629
1633} 1630}
1634void MainWindow::whatsNew() 1631void MainWindow::whatsNew()
1635{ 1632{
1636 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1633 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1637 1634
1638} 1635}
1639void MainWindow::licence() 1636void MainWindow::licence()
1640{ 1637{
1641 KApplication::showLicence(); 1638 KApplication::showLicence();
1642 1639
1643} 1640}
1644void MainWindow::about() 1641void MainWindow::about()
1645{ 1642{
1646 QString version; 1643 QString version;
1647#include <../version> 1644#include <../version>
1648 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1645 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1649 i18n("KOrganizer/Platform-independent\n") + 1646 i18n("KOrganizer/Platform-independent\n") +
1650 "(KO/Pi) " + version + " - " + 1647 "(KO/Pi) " + version + " - " +
1651 1648
1652#ifdef DESKTOP_VERSION 1649#ifdef DESKTOP_VERSION
1653 i18n("Desktop Edition\n") + 1650 i18n("Desktop Edition\n") +
1654#else 1651#else
1655 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1652 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1656#endif 1653#endif
1657 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!") ); 1654 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!") );
1658} 1655}
1659void MainWindow::keyBindings() 1656void MainWindow::keyBindings()
1660{ 1657{
1661 QString cap = i18n("KO/Pi Keys + Colors"); 1658 QString cap = i18n("KO/Pi Keys + Colors");
1662 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1659 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1663 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1660 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1664 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1661 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1665 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1662 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1666 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1663 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1667 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1664 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1668 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1665 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1669 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1666 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1670 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1667 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1671 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1668 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1672 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ 1669 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+
1673 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1670 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1674 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1671 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1675 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1672 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1676 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1673 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1677 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1674 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1678 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1675 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1679 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1676 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1680 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1677 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1681 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1678 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1682 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1679 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1683 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1680 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1684 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1681 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1685 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1682 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1686 i18n("<p><h3>In agenda view:</h3></p>\n") + 1683 i18n("<p><h3>In agenda view:</h3></p>\n") +
1687 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1684 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1688 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1685 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1689 i18n("<p><h3>In todo view:</h3></p>\n") + 1686 i18n("<p><h3>In todo view:</h3></p>\n") +
1690 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1687 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1691 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1688 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1692 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1689 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1693 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1690 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1694 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1691 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1695 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1692 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1696 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1693 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1697 i18n("<p><h3>In list view:</h3></p>\n") + 1694 i18n("<p><h3>In list view:</h3></p>\n") +
1698 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1695 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1699 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1696 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1700 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1697 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1701 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1698 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1702 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1699 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1703 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1700 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1704 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1701 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1705 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1702 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1706 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1703 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1707 i18n("<p><b>E</b>: Edit item</p>\n") + 1704 i18n("<p><b>E</b>: Edit item</p>\n") +
1708 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1705 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1709 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1706 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1710 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1707 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1711 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1708 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1712 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1709 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1713 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1710 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1714 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1711 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1715 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1712 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1716 i18n("<p><b>White</b>: Item readonly</p>\n"); 1713 i18n("<p><b>White</b>: Item readonly</p>\n");
1717 displayText( text, cap); 1714 displayText( text, cap);
1718} 1715}
1719void MainWindow::aboutAutoSaving() 1716void MainWindow::aboutAutoSaving()
1720{ 1717{
1721 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"); 1718 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");
1722 1719
1723 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1720 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1724 1721
1725} 1722}
1726void MainWindow::aboutKnownBugs() 1723void MainWindow::aboutKnownBugs()
1727{ 1724{
1728 QMessageBox* msg; 1725 QMessageBox* msg;
1729 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1726 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1730 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")+ 1727 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")+
1731 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1728 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1732 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1729 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1733 i18n("\nor report them in the bugtracker on\n") + 1730 i18n("\nor report them in the bugtracker on\n") +
1734 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1731 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1735 QMessageBox::NoIcon, 1732 QMessageBox::NoIcon,
1736 QMessageBox::Ok, 1733 QMessageBox::Ok,
1737 QMessageBox::NoButton, 1734 QMessageBox::NoButton,
1738 QMessageBox::NoButton); 1735 QMessageBox::NoButton);
1739 msg->exec(); 1736 msg->exec();
1740 delete msg; 1737 delete msg;
1741 1738
1742} 1739}
1743 1740
1744QString MainWindow::defaultFileName() 1741QString MainWindow::defaultFileName()
1745{ 1742{
1746 return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); 1743 return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) );
1747} 1744}
1748QString MainWindow::syncFileName() 1745QString MainWindow::syncFileName()
1749{ 1746{
1750#ifdef DESKTOP_VERSION 1747#ifdef DESKTOP_VERSION
1751 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); 1748 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) );
1752#else 1749#else
1753 return QString( "/tmp/synccalendar.ics" ); 1750 return QString( "/tmp/synccalendar.ics" );
1754#endif 1751#endif
1755} 1752}
1756#include "koglobals.h" 1753#include "koglobals.h"
1757#include <kcalendarsystem.h> 1754#include <kcalendarsystem.h>
1758void MainWindow::updateWeek(QDate seda) 1755void MainWindow::updateWeek(QDate seda)
1759{ 1756{
1760 int weekNum = KGlobal::locale()->weekNum ( seda ); 1757 int weekNum = KGlobal::locale()->weekNum ( seda );
1761 mWeekPixmap.fill( mWeekBgColor ); 1758 mWeekPixmap.fill( mWeekBgColor );
1762 QPainter p ( &mWeekPixmap ); 1759 QPainter p ( &mWeekPixmap );
1763 p.setFont( mWeekFont ); 1760 p.setFont( mWeekFont );
1764 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1761 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1765 p.end(); 1762 p.end();
1766 QIconSet icon3 ( mWeekPixmap ); 1763 QIconSet icon3 ( mWeekPixmap );
1767 mWeekAction->setIconSet ( icon3 ); 1764 mWeekAction->setIconSet ( icon3 );
1768 1765
1769} 1766}
1770void MainWindow::updateWeekNum(const DateList &selectedDates) 1767void MainWindow::updateWeekNum(const DateList &selectedDates)
1771{ 1768{
1772 updateWeek( selectedDates.first() ); 1769 updateWeek( selectedDates.first() );
1773} 1770}
1774void MainWindow::processIncidenceSelection( Incidence *incidence ) 1771void MainWindow::processIncidenceSelection( Incidence *incidence )
1775{ 1772{
1776 if ( !incidence ) { 1773 if ( !incidence ) {
1777 mShowAction->setMenuText( i18n("Show") ); 1774 mShowAction->setMenuText( i18n("Show") );
1778 enableIncidenceActions( false ); 1775 enableIncidenceActions( false );
1779 mNewSubTodoAction->setEnabled( false ); 1776 mNewSubTodoAction->setEnabled( false );
1780 setCaptionToDates(); 1777 setCaptionToDates();
1781 return; 1778 return;
1782 } 1779 }
1783 QString startString = ""; 1780 QString startString = "";
1784 if ( incidence->typeID() != todoID ) { 1781 if ( incidence->typeID() != todoID ) {
1785 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1782 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1786 if ( incidence->doesFloat() ) { 1783 if ( incidence->doesFloat() ) {
1787 startString += ": "+incidence->dtStartDateStr( true ); 1784 startString += ": "+incidence->dtStartDateStr( true );
1788 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1785 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1789 } else { 1786 } else {
1790 startString = ": "+incidence->dtStartStr(true); 1787 startString = ": "+incidence->dtStartStr(true);
1791 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1788 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1792 } 1789 }
1793 } else { 1790 } else {
1794 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1791 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1795 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1792 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1796 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1793 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1797 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1794 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1798 bool ok; 1795 bool ok;
1799 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1796 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1800 if ( ok ) { 1797 if ( ok ) {
1801 int years = noc.date().year() - incidence->dtStart().date().year(); 1798 int years = noc.date().year() - incidence->dtStart().date().year();
1802 startString += i18n(" (%1 y.)"). arg( years ); 1799 startString += i18n(" (%1 y.)"). arg( years );
1803 } 1800 }
1804 } 1801 }
1805 else 1802 else
1806 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1803 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1807 } 1804 }
1808 } 1805 }
1809 else { 1806 else {
1810 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) 1807 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1811 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); 1808 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1812 else 1809 else
1813 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1810 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1814 } 1811 }
1815 if ( !incidence->location().isEmpty() ) 1812 if ( !incidence->location().isEmpty() )
1816 startString += " (" +incidence->location()+")"; 1813 startString += " (" +incidence->location()+")";
1817 setCaption( incidence->summary()+startString); 1814 setCaption( incidence->summary()+startString);
1818 enableIncidenceActions( true ); 1815 enableIncidenceActions( true );
1819 if ( incidence->typeID() == eventID ) { 1816 if ( incidence->typeID() == eventID ) {
1820 mShowAction->setMenuText( i18n("Show Event") ); 1817 mShowAction->setMenuText( i18n("Show Event") );
1821 mNewSubTodoAction->setEnabled( false ); 1818 mNewSubTodoAction->setEnabled( false );
1822 } else if ( incidence->typeID() == todoID ) { 1819 } else if ( incidence->typeID() == todoID ) {
1823 mShowAction->setMenuText( i18n("Show Todo") ); 1820 mShowAction->setMenuText( i18n("Show Todo") );
1824 mNewSubTodoAction->setEnabled( true ); 1821 mNewSubTodoAction->setEnabled( true );
1825 } else { 1822 } else {
1826 mShowAction->setMenuText( i18n("Show") ); 1823 mShowAction->setMenuText( i18n("Show") );
1827 mNewSubTodoAction->setEnabled( false ); 1824 mNewSubTodoAction->setEnabled( false );
1828 } 1825 }
1829#ifdef DESKTOP_VERSION 1826#ifdef DESKTOP_VERSION
1830 static QPixmap jP = SmallIcon( "journal" ); 1827 static QPixmap jP = SmallIcon( "journal" );
1831 static QPixmap eP = SmallIcon( "newevent" ); 1828 static QPixmap eP = SmallIcon( "newevent" );
1832 static QPixmap tP = SmallIcon( "newtodo" ); 1829 static QPixmap tP = SmallIcon( "newtodo" );
1833 QIconSet icon; 1830 QIconSet icon;
1834 if ( incidence->typeID() == todoID ) 1831 if ( incidence->typeID() == todoID )
1835 icon = QIconSet ( tP ); 1832 icon = QIconSet ( tP );
1836 else if ( incidence->typeID() == eventID ) 1833 else if ( incidence->typeID() == eventID )
1837 icon = QIconSet ( eP ); 1834 icon = QIconSet ( eP );
1838 else if ( incidence->typeID() == journalID ) 1835 else if ( incidence->typeID() == journalID )
1839 icon = QIconSet ( jP ); 1836 icon = QIconSet ( jP );
1840 mPrintSelAction->setIconSet ( icon ); 1837 mPrintSelAction->setIconSet ( icon );
1841#endif 1838#endif
1842} 1839}
1843 1840
1844void MainWindow::enableIncidenceActions( bool enabled ) 1841void MainWindow::enableIncidenceActions( bool enabled )
1845{ 1842{
1846 mShowAction->setEnabled( enabled ); 1843 mShowAction->setEnabled( enabled );
1847 mEditAction->setEnabled( enabled ); 1844 mEditAction->setEnabled( enabled );
1848 mDeleteAction->setEnabled( enabled ); 1845 mDeleteAction->setEnabled( enabled );
1849 1846
1850 mCloneAction->setEnabled( enabled ); 1847 mCloneAction->setEnabled( enabled );
1851 mMoveAction->setEnabled( enabled ); 1848 mMoveAction->setEnabled( enabled );
1852#ifndef DESKTOP_VERSION 1849#ifndef DESKTOP_VERSION
1853 mBeamAction->setEnabled( enabled ); 1850 mBeamAction->setEnabled( enabled );
1854#else 1851#else
1855 mPrintSelAction->setEnabled( enabled ); 1852 mPrintSelAction->setEnabled( enabled );
1856#endif 1853#endif
1857 mCancelAction->setEnabled( enabled ); 1854 mCancelAction->setEnabled( enabled );
1858} 1855}
1859 1856
1860void MainWindow::importOL() 1857void MainWindow::importOL()
1861{ 1858{
1862#ifdef _OL_IMPORT_ 1859#ifdef _OL_IMPORT_
1863 mView->clearAllViews(); 1860 mView->clearAllViews();
1864 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1861 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1865 id->exec(); 1862 id->exec();
1866 delete id; 1863 delete id;
1867 mView->calendar()->checkAlarmForIncidence( 0, true ); 1864 mView->calendar()->checkAlarmForIncidence( 0, true );
1868 mView->updateView(); 1865 mView->updateView();
1869#endif 1866#endif
1870} 1867}
1871void MainWindow::importBday() 1868void MainWindow::importBday()
1872{ 1869{
1873 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1870 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1874 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1871 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1875 i18n("Import!"), i18n("Cancel"), 0, 1872 i18n("Import!"), i18n("Cancel"), 0,
1876 0, 1 ); 1873 0, 1 );
1877 if ( result == 0 ) { 1874 if ( result == 0 ) {
1878 mView->importBday(); 1875 mView->importBday();
1879 1876
1880 } 1877 }
1881 1878
1882 1879
1883} 1880}
1884void MainWindow::importQtopia() 1881void MainWindow::importQtopia()
1885{ 1882{
1886 //#ifndef DESKTOP_VERSION 1883 //#ifndef DESKTOP_VERSION
1887 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"); 1884 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");
1888#ifdef DESKTOP_VERSION 1885#ifdef DESKTOP_VERSION
1889 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"); 1886 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");
1890#endif 1887#endif
1891 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1888 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1892 i18n("Import!"), i18n("Cancel"), 0, 1889 i18n("Import!"), i18n("Cancel"), 0,
1893 0, 1 ); 1890 0, 1 );
1894 if ( result == 0 ) { 1891 if ( result == 0 ) {
1895#ifndef DESKTOP_VERSION 1892#ifndef DESKTOP_VERSION
1896 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1893 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1897 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1894 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1898 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1895 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1899#else 1896#else
1900 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1897 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1901 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1898 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1902 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1899 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1903#endif 1900#endif
1904 mView->importQtopia( categories, datebook, todolist ); 1901 mView->importQtopia( categories, datebook, todolist );
1905 } 1902 }
1906 mView->calendar()->reInitAlarmSettings(); 1903 mView->calendar()->reInitAlarmSettings();
1907#if 0 1904#if 0
1908 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1905 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1909 i18n("Not supported \non desktop!\n"), 1906 i18n("Not supported \non desktop!\n"),
1910 i18n("Ok"), i18n("Cancel"), 0, 1907 i18n("Ok"), i18n("Cancel"), 0,
1911 0, 1 ); 1908 0, 1 );
1912 1909
1913#endif 1910#endif
1914} 1911}
1915 1912
1916void MainWindow::saveOnClose() 1913void MainWindow::saveOnClose()
1917{ 1914{
1918 KOPrefs *p = KOPrefs::instance(); 1915 KOPrefs *p = KOPrefs::instance();
1919 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1916 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1920 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1917 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1921 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1918 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1922 if ( filterToolBar ) { 1919 if ( filterToolBar ) {
1923 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1920 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1924 } 1921 }
1925#ifdef DESKTOP_VERSION 1922#ifdef DESKTOP_VERSION
1926 1923
1927 QPoint myP; 1924 QPoint myP;
1928 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1925 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1929 if ( p->mToolBarHor ) 1926 if ( p->mToolBarHor )
1930 p->mToolBarUp = myP.y() > height()/2; 1927 p->mToolBarUp = myP.y() > height()/2;
1931 else 1928 else
1932 p->mToolBarUp = myP.x() > width()/2; 1929 p->mToolBarUp = myP.x() > width()/2;
1933 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1930 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1934 if ( p->mToolBarHorV ) 1931 if ( p->mToolBarHorV )
1935 p->mToolBarUpV = myP.y() > height()/2; 1932 p->mToolBarUpV = myP.y() > height()/2;
1936 else 1933 else
1937 p->mToolBarUpV = myP.x() > width()/2 ; 1934 p->mToolBarUpV = myP.x() > width()/2 ;
1938 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1935 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1939 if ( p->mToolBarHorN ) 1936 if ( p->mToolBarHorN )
1940 p->mToolBarUpN = myP.y() > height()/2; 1937 p->mToolBarUpN = myP.y() > height()/2;
1941 else 1938 else
1942 p->mToolBarUpN = myP.x() > width()/2 ; 1939 p->mToolBarUpN = myP.x() > width()/2 ;
1943 if ( filterToolBar ) { 1940 if ( filterToolBar ) {
1944 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1941 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1945 if ( p->mToolBarHorF ) 1942 if ( p->mToolBarHorF )
1946 p->mToolBarUpF = myP.y() > height()/2; 1943 p->mToolBarUpF = myP.y() > height()/2;
1947 else 1944 else
1948 p->mToolBarUpF = myP.x() > width()/2 ; 1945 p->mToolBarUpF = myP.x() > width()/2 ;
1949 } 1946 }
1950#else 1947#else
1951 if ( p->mToolBarHor ) 1948 if ( p->mToolBarHor )
1952 p->mToolBarUp = iconToolBar->y() > height()/2; 1949 p->mToolBarUp = iconToolBar->y() > height()/2;
1953 else 1950 else
1954 p->mToolBarUp = iconToolBar->x() > width()/2; 1951 p->mToolBarUp = iconToolBar->x() > width()/2;
1955 if ( p->mToolBarHorV ) 1952 if ( p->mToolBarHorV )
1956 p->mToolBarUpV = viewToolBar->y() > height()/2; 1953 p->mToolBarUpV = viewToolBar->y() > height()/2;
1957 else 1954 else
1958 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1955 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1959 1956
1960 if ( p->mToolBarHorN ) 1957 if ( p->mToolBarHorN )
1961 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1958 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1962 else 1959 else
1963 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1960 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1964 if ( filterToolBar ) { 1961 if ( filterToolBar ) {
1965 if ( p->mToolBarHorF ) 1962 if ( p->mToolBarHorF )
1966 p->mToolBarUpF = filterToolBar->y() > height()/2; 1963 p->mToolBarUpF = filterToolBar->y() > height()/2;
1967 else 1964 else
1968 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1965 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1969 } 1966 }
1970#endif 1967#endif
1971 save(); 1968 save();
1972 mView->writeSettings(); 1969 mView->writeSettings();
1973 mView->checkSuspendAlarm(); 1970 mView->checkSuspendAlarm();
1974} 1971}
1975void MainWindow::slotModifiedChanged( bool ) 1972void MainWindow::slotModifiedChanged( bool )
1976{ 1973{
1977 if ( mBlockAtStartup ) 1974 if ( mBlockAtStartup )
1978 return; 1975 return;
1979 1976
1980 int msec; 1977 int msec;
1981 if ( mCalendarModifiedFlag ) { 1978 if ( mCalendarModifiedFlag ) {