summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp316
1 files changed, 163 insertions, 153 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 69ccde1..2004939 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,332 +1,342 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <Q3Action>
5#include <q3popupmenu.h>
5#include <qpainter.h> 6#include <qpainter.h>
6#include <qwhatsthis.h> 7#include <q3whatsthis.h>
7#include <qpushbutton.h> 8#include <qpushbutton.h>
8#include <qmessagebox.h> 9#include <qmessagebox.h>
9#include <qlineedit.h> 10#include <qlineedit.h>
10#include <qtextcodec.h> 11#include <qtextcodec.h>
11#include <qfile.h> 12#include <qfile.h>
12#include <qdir.h> 13#include <qdir.h>
13#include <qapp.h> 14#include <qapplication.h>
14#include <qfileinfo.h> 15#include <qfileinfo.h>
15#include <qlabel.h> 16#include <qlabel.h>
16#include <qspinbox.h> 17#include <qspinbox.h>
17#include <qcheckbox.h> 18#include <qcheckbox.h>
18#include <qmap.h> 19#include <qmap.h>
19#include <qwmatrix.h> 20#include <qmatrix.h>
20#include <qtextbrowser.h> 21#include <q3textbrowser.h>
21#include <qtextstream.h> 22#include <q3textstream.h>
22#ifndef DESKTOP_VERSION 23#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 24#include <qpe/global.h>
24#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
26#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
27#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
28#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
29//#include <unistd.h> // for sleep 30//#include <unistd.h> // for sleep
30#else 31#else
31#include <qtoolbar.h> 32#include <q3toolbar.h>
32#include <qapplication.h> 33#include <qapplication.h>
34//Added by qt3to4:
35#include <QResizeEvent>
36#include <QPixmap>
37#include <QCloseEvent>
38#include <QKeyEvent>
39#include <Q3VBoxLayout>
40#include <QHideEvent>
41#include <Q3CString>
42#include <Q3PtrList>
33//#include <resource.h> 43//#include <resource.h>
34 44
35#endif 45#endif
36#include <libkcal/calendarlocal.h> 46#include <libkcal/calendarlocal.h>
37#include <libkcal/todo.h> 47#include <libkcal/todo.h>
38#include <libkcal/phoneformat.h> 48#include <libkcal/phoneformat.h>
39#include <libkdepim/ksyncprofile.h> 49#include <libkdepim/ksyncprofile.h>
40#include <libkdepim/phoneaccess.h> 50#include <libkdepim/phoneaccess.h>
41#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
42#include <libkdepim/kpimglobalprefs.h> 52#include <libkdepim/kpimglobalprefs.h>
43 53
44#include "calendarview.h" 54#include "calendarview.h"
45#include "koviewmanager.h" 55#include "koviewmanager.h"
46#include "datenavigator.h" 56#include "datenavigator.h"
47#include "koagendaview.h" 57#include "koagendaview.h"
48#include "kojournalview.h" 58#include "kojournalview.h"
49#include "koagenda.h" 59#include "koagenda.h"
50#include "kodialogmanager.h" 60#include "kodialogmanager.h"
51#include "kdialogbase.h" 61#include "kdialogbase.h"
52#include "kapplication.h" 62#include "kapplication.h"
53#include "kofilterview.h" 63#include "kofilterview.h"
54#include "kstandarddirs.h" 64#include "kstandarddirs.h"
55#include "koprefs.h" 65#include "koprefs.h"
56#include "kfiledialog.h" 66#include "kfiledialog.h"
57#include "koglobals.h" 67#include "koglobals.h"
58#include "kglobal.h" 68#include "kglobal.h"
59#include "ktoolbar.h" 69#include "ktoolbar.h"
60#include "klocale.h" 70#include "klocale.h"
61#include "kconfig.h" 71#include "kconfig.h"
62#include "externalapphandler.h" 72#include "externalapphandler.h"
63#include <kglobalsettings.h> 73#include <kglobalsettings.h>
64 74
65using namespace KCal; 75using namespace KCal;
66#ifndef _WIN32_ 76#ifndef _WIN32_
67#include <unistd.h> 77#include <unistd.h>
68#else 78#else
69#ifdef _OL_IMPORT_ 79#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 80#include "koimportoldialog.h"
71#endif 81#endif
72#endif 82#endif
73#include "mainwindow.h" 83#include "mainwindow.h"
74 84
75 85
76class KOex2phonePrefs : public QDialog 86class KOex2phonePrefs : public QDialog
77{ 87{
78 public: 88 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 89 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 90 QDialog( parent, name, true )
81 { 91 {
82 setCaption( i18n("Export to phone options") ); 92 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 93 Q3VBoxLayout* lay = new Q3VBoxLayout( this );
84 lay->setSpacing( 3 ); 94 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 95 lay->setMargin( 3 );
86 QLabel *lab; 96 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 97 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 98 lab->setAlignment (Qt::AlignHCenter );
89 QHBox* temphb; 99 Q3HBox* temphb;
90 temphb = new QHBox( this ); 100 temphb = new Q3HBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 101 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 102 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 103 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 104 temphb = new Q3HBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 105 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 106 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 107 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 108 temphb = new Q3HBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 109 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 110 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 111 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 112 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 113 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 114 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 115 temphb = new Q3HBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 116 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 117 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 118 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 119 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 120 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 121 lab->setAlignment (Qt::AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 122 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 123 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 124 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 125 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 126 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 127 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 128 resize( 220, 240 );
119 qApp->processEvents(); 129 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 130 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 131 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 132 move( (dw-width())/2, (dh - height() )/2 );
123 } 133 }
124 134
125public: 135public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 136 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 137 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 138 QSpinBox* mWriteBackFutureWeeks;
129}; 139};
130 140
131QPixmap* sgListViewCompletedPix[6]; 141QPixmap* sgListViewCompletedPix[6];
132QPixmap* sgListViewJournalPix; 142QPixmap* sgListViewJournalPix;
133 143
134 144
135int globalFlagBlockStartup; 145int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name ) : 146MainWindow::MainWindow( QWidget *parent, const char *name ) :
137 QMainWindow( parent, name ) 147 Q3MainWindow( parent, name )
138{ 148{
139 sgListViewCompletedPix[5] = &listviewPix; 149 sgListViewCompletedPix[5] = &listviewPix;
140 sgListViewCompletedPix[0] = &listviewPix0; 150 sgListViewCompletedPix[0] = &listviewPix0;
141 sgListViewCompletedPix[1] = &listviewPix20; 151 sgListViewCompletedPix[1] = &listviewPix20;
142 sgListViewCompletedPix[2] = &listviewPix40; 152 sgListViewCompletedPix[2] = &listviewPix40;
143 sgListViewCompletedPix[3] = &listviewPix60; 153 sgListViewCompletedPix[3] = &listviewPix60;
144 sgListViewCompletedPix[4] = &listviewPix80; 154 sgListViewCompletedPix[4] = &listviewPix80;
145 //int size = 12; 155 //int size = 12;
146 { 156 {
147 sgListViewCompletedPix[5]->resize( 11, 11 ); 157 sgListViewCompletedPix[5]->resize( 11, 11 );
148 sgListViewCompletedPix[5]->fill( Qt::white ); 158 sgListViewCompletedPix[5]->fill( Qt::white );
149 QPainter p ( sgListViewCompletedPix[5] ); 159 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 160 p.drawRect( 0,0,11,11);
151 p.drawLine ( 2, 5, 4 , 7 ) ; 161 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 162 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 163 int iii = 0;
154 for ( iii = 0; iii < 5; ++iii ) { 164 for ( iii = 0; iii < 5; ++iii ) {
155 sgListViewCompletedPix[iii]->resize( 11, 11 ); 165 sgListViewCompletedPix[iii]->resize( 11, 11 );
156 sgListViewCompletedPix[iii]->fill( Qt::white ); 166 sgListViewCompletedPix[iii]->fill( Qt::white );
157 QPainter p ( sgListViewCompletedPix[iii] ); 167 QPainter p ( sgListViewCompletedPix[iii] );
158 p.drawRect( 0,0,11,11); 168 p.drawRect( 0,0,11,11);
159 if ( iii ) 169 if ( iii )
160 p.fillRect( 1,1,iii*2,9,Qt::gray ); 170 p.fillRect( 1,1,iii*2,9,Qt::gray );
161 } 171 }
162 sgListViewJournalPix = &journalPix; 172 sgListViewJournalPix = &journalPix;
163 sgListViewJournalPix->resize( 11, 11 ); 173 sgListViewJournalPix->resize( 11, 11 );
164 sgListViewJournalPix->fill( Qt::white ); 174 sgListViewJournalPix->fill( Qt::white );
165 { 175 {
166 QPainter p ( sgListViewJournalPix ); 176 QPainter p ( sgListViewJournalPix );
167 p.drawRect( 0,0,11,11); 177 p.drawRect( 0,0,11,11);
168 p.drawLine( 2,3,5,3); 178 p.drawLine( 2,3,5,3);
169 p.drawLine( 2,5,8,5); 179 p.drawLine( 2,5,8,5);
170 p.drawLine( 2,7,6,7); 180 p.drawLine( 2,7,6,7);
171 } 181 }
172 } 182 }
173 mAutoSaveDisabled = false; 183 mAutoSaveDisabled = false;
174 mClosed = false; 184 mClosed = false;
175 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 185 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
176 QString confFile = locateLocal("config","korganizerrc"); 186 QString confFile = locateLocal("config","korganizerrc");
177 QFileInfo finf ( confFile ); 187 QFileInfo finf ( confFile );
178 bool showWarning = !finf.exists(); 188 bool showWarning = !finf.exists();
179 setIcon(SmallIcon( "ko24" ) ); 189 setIcon(SmallIcon( "ko24" ) );
180 mBlockAtStartup = true; 190 mBlockAtStartup = true;
181 mFlagKeyPressed = false; 191 mFlagKeyPressed = false;
182 setCaption("KO/Pi"); 192 setCaption("KO/Pi");
183 KOPrefs *p = KOPrefs::instance(); 193 KOPrefs *p = KOPrefs::instance();
184 //KPimGlobalPrefs::instance()->setGlobalConfig(); 194 //KPimGlobalPrefs::instance()->setGlobalConfig();
185 p->mCurrentDisplayedView = 0; 195 p->mCurrentDisplayedView = 0;
186 if ( p->mHourSize > 22 ) 196 if ( p->mHourSize > 22 )
187 p->mHourSize = 22; 197 p->mHourSize = 22;
188 QMainWindow::ToolBarDock tbd; 198 Qt::ToolBarDock tbd;
189 if ( p->mToolBarHor ) { 199 if ( p->mToolBarHor ) {
190 if ( p->mToolBarUp ) 200 if ( p->mToolBarUp )
191 tbd = Bottom; 201 tbd = Qt::Bottom;
192 else 202 else
193 tbd = Top; 203 tbd = Qt::Top;
194 } 204 }
195 else { 205 else {
196 if ( p->mToolBarUp ) 206 if ( p->mToolBarUp )
197 tbd = Right; 207 tbd = Qt::Right;
198 else 208 else
199 tbd = Left; 209 tbd = Qt::Left;
200 } 210 }
201 if ( KOPrefs::instance()->mUseAppColors ) 211 if ( KOPrefs::instance()->mUseAppColors )
202 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 212 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
203 globalFlagBlockStartup = 1; 213 globalFlagBlockStartup = 1;
204 iconToolBar = new QPEToolBar( this ); 214 iconToolBar = new QPEToolBar( this );
205 addToolBar (iconToolBar , tbd ); 215 addToolBar (iconToolBar , tbd );
206 216
207#ifdef DESKTOP_VERSION 217#ifdef DESKTOP_VERSION
208 if ( KOPrefs::instance()->mShowIconFilter ) 218 if ( KOPrefs::instance()->mShowIconFilter )
209#else 219#else
210 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) 220 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) )
211#endif 221#endif
212 222
213{ 223{
214 if ( p->mToolBarHorF ) { 224 if ( p->mToolBarHorF ) {
215 if ( p->mToolBarUpF ) 225 if ( p->mToolBarUpF )
216 tbd = Bottom; 226 tbd = Qt::Bottom;
217 else 227 else
218 tbd = Top; 228 tbd = Qt::Top;
219 } 229 }
220 else { 230 else {
221 if ( p->mToolBarUpF ) 231 if ( p->mToolBarUpF )
222 tbd = Right; 232 tbd = Qt::Right;
223 else 233 else
224 tbd = Left; 234 tbd = Qt::Left;
225 } 235 }
226 filterToolBar = new QPEToolBar ( this ); 236 filterToolBar = new QPEToolBar ( this );
227 filterMenubar = new KMenuBar( 0 ); 237 filterMenubar = new KMenuBar( 0 );
228 QFontMetrics fm ( filterMenubar->font() ); 238 QFontMetrics fm ( filterMenubar->font() );
229#ifndef DESKTOP_VERSION 239#ifndef DESKTOP_VERSION
230 filterToolBar->setFocusPolicy( NoFocus ); 240 filterToolBar->setFocusPolicy( NoFocus );
231 filterMenubar->setFocusPolicy( NoFocus ); 241 filterMenubar->setFocusPolicy( NoFocus );
232#endif 242#endif
233 filterPopupMenu = new QPopupMenu( this ); 243 filterPopupMenu = new Q3PopupMenu( this );
234 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 244 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
235 QString addTest = "A"; 245 QString addTest = "A";
236 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 246 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
237#ifdef DESKTOP_VERSION 247#ifdef DESKTOP_VERSION
238 addTest = "AAAAAABBBCCCx"; 248 addTest = "AAAAAABBBCCCx";
239#else 249#else
240 addTest = "AAAAAx"; 250 addTest = "AAAAAx";
241#endif 251#endif
242 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 252 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
243 addToolBar (filterToolBar , tbd ); 253 addToolBar (filterToolBar , tbd );
244 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 254 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
245 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 255 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
246 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 256 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
247 filterToolBar->hide(); 257 filterToolBar->hide();
248 } else { 258 } else {
249 filterToolBar = 0; 259 filterToolBar = 0;
250 filterMenubar = 0; 260 filterMenubar = 0;
251 filterPopupMenu = 0; 261 filterPopupMenu = 0;
252 } 262 }
253 if ( p->mShowIconOnetoolbar ) { 263 if ( p->mShowIconOnetoolbar ) {
254 viewToolBar = iconToolBar ; 264 viewToolBar = iconToolBar ;
255 navigatorToolBar = iconToolBar ; 265 navigatorToolBar = iconToolBar ;
256 } else { 266 } else {
257#ifndef DESKTOP_VERSION 267#ifndef DESKTOP_VERSION
258 setToolBarsMovable( false ); 268 setToolBarsMovable( false );
259#endif 269#endif
260 if ( p->mToolBarHorV ) { 270 if ( p->mToolBarHorV ) {
261 if ( p->mToolBarUpV ) 271 if ( p->mToolBarUpV )
262 tbd = Bottom; 272 tbd = Qt::Bottom;
263 else 273 else
264 tbd = Top; 274 tbd = Qt::Top;
265 } 275 }
266 else { 276 else {
267 if ( p->mToolBarUpV ) 277 if ( p->mToolBarUpV )
268 tbd = Right; 278 tbd = Qt::Right;
269 else 279 else
270 tbd = Left; 280 tbd = Qt::Left;
271 } 281 }
272 viewToolBar = new QPEToolBar( this ); 282 viewToolBar = new QPEToolBar( this );
273 addToolBar (viewToolBar , tbd ); 283 addToolBar (viewToolBar , tbd );
274 if ( p->mToolBarHorN ) { 284 if ( p->mToolBarHorN ) {
275 if ( p->mToolBarUpN ) 285 if ( p->mToolBarUpN )
276 tbd = Bottom; 286 tbd = Qt::Bottom;
277 else 287 else
278 tbd = Top; 288 tbd = Qt::Top;
279 } 289 }
280 else { 290 else {
281 if ( p->mToolBarUpN ) 291 if ( p->mToolBarUpN )
282 tbd = Right; 292 tbd = Qt::Right;
283 else 293 else
284 tbd = Left; 294 tbd = Qt::Left;
285 } 295 }
286 navigatorToolBar = new QPEToolBar( this ); 296 navigatorToolBar = new QPEToolBar( this );
287 addToolBar (navigatorToolBar , tbd ); 297 addToolBar (navigatorToolBar , tbd );
288 } 298 }
289 299
290 300
291 301
292 mCalendarModifiedFlag = false; 302 mCalendarModifiedFlag = false;
293 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 303 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
294 //splash->setAlignment ( AlignCenter ); 304 //splash->setAlignment ( AlignCenter );
295 //setCentralWidget( splash ); 305 //setCentralWidget( splash );
296#ifndef DESKTOP_VERSION 306#ifndef DESKTOP_VERSION
297 //showMaximized(); 307 //showMaximized();
298#endif 308#endif
299 309
300 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 310 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
301 setDefaultPreferences(); 311 setDefaultPreferences();
302 mCalendar = new CalendarLocal(); 312 mCalendar = new CalendarLocal();
303 mView = new CalendarView( mCalendar, this,"mCalendar " ); 313 mView = new CalendarView( mCalendar, this,"mCalendar " );
304 setCentralWidget( mView ); 314 setCentralWidget( mView );
305 //mView->hide(); 315 //mView->hide();
306 //mView->resize(splash->size() ); 316 //mView->resize(splash->size() );
307 initActions(); 317 initActions();
308 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 318 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
309 mSyncManager->setBlockSave(false); 319 mSyncManager->setBlockSave(false);
310 mView->setSyncManager(mSyncManager); 320 mView->setSyncManager(mSyncManager);
311#ifndef DESKTOP_VERSION 321#ifndef DESKTOP_VERSION
312 iconToolBar->show(); 322 iconToolBar->show();
313 qApp->processEvents(); 323 qApp->processEvents();
314#endif 324#endif
315 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 325 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
316 int vh = height() ; 326 int vh = height() ;
317 int vw = width(); 327 int vw = width();
318 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 328 //qDebug("Toolbar hei %d ",iconToolBar->height() );
319 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 329 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
320 vh -= iconToolBar->height(); 330 vh -= iconToolBar->height();
321 } else { 331 } else {
322 vw -= iconToolBar->height(); 332 vw -= iconToolBar->height();
323 } 333 }
324 //mView->setMaximumSize( splash->size() ); 334 //mView->setMaximumSize( splash->size() );
325 //mView->resize( splash->size() ); 335 //mView->resize( splash->size() );
326 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 336 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
327 mView->readSettings(); 337 mView->readSettings();
328 bool newFile = false; 338 bool newFile = false;
329 if( !QFile::exists( defaultFileName() ) ) { 339 if( !QFile::exists( defaultFileName() ) ) {
330 QFileInfo finfo ( defaultFileName() ); 340 QFileInfo finfo ( defaultFileName() );
331 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 341 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
332 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"; 342 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";
@@ -395,272 +405,272 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
395 //US listen for result adressed from Ka/Pi 405 //US listen for result adressed from Ka/Pi
396 406
397#ifndef DESKTOP_VERSION 407#ifndef DESKTOP_VERSION
398 infrared = 0; 408 infrared = 0;
399#endif 409#endif
400 updateFilterToolbar(); 410 updateFilterToolbar();
401 updateWeek( mView->startDate() ); 411 updateWeek( mView->startDate() );
402 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 412 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
403 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 413 SLOT( updateWeekNum( const KCal::DateList & ) ) );
404 mBRdisabled = false; 414 mBRdisabled = false;
405 //toggleBeamReceive(); 415 //toggleBeamReceive();
406 416
407 setCaption(i18n("Loading calendar files ... please wait" )); 417 setCaption(i18n("Loading calendar files ... please wait" ));
408 mSaveDelay = 0; 418 mSaveDelay = 0;
409 QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); 419 QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() ));
410} 420}
411MainWindow::~MainWindow() 421MainWindow::~MainWindow()
412{ 422{
413 //qDebug("MainWindow::~MainWindow() "); 423 //qDebug("MainWindow::~MainWindow() ");
414 //save toolbar location 424 //save toolbar location
415 delete mCalendar; 425 delete mCalendar;
416 delete mSyncManager; 426 delete mSyncManager;
417#ifndef DESKTOP_VERSION 427#ifndef DESKTOP_VERSION
418 if ( infrared ) 428 if ( infrared )
419 delete infrared; 429 delete infrared;
420#endif 430#endif
421 431
422 432
423} 433}
424 434
425void MainWindow::loadDataAfterStart() 435void MainWindow::loadDataAfterStart()
426{ 436{
427 qDebug("KO: Start loading files..." ); 437 qDebug("KO: Start loading files..." );
428 QTime neededSaveTime = QDateTime::currentDateTime().time(); 438 QTime neededSaveTime = QDateTime::currentDateTime().time();
429 mView->loadCalendars(); 439 mView->loadCalendars();
430 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 440 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
431 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 441 qDebug("KO: Calendar loading time: %d ms",msNeeded );
432 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 442 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
433 mView->setModified( false ); 443 mView->setModified( false );
434 mBlockAtStartup = false; 444 mBlockAtStartup = false;
435 mView->setModified( false ); 445 mView->setModified( false );
436 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 446 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
437 processIncidenceSelection( 0 ); 447 processIncidenceSelection( 0 );
438 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 448 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
439 SLOT( processIncidenceSelection( Incidence * ) ) ); 449 SLOT( processIncidenceSelection( Incidence * ) ) );
440 connect( mView, SIGNAL( modifiedChanged( bool ) ), 450 connect( mView, SIGNAL( modifiedChanged( bool ) ),
441 SLOT( slotModifiedChanged( bool ) ) ); 451 SLOT( slotModifiedChanged( bool ) ) );
442#ifndef DESKTOP_VERSION 452#ifndef DESKTOP_VERSION
443 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 453 connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & )));
444 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); 454 connect( qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT(recieve( const Q3CString&, const QByteArray& )));
445 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); 455 disconnect( qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT(receiveStart( const Q3CString&, const QByteArray& )));
446 if ( !mCStringMess.isEmpty() ) 456 if ( !mCStringMess.isEmpty() )
447 recieve( mCStringMess, mByteData ); 457 recieve( mCStringMess, mByteData );
448#endif 458#endif
449 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 459 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
450} 460}
451 461
452void MainWindow::slotResetFocus() 462void MainWindow::slotResetFocus()
453{ 463{
454 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 464 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
455 mFocusLoop = 3; 465 mFocusLoop = 3;
456 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 466 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
457} 467}
458void MainWindow::slotResetFocusLoop() 468void MainWindow::slotResetFocusLoop()
459{ 469{
460 --mFocusLoop; 470 --mFocusLoop;
461 QWidget* fw = mView->viewManager()->currentView(); 471 QWidget* fw = mView->viewManager()->currentView();
462 if ( fw ) { 472 if ( fw ) {
463 //qDebug("loop "); 473 //qDebug("loop ");
464 fw->setFocus(); 474 fw->setFocus();
465 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 475 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
466 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 476 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
467 } 477 }
468 478
469} 479}
470void MainWindow::disableBR(bool b) 480void MainWindow::disableBR(bool b)
471{ 481{
472#ifndef DESKTOP_VERSION 482#ifndef DESKTOP_VERSION
473 if ( b ) { 483 if ( b ) {
474 if ( infrared ) { 484 if ( infrared ) {
475 toggleBeamReceive(); 485 toggleBeamReceive();
476 mBRdisabled = true; 486 mBRdisabled = true;
477 } 487 }
478 mBRdisabled = true; 488 mBRdisabled = true;
479 } else { 489 } else {
480 if ( mBRdisabled ) { 490 if ( mBRdisabled ) {
481 mBRdisabled = false; 491 mBRdisabled = false;
482 //makes no sense,because other cal ap is probably running 492 //makes no sense,because other cal ap is probably running
483 // toggleBeamReceive(); 493 // toggleBeamReceive();
484 } 494 }
485 } 495 }
486#endif 496#endif
487 497
488} 498}
489bool MainWindow::beamReceiveEnabled() 499bool MainWindow::beamReceiveEnabled()
490{ 500{
491#ifndef DESKTOP_VERSION 501#ifndef DESKTOP_VERSION
492 return ( infrared != 0 ); 502 return ( infrared != 0 );
493#endif 503#endif
494 return false; 504 return false;
495} 505}
496 506
497void MainWindow::toggleBeamReceive() 507void MainWindow::toggleBeamReceive()
498{ 508{
499 if ( mBRdisabled ) 509 if ( mBRdisabled )
500 return; 510 return;
501#ifndef DESKTOP_VERSION 511#ifndef DESKTOP_VERSION
502 if ( infrared ) { 512 if ( infrared ) {
503 qDebug("KO: Disable BeamReceive "); 513 qDebug("KO: Disable BeamReceive ");
504 delete infrared; 514 delete infrared;
505 infrared = 0; 515 infrared = 0;
506 brAction->setOn(false); 516 brAction->setOn(false);
507 return; 517 return;
508 } 518 }
509 qDebug("KO: Enable BeamReceive "); 519 qDebug("KO: Enable BeamReceive ");
510 brAction->setOn(true); 520 brAction->setOn(true);
511 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 521 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& ))); 522 QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(recieve( const Q3CString&, const QByteArray& )));
513#endif 523#endif
514} 524}
515void MainWindow::showMaximized () 525void MainWindow::showMaximized ()
516{ 526{
517#ifndef DESKTOP_VERSION 527#ifndef DESKTOP_VERSION
518 if ( ! globalFlagBlockStartup ) 528 if ( ! globalFlagBlockStartup )
519 if ( mClosed ) 529 if ( mClosed )
520 mView->goToday(); 530 mView->goToday();
521#endif 531#endif
522 QWidget::showMaximized () ; 532 QWidget::showMaximized () ;
523 mClosed = false; 533 mClosed = false;
524} 534}
525 535
526bool MainWindow::askForQuitOnSaveError() 536bool MainWindow::askForQuitOnSaveError()
527{ 537{
528 bool retval = false; 538 bool retval = false;
529 switch( QMessageBox::information( this, "KO/Pi", 539 switch( QMessageBox::information( this, "KO/Pi",
530 i18n("Error saving data") + "!\n" + 540 i18n("Error saving data") + "!\n" +
531 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + 541 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?"), 542 i18n("Do you really want\nto close KO/Pi?"),
533 i18n(" Yes, close "), i18n("No"), 543 i18n(" Yes, close "), i18n("No"),
534 0, 1 ) ) { 544 0, 1 ) ) {
535 case 0: 545 case 0:
536 retval = true; 546 retval = true;
537 break; 547 break;
538 default: 548 default:
539 break; 549 break;
540 } 550 }
541 return retval; 551 return retval;
542} 552}
543bool MainWindow::checkAutosave() 553bool MainWindow::checkAutosave()
544{ 554{
545 bool savedata = true; 555 bool savedata = true;
546 if ( mAutoSaveDisabled && mCalendarModifiedFlag ) { 556 if ( mAutoSaveDisabled && mCalendarModifiedFlag ) {
547 switch( QMessageBox::information( this, "KO/Pi", 557 switch( QMessageBox::information( this, "KO/Pi",
548 i18n("Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?"), 558 i18n("Calendar is modified\nbut Autosave is disabled!\nDo you want\nto save the data?"),
549 i18n("Yes, Save!"), i18n("No"), 559 i18n("Yes, Save!"), i18n("No"),
550 0, 0 ) ) { 560 0, 0 ) ) {
551 case 1: 561 case 1:
552 case 2: 562 case 2:
553 savedata = false; 563 savedata = false;
554 break; 564 break;
555 default: 565 default:
556 break; 566 break;
557 } 567 }
558 } 568 }
559 return savedata; 569 return savedata;
560} 570}
561void MainWindow::closeEvent( QCloseEvent* ce ) 571void MainWindow::closeEvent( QCloseEvent* ce )
562{ 572{
563 if ( ! KOPrefs::instance()->mAskForQuit ) { 573 if ( ! KOPrefs::instance()->mAskForQuit ) {
564 if ( checkAutosave() ) { 574 if ( checkAutosave() ) {
565 saveOnClose(); 575 saveOnClose();
566 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 576 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
567 ce->ignore(); 577 ce->ignore();
568 return; 578 return;
569 } 579 }
570 } 580 }
571 mClosed = true; 581 mClosed = true;
572 ce->accept(); 582 ce->accept();
573 return; 583 return;
574 584
575 } 585 }
576 586
577 switch( QMessageBox::information( this, "KO/Pi", 587 switch( QMessageBox::information( this, "KO/Pi",
578 i18n("Do you really want\nto close KO/Pi?"), 588 i18n("Do you really want\nto close KO/Pi?"),
579 i18n("Close"), i18n("No"), 589 i18n("Close"), i18n("No"),
580 0, 0 ) ) { 590 0, 0 ) ) {
581 case 0: 591 case 0:
582 if ( checkAutosave() ) { 592 if ( checkAutosave() ) {
583 saveOnClose(); 593 saveOnClose();
584 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 594 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
585 ce->ignore(); 595 ce->ignore();
586 return; 596 return;
587 } 597 }
588 } 598 }
589 mClosed = true; 599 mClosed = true;
590 ce->accept(); 600 ce->accept();
591 break; 601 break;
592 case 1: 602 case 1:
593 ce->ignore(); 603 ce->ignore();
594 break; 604 break;
595 case 2: 605 case 2:
596 606
597 default: 607 default:
598 break; 608 break;
599 } 609 }
600 610
601 611
602} 612}
603void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 613void MainWindow::receiveStart( const Q3CString& cmsg, const QByteArray& data )
604{ 614{
605 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 615 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
606 mCStringMess = cmsg; 616 mCStringMess = cmsg;
607 mByteData = data; 617 mByteData = data;
608} 618}
609void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 619void MainWindow::recieve( const Q3CString& cmsg, const QByteArray& data )
610{ 620{
611 QDataStream stream( data, IO_ReadOnly ); 621 QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
612 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 622 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
613 //QString datamess; 623 //QString datamess;
614 //qDebug("message "); 624 //qDebug("message ");
615 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 625 qDebug("KO: QCOP message received: %s ", cmsg.data() );
616 626
617 if ( cmsg == "setDocument(QString)" ) { 627 if ( cmsg == "setDocument(QString)" ) {
618 QDataStream stream( data, IO_ReadOnly ); 628 QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
619 QString fileName; 629 QString fileName;
620 stream >> fileName; 630 stream >> fileName;
621 //qDebug("filename %s ", fileName.latin1()); 631 //qDebug("filename %s ", fileName.latin1());
622 showMaximized(); 632 showMaximized();
623 raise(); 633 raise();
624 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 634 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
625 mSyncManager->slotSyncMenu( 1002 ); 635 mSyncManager->slotSyncMenu( 1002 );
626 return; 636 return;
627 } 637 }
628 638
629 if ( cmsg == "-writeFile" ) { 639 if ( cmsg == "-writeFile" ) {
630 // I made from the "-writeFile" an "-writeAlarm" 640 // I made from the "-writeFile" an "-writeAlarm"
631 mView->viewManager()->showWhatsNextView(); 641 mView->viewManager()->showWhatsNextView();
632 mCalendar->checkAlarmForIncidence( 0, true); 642 mCalendar->checkAlarmForIncidence( 0, true);
633 showMaximized(); 643 showMaximized();
634 raise(); 644 raise();
635 return; 645 return;
636 646
637 } 647 }
638 if ( cmsg == "-writeFileSilent" ) { 648 if ( cmsg == "-writeFileSilent" ) {
639 // I made from the "-writeFile" an "-writeAlarm" 649 // I made from the "-writeFile" an "-writeAlarm"
640 // mView->viewManager()->showWhatsNextView(); 650 // mView->viewManager()->showWhatsNextView();
641 mCalendar->checkAlarmForIncidence( 0, true); 651 mCalendar->checkAlarmForIncidence( 0, true);
642 //showMaximized(); 652 //showMaximized();
643 //raise(); 653 //raise();
644 //hide(); 654 //hide();
645 return; 655 return;
646 } 656 }
647 if ( cmsg == "-newCountdown" ) { 657 if ( cmsg == "-newCountdown" ) {
648 qDebug("newCountdown "); 658 qDebug("newCountdown ");
649 659
650 } 660 }
651 QString msg ; 661 QString msg ;
652 QString allmsg = cmsg; 662 QString allmsg = cmsg;
653 while ( allmsg.length() > 0 ) { 663 while ( allmsg.length() > 0 ) {
654 int nextC = allmsg.find( "-", 1 ); 664 int nextC = allmsg.find( "-", 1 );
655 if ( nextC == -1 ) { 665 if ( nextC == -1 ) {
656 msg = allmsg; 666 msg = allmsg;
657 allmsg = ""; 667 allmsg = "";
658 } else{ 668 } else{
659 msg = allmsg.left( nextC ); 669 msg = allmsg.left( nextC );
660 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 670 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
661 } 671 }
662 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 672 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
663 if ( msg == "-newEvent" ) { 673 if ( msg == "-newEvent" ) {
664 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 674 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
665 } 675 }
666 if ( msg == "-newTodo" ) { 676 if ( msg == "-newTodo" ) {
@@ -699,762 +709,762 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
699 mView->viewManager()->showWhatsNextView(); 709 mView->viewManager()->showWhatsNextView();
700 } 710 }
701 else if ( msg == "nextView()" ) { 711 else if ( msg == "nextView()" ) {
702 mView->viewManager()->showNextView(); 712 mView->viewManager()->showNextView();
703 } 713 }
704 else if ( msg == "-showNextXView" ) { 714 else if ( msg == "-showNextXView" ) {
705 mView->viewManager()->showNextXView(); 715 mView->viewManager()->showNextXView();
706 } 716 }
707 717
708 718
709 } 719 }
710 720
711 showMaximized(); 721 showMaximized();
712 raise(); 722 raise();
713} 723}
714void MainWindow::startMultiSync() 724void MainWindow::startMultiSync()
715{ 725{
716 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 726 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
717 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 727 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
718 question, 728 question,
719 i18n("Yes"), i18n("No"), 729 i18n("Yes"), i18n("No"),
720 0, 0 ) != 0 ) { 730 0, 0 ) != 0 ) {
721 setCaption(i18n("Aborted! Nothing synced!")); 731 setCaption(i18n("Aborted! Nothing synced!"));
722 return; 732 return;
723 } 733 }
724 mSyncManager->multiSync( false ); 734 mSyncManager->multiSync( false );
725#ifndef DESKTOP_VERSION 735#ifndef DESKTOP_VERSION
726 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 736 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
727#endif 737#endif
728} 738}
729QPixmap MainWindow::loadPixmap( QString name ) 739QPixmap MainWindow::loadPixmap( QString name )
730{ 740{
731 return SmallIcon( name ); 741 return SmallIcon( name );
732 742
733} 743}
734void MainWindow::setUsesBigPixmaps ( bool b ) 744void MainWindow::setUsesBigPixmaps ( bool b )
735{ 745{
736 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 746 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
737 if ( b ) 747 if ( b )
738 qDebug("KO: BigPixmaps are not supported "); 748 qDebug("KO: BigPixmaps are not supported ");
739} 749}
740void MainWindow::initActions() 750void MainWindow::initActions()
741{ 751{
742 //KOPrefs::instance()->mShowFullMenu 752 //KOPrefs::instance()->mShowFullMenu
743 iconToolBar->clear(); 753 iconToolBar->clear();
744 KOPrefs *p = KOPrefs::instance(); 754 KOPrefs *p = KOPrefs::instance();
745 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 755 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
746 756
747 QPopupMenu *viewMenu = new QPopupMenu( this ); 757 Q3PopupMenu *viewMenu = new Q3PopupMenu( this );
748 QPopupMenu *actionMenu = new QPopupMenu( this ); 758 Q3PopupMenu *actionMenu = new Q3PopupMenu( this );
749 mCurrentItemMenu = new QPopupMenu ( this ); 759 mCurrentItemMenu = new Q3PopupMenu ( this );
750 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 760 Q3PopupMenu *nextConflictMenu = new Q3PopupMenu ( this );
751 QPopupMenu *importMenu = new QPopupMenu( this ); 761 Q3PopupMenu *importMenu = new Q3PopupMenu( this );
752 QPopupMenu *importMenu_X = new QPopupMenu( this ); 762 Q3PopupMenu *importMenu_X = new Q3PopupMenu( this );
753 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 763 Q3PopupMenu *exportMenu_X = new Q3PopupMenu( this );
754 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 764 Q3PopupMenu *beamMenu_X = new Q3PopupMenu( this );
755 selectFilterMenu = new QPopupMenu( this ); 765 selectFilterMenu = new Q3PopupMenu( this );
756 selectFilterMenu->setCheckable( true ); 766 selectFilterMenu->setCheckable( true );
757 syncMenu = new QPopupMenu( this ); 767 syncMenu = new Q3PopupMenu( this );
758 configureAgendaMenu = new QPopupMenu( this ); 768 configureAgendaMenu = new Q3PopupMenu( this );
759 configureToolBarMenu = new QPopupMenu( this ); 769 configureToolBarMenu = new Q3PopupMenu( this );
760 QPopupMenu *helpMenu = new QPopupMenu( this ); 770 Q3PopupMenu *helpMenu = new Q3PopupMenu( this );
761 QIconSet icon; 771 QIcon icon;
762 int pixWid = 22, pixHei = 22; 772 int pixWid = 22, pixHei = 22;
763 QString pathString = ""; 773 QString pathString = "";
764 if ( !p->mToolBarMiniIcons ) { 774 if ( !p->mToolBarMiniIcons ) {
765 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 775 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
766 pathString += "icons16/"; 776 pathString += "icons16/";
767 pixWid = 18; pixHei = 16; 777 pixWid = 18; pixHei = 16;
768 } 778 }
769 } else { 779 } else {
770 pathString += "iconsmini/"; 780 pathString += "iconsmini/";
771 pixWid = 18; pixHei = 16; 781 pixWid = 18; pixHei = 16;
772 } 782 }
773 783
774 if ( KOPrefs::instance()->mShowFullMenu ) { 784 if ( KOPrefs::instance()->mShowFullMenu ) {
775 menuBar1 = new KMenuBar( this );//menuBar(); 785 menuBar1 = new KMenuBar( this );//menuBar();
776 //setMenuBar( menuBar1 ); 786 //setMenuBar( menuBar1 );
777 menuBar1->show(); 787 menuBar1->show();
778 menuBar1->insertItem( i18n("File"), importMenu ); 788 menuBar1->insertItem( i18n("File"), importMenu );
779 menuBar1->insertItem( i18n("View"), viewMenu ); 789 menuBar1->insertItem( i18n("View"), viewMenu );
780 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 790 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
781 menuBar1->insertItem( i18n("Action"), actionMenu ); 791 menuBar1->insertItem( i18n("Action"), actionMenu );
782#ifdef DESKTOP_VERSION 792#ifdef DESKTOP_VERSION
783 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 793 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
784 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 794 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
785#else 795#else
786 menuBar1->insertItem( i18n("Sync"), syncMenu ); 796 menuBar1->insertItem( i18n("Sync"), syncMenu );
787 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 797 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
788#endif 798#endif
789 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 799 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
790 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 800 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
791 menuBar1->insertItem( i18n("Help"), helpMenu ); 801 menuBar1->insertItem( i18n("Help"), helpMenu );
792 } else { 802 } else {
793 menuBar1 = new KMenuBar( iconToolBar ); 803 menuBar1 = new KMenuBar( iconToolBar );
794 QPopupMenu *menuBar = new QPopupMenu( this ); 804 Q3PopupMenu *menuBar = new Q3PopupMenu( this );
795 icon = loadPixmap( pathString + "z_menu" ); 805 icon = loadPixmap( pathString + "z_menu" );
796 menuBar1->insertItem( icon.pixmap(), menuBar); 806 menuBar1->insertItem( icon.pixmap(), menuBar);
797 //menuBar1->insertItem( i18n("ME"), menuBar); 807 //menuBar1->insertItem( i18n("ME"), menuBar);
798 menuBar->insertItem( i18n("File"), importMenu ); 808 menuBar->insertItem( i18n("File"), importMenu );
799 menuBar->insertItem( i18n("View"), viewMenu ); 809 menuBar->insertItem( i18n("View"), viewMenu );
800 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 810 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
801 menuBar->insertItem( i18n("Action"), actionMenu ); 811 menuBar->insertItem( i18n("Action"), actionMenu );
802 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 812 menuBar->insertItem( i18n("Synchronize"), syncMenu );
803 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 813 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
804 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 814 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
805 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 815 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
806 menuBar->insertItem( i18n("Help"), helpMenu ); 816 menuBar->insertItem( i18n("Help"), helpMenu );
807 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 817 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
808 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 818 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
809 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 819 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
810 } 820 }
811 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 821 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
812 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 822 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
813 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 823 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
814 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 824 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
815 825
816 826
817 mWeekBgColor = iconToolBar->backgroundColor(); 827 mWeekBgColor = iconToolBar->backgroundColor();
818 mWeekPixmap.resize( pixWid , pixHei ); 828 mWeekPixmap.resize( pixWid , pixHei );
819 mWeekPixmap.fill( mWeekBgColor ); 829 mWeekPixmap.fill( mWeekBgColor );
820 icon = mWeekPixmap; 830 icon = mWeekPixmap;
821 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 831 mWeekAction = new Q3Action( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
822 if ( p-> mShowIconWeekNum ) 832 if ( p-> mShowIconWeekNum )
823 mWeekAction->addTo( iconToolBar ); 833 mWeekAction->addTo( iconToolBar );
824 mWeekFont = font(); 834 mWeekFont = font();
825 835
826 int fontPoint = mWeekFont.pointSize(); 836 int fontPoint = mWeekFont.pointSize();
827 QFontMetrics f( mWeekFont ); 837 QFontMetrics f( mWeekFont );
828 int fontWid = f.width( "30" ); 838 int fontWid = f.width( "30" );
829 while ( fontWid > pixWid ) { 839 while ( fontWid > pixWid ) {
830 --fontPoint; 840 --fontPoint;
831 mWeekFont.setPointSize( fontPoint ); 841 mWeekFont.setPointSize( fontPoint );
832 QFontMetrics f( mWeekFont ); 842 QFontMetrics f( mWeekFont );
833 fontWid = f.width( "30" ); 843 fontWid = f.width( "30" );
834 //qDebug("dec-- "); 844 //qDebug("dec-- ");
835 } 845 }
836 846
837 connect( mWeekAction, SIGNAL( activated() ), 847 connect( mWeekAction, SIGNAL( activated() ),
838 this, SLOT( weekAction() ) ); 848 this, SLOT( weekAction() ) );
839 849
840 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 850 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
841 if ( p->mShowIconFilterview ) { 851 if ( p->mShowIconFilterview ) {
842 icon = loadPixmap( pathString + "filter" ); 852 icon = loadPixmap( pathString + "filter" );
843 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 853 actionFilterMenuTB = new Q3Action( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
844 connect( actionFilterMenuTB, SIGNAL( activated() ), 854 connect( actionFilterMenuTB, SIGNAL( activated() ),
845 this, SLOT( fillFilterMenuTB() ) ); 855 this, SLOT( fillFilterMenuTB() ) );
846 actionFilterMenuTB->addTo( iconToolBar ); 856 actionFilterMenuTB->addTo( iconToolBar );
847 selectFilterMenuTB = new QPopupMenu( this ); 857 selectFilterMenuTB = new Q3PopupMenu( this );
848 selectFilterMenuTB->setCheckable( true ); 858 selectFilterMenuTB->setCheckable( true );
849 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 859 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
850 } 860 }
851 861
852 //#endif 862 //#endif
853 // ****************** 863 // ******************
854 QAction *action; 864 Q3Action *action;
855 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 865 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
856 configureToolBarMenu->setCheckable( true ); 866 configureToolBarMenu->setCheckable( true );
857 867
858 868
859 configureAgendaMenu->setCheckable( true ); 869 configureAgendaMenu->setCheckable( true );
860 int iii ; 870 int iii ;
861 for ( iii = 1;iii<= 10 ;++iii ){ 871 for ( iii = 1;iii<= 10 ;++iii ){
862 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 872 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
863 } 873 }
864 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 874 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
865 875
866 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 876 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
867 this, SLOT( showConfigureAgenda( ) ) ); 877 this, SLOT( showConfigureAgenda( ) ) );
868 icon = loadPixmap( pathString + "today" ); 878 icon = loadPixmap( pathString + "today" );
869 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 879 Q3Action* today_action = new Q3Action( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
870 today_action->addTo( actionMenu ); 880 today_action->addTo( actionMenu );
871 connect( today_action, SIGNAL( activated() ), 881 connect( today_action, SIGNAL( activated() ),
872 mView, SLOT( goToday() ) ); 882 mView, SLOT( goToday() ) );
873 883
874 icon = loadPixmap( pathString + "picker" ); 884 icon = loadPixmap( pathString + "picker" );
875 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 885 Q3Action* dPickerAction = new Q3Action( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
876 dPickerAction->addTo( actionMenu ); 886 dPickerAction->addTo( actionMenu );
877 connect( dPickerAction, SIGNAL( activated() ), 887 connect( dPickerAction, SIGNAL( activated() ),
878 mView, SLOT( showDatePicker() ) ); 888 mView, SLOT( showDatePicker() ) );
879 889
880 icon = loadPixmap( pathString + "search" ); 890 icon = loadPixmap( pathString + "search" );
881 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 891 Q3Action* search_action = new Q3Action( i18n("Search"), icon, i18n("Search..."), 0, this );
882 search_action->addTo( actionMenu ); 892 search_action->addTo( actionMenu );
883 connect( search_action, SIGNAL( activated() ), 893 connect( search_action, SIGNAL( activated() ),
884 mView->dialogManager(), SLOT( showSearchDialog() ) ); 894 mView->dialogManager(), SLOT( showSearchDialog() ) );
885 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 895 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
886 896
887 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 897 action = new Q3Action( "Undo Delete", i18n("All events"), 0, this );
888 action->addTo( nextConflictMenu ); 898 action->addTo( nextConflictMenu );
889 connect( action, SIGNAL( activated() ), 899 connect( action, SIGNAL( activated() ),
890 mView, SLOT( conflictAll() ) ); 900 mView, SLOT( conflictAll() ) );
891 901
892 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 902 action = new Q3Action( "Undo Delete", i18n("Allday events"), 0, this );
893 action->addTo( nextConflictMenu ); 903 action->addTo( nextConflictMenu );
894 connect( action, SIGNAL( activated() ), 904 connect( action, SIGNAL( activated() ),
895 mView, SLOT( conflictAllday() ) ); 905 mView, SLOT( conflictAllday() ) );
896 906
897 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 907 action = new Q3Action( "Undo Delete", i18n("Events with time"), 0, this );
898 action->addTo( nextConflictMenu ); 908 action->addTo( nextConflictMenu );
899 connect( action, SIGNAL( activated() ), 909 connect( action, SIGNAL( activated() ),
900 mView, SLOT( conflictNotAll() ) ); 910 mView, SLOT( conflictNotAll() ) );
901 911
902 actionMenu->insertSeparator(); 912 actionMenu->insertSeparator();
903 913
904 icon = loadPixmap( pathString + "newevent" ); 914 icon = loadPixmap( pathString + "newevent" );
905 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 915 Q3Action* ne_action = new Q3Action( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
906 ne_action->addTo( mCurrentItemMenu ); 916 ne_action->addTo( mCurrentItemMenu );
907 connect( ne_action, SIGNAL( activated() ), 917 connect( ne_action, SIGNAL( activated() ),
908 mView, SLOT( newEvent() ) ); 918 mView, SLOT( newEvent() ) );
909 icon = loadPixmap( pathString + "newtodo" ); 919 icon = loadPixmap( pathString + "newtodo" );
910 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 920 Q3Action* nt_action = new Q3Action( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
911 nt_action->addTo( mCurrentItemMenu ); 921 nt_action->addTo( mCurrentItemMenu );
912 connect( nt_action, SIGNAL( activated() ), 922 connect( nt_action, SIGNAL( activated() ),
913 mView, SLOT( newTodo() ) ); 923 mView, SLOT( newTodo() ) );
914 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 924 mNewSubTodoAction = new Q3Action( "new_subtodo", i18n("New Sub-Todo..."), 0,
915 this ); 925 this );
916 mNewSubTodoAction->addTo( mCurrentItemMenu ); 926 mNewSubTodoAction->addTo( mCurrentItemMenu );
917 connect( mNewSubTodoAction, SIGNAL( activated() ), 927 connect( mNewSubTodoAction, SIGNAL( activated() ),
918 mView, SLOT( newSubTodo() ) ); 928 mView, SLOT( newSubTodo() ) );
919 929
920 mCurrentItemMenu->insertSeparator(); 930 mCurrentItemMenu->insertSeparator();
921 icon = loadPixmap( pathString + "newevent" ); 931 icon = loadPixmap( pathString + "newevent" );
922 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 932 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
923 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 933 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
924 configureToolBarMenu->insertSeparator(); 934 configureToolBarMenu->insertSeparator();
925 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 935 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
926 configureToolBarMenu->insertSeparator(); 936 configureToolBarMenu->insertSeparator();
927 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 937 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
928 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 938 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
929 icon = loadPixmap( pathString + "newtodo" ); 939 icon = loadPixmap( pathString + "newtodo" );
930 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 940 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
931 941
932 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 942 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
933 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 943 mShowAction = new Q3Action( "show_incidence", i18n("Show"), 0, this );
934 mShowAction->addTo( mCurrentItemMenu ); 944 mShowAction->addTo( mCurrentItemMenu );
935 connect( mShowAction, SIGNAL( activated() ), 945 connect( mShowAction, SIGNAL( activated() ),
936 mView, SLOT( showIncidence() ) ); 946 mView, SLOT( showIncidence() ) );
937 947
938 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 948 mEditAction = new Q3Action( "edit_incidence", i18n("Edit..."), 0, this );
939 mEditAction->addTo( mCurrentItemMenu ); 949 mEditAction->addTo( mCurrentItemMenu );
940 connect( mEditAction, SIGNAL( activated() ), 950 connect( mEditAction, SIGNAL( activated() ),
941 mView, SLOT( editIncidence() ) ); 951 mView, SLOT( editIncidence() ) );
942 952
943 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 953 mDeleteAction = new Q3Action( "delete_incidence", i18n("Delete..."), 0, this );
944 mDeleteAction->addTo( mCurrentItemMenu ); 954 mDeleteAction->addTo( mCurrentItemMenu );
945 connect( mDeleteAction, SIGNAL( activated() ), 955 connect( mDeleteAction, SIGNAL( activated() ),
946 mView, SLOT( deleteIncidence() ) ); 956 mView, SLOT( deleteIncidence() ) );
947 957
948 958
949 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 959 mCloneAction = new Q3Action( "clone_incidence", i18n("Clone..."), 0, this );
950 mCloneAction->addTo( mCurrentItemMenu ); 960 mCloneAction->addTo( mCurrentItemMenu );
951 connect( mCloneAction, SIGNAL( activated() ), 961 connect( mCloneAction, SIGNAL( activated() ),
952 mView, SLOT( cloneIncidence() ) ); 962 mView, SLOT( cloneIncidence() ) );
953 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 963 mMoveAction = new Q3Action( "Move_incidence", i18n("Move..."), 0, this );
954 mMoveAction->addTo( mCurrentItemMenu ); 964 mMoveAction->addTo( mCurrentItemMenu );
955 connect( mMoveAction, SIGNAL( activated() ), 965 connect( mMoveAction, SIGNAL( activated() ),
956 mView, SLOT( moveIncidence() ) ); 966 mView, SLOT( moveIncidence() ) );
957#ifndef DESKTOP_VERSION 967#ifndef DESKTOP_VERSION
958 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 968 mBeamAction = new Q3Action( "Beam_incidence", i18n("Beam..."), 0, this );
959 mBeamAction->addTo(mCurrentItemMenu ); 969 mBeamAction->addTo(mCurrentItemMenu );
960 connect( mBeamAction, SIGNAL( activated() ), 970 connect( mBeamAction, SIGNAL( activated() ),
961 mView, SLOT( beamIncidence() ) ); 971 mView, SLOT( beamIncidence() ) );
962#endif 972#endif
963 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 973 mCancelAction = new Q3Action( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
964 mCancelAction->addTo( mCurrentItemMenu ); 974 mCancelAction->addTo( mCurrentItemMenu );
965 connect( mCancelAction, SIGNAL( activated() ), 975 connect( mCancelAction, SIGNAL( activated() ),
966 mView, SLOT( toggleCancelIncidence() ) ); 976 mView, SLOT( toggleCancelIncidence() ) );
967 977
968 978
969 mCurrentItemMenu->insertSeparator(); 979 mCurrentItemMenu->insertSeparator();
970 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 980 action = new Q3Action( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
971 action->addTo( mCurrentItemMenu ); 981 action->addTo( mCurrentItemMenu );
972 connect( action, SIGNAL( activated() ), 982 connect( action, SIGNAL( activated() ),
973 mView, SLOT( undo_delete() ) ); 983 mView, SLOT( undo_delete() ) );
974 984
975 // *********************** 985 // ***********************
976 if ( KOPrefs::instance()->mVerticalScreen ) { 986 if ( KOPrefs::instance()->mVerticalScreen ) {
977 icon = SmallIcon( "1updownarrow" ); 987 icon = SmallIcon( "1updownarrow" );
978 } else { 988 } else {
979 icon = SmallIcon("1leftrightarrow" ); 989 icon = SmallIcon("1leftrightarrow" );
980 } 990 }
981 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 991 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
982 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 992 Q3Action* FSaction = new Q3Action( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
983 FSaction->addTo( viewMenu ); 993 FSaction->addTo( viewMenu );
984 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 994 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
985 995
986 996
987 icon = loadPixmap( pathString + "filter" ); 997 icon = loadPixmap( pathString + "filter" );
988 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 998 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
989 icon = loadPixmap( pathString + "configure" ); 999 icon = loadPixmap( pathString + "configure" );
990 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 1000 action = new Q3Action( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
991 action->addTo( viewMenu ); 1001 action->addTo( viewMenu );
992 connect( action, SIGNAL( activated() ), 1002 connect( action, SIGNAL( activated() ),
993 mView, SLOT( toggleFilter() ) ); 1003 mView, SLOT( toggleFilter() ) );
994 mToggleFilter = action; 1004 mToggleFilter = action;
995 icon = loadPixmap( pathString + "navi" ); 1005 icon = loadPixmap( pathString + "navi" );
996 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 1006 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
997 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 1007 action = new Q3Action( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
998 action->addTo( viewMenu ); 1008 action->addTo( viewMenu );
999 connect( action, SIGNAL( activated() ), 1009 connect( action, SIGNAL( activated() ),
1000 mView, SLOT( toggleDateNavigatorWidget() ) ); 1010 mView, SLOT( toggleDateNavigatorWidget() ) );
1001 mToggleNav = action ; 1011 mToggleNav = action ;
1002 icon = loadPixmap( pathString + "allday" ); 1012 icon = loadPixmap( pathString + "allday" );
1003 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 1013 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
1004 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 1014 action = new Q3Action( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
1005 action->addTo( viewMenu ); 1015 action->addTo( viewMenu );
1006 connect( action, SIGNAL( activated() ), 1016 connect( action, SIGNAL( activated() ),
1007 mView, SLOT( toggleAllDaySize() ) ); 1017 mView, SLOT( toggleAllDaySize() ) );
1008 mToggleAllday = action; 1018 mToggleAllday = action;
1009 1019
1010 1020
1011 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 1021 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
1012 mToggleNav, SLOT( setEnabled ( bool ) ) ); 1022 mToggleNav, SLOT( setEnabled ( bool ) ) );
1013 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 1023 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
1014 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 1024 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
1015 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 1025 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
1016 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 1026 mToggleAllday, SLOT( setEnabled ( bool ) ) );
1017 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 1027 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
1018 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 1028 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
1019 1029
1020 1030
1021 dPickerAction->addTo( iconToolBar ); 1031 dPickerAction->addTo( iconToolBar );
1022 viewMenu->insertSeparator(); 1032 viewMenu->insertSeparator();
1023 1033
1024 if ( p-> mShowIconToggleFull ) 1034 if ( p-> mShowIconToggleFull )
1025 FSaction->addTo( iconToolBar ); 1035 FSaction->addTo( iconToolBar );
1026 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 1036 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
1027 1037
1028 //******************** 1038 //********************
1029 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 1039 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
1030 1040
1031 1041
1032 icon = loadPixmap( pathString + "whatsnext" ); 1042 icon = loadPixmap( pathString + "whatsnext" );
1033 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 1043 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
1034 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 1044 Q3Action* whatsnext_action = new Q3Action( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
1035 whatsnext_action->addTo( viewMenu ); 1045 whatsnext_action->addTo( viewMenu );
1036 connect( whatsnext_action, SIGNAL( activated() ), 1046 connect( whatsnext_action, SIGNAL( activated() ),
1037 mView->viewManager(), SLOT( showWhatsNextView() ) ); 1047 mView->viewManager(), SLOT( showWhatsNextView() ) );
1038 1048
1039 icon = loadPixmap( pathString + "xdays" ); 1049 icon = loadPixmap( pathString + "xdays" );
1040 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 1050 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
1041 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 1051 Q3Action* xdays_action = new Q3Action( i18n("Next days"), icon, i18n("Next days"), 0, this );
1042 xdays_action->addTo( viewMenu ); 1052 xdays_action->addTo( viewMenu );
1043 connect( xdays_action, SIGNAL( activated() ), 1053 connect( xdays_action, SIGNAL( activated() ),
1044 mView->viewManager(), SLOT( showNextXView() ) ); 1054 mView->viewManager(), SLOT( showNextXView() ) );
1045 1055
1046 1056
1047 icon = loadPixmap( pathString + "journal" ); 1057 icon = loadPixmap( pathString + "journal" );
1048 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 1058 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
1049 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 1059 Q3Action* viewjournal_action = new Q3Action( i18n("Journal"), icon, i18n("Journal"), 0, this );
1050 viewjournal_action->addTo( viewMenu ); 1060 viewjournal_action->addTo( viewMenu );
1051 connect( viewjournal_action, SIGNAL( activated() ), 1061 connect( viewjournal_action, SIGNAL( activated() ),
1052 mView->viewManager(), SLOT( showJournalView() ) ); 1062 mView->viewManager(), SLOT( showJournalView() ) );
1053 1063
1054 1064
1055 icon = loadPixmap( pathString + "day" ); 1065 icon = loadPixmap( pathString + "day" );
1056 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 1066 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
1057 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 1067 Q3Action* day1_action = new Q3Action( i18n("Day View"), icon, i18n("Day View"), 0, this );
1058 day1_action->addTo( viewMenu ); 1068 day1_action->addTo( viewMenu );
1059 // action->addTo( toolBar ); 1069 // action->addTo( toolBar );
1060 connect( day1_action, SIGNAL( activated() ), 1070 connect( day1_action, SIGNAL( activated() ),
1061 mView->viewManager(), SLOT( showDayView() ) ); 1071 mView->viewManager(), SLOT( showDayView() ) );
1062 1072
1063 icon = loadPixmap( pathString + "workweek" ); 1073 icon = loadPixmap( pathString + "workweek" );
1064 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 1074 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
1065 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 1075 Q3Action* day5_action = new Q3Action( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
1066 day5_action->addTo( viewMenu ); 1076 day5_action->addTo( viewMenu );
1067 connect( day5_action, SIGNAL( activated() ), 1077 connect( day5_action, SIGNAL( activated() ),
1068 mView->viewManager(), SLOT( showWorkWeekView() ) ); 1078 mView->viewManager(), SLOT( showWorkWeekView() ) );
1069 1079
1070 icon = loadPixmap( pathString + "week" ); 1080 icon = loadPixmap( pathString + "week" );
1071 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 1081 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
1072 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 1082 Q3Action* day7_action = new Q3Action( i18n("Week"), icon, i18n("Week"), 0, this );
1073 day7_action->addTo( viewMenu ); 1083 day7_action->addTo( viewMenu );
1074 connect( day7_action, SIGNAL( activated() ), 1084 connect( day7_action, SIGNAL( activated() ),
1075 mView->viewManager(), SLOT( showWeekView() ) ); 1085 mView->viewManager(), SLOT( showWeekView() ) );
1076 1086
1077 icon = loadPixmap( pathString + "workweek2" ); 1087 icon = loadPixmap( pathString + "workweek2" );
1078 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1088 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
1079 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1089 Q3Action* day6_action = new Q3Action( i18n("List week"), icon, i18n("List week"), 0, this );
1080 day6_action->addTo( viewMenu ); 1090 day6_action->addTo( viewMenu );
1081 connect( day6_action, SIGNAL( activated() ), 1091 connect( day6_action, SIGNAL( activated() ),
1082 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1092 mView->viewManager(), SLOT( showMonthViewWeek() ) );
1083 1093
1084 icon = loadPixmap( pathString + "month" ); 1094 icon = loadPixmap( pathString + "month" );
1085 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1095 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
1086 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1096 Q3Action* month_action = new Q3Action( i18n("Month"), icon, i18n("Month"), 0, this );
1087 month_action->addTo( viewMenu ); 1097 month_action->addTo( viewMenu );
1088 connect( month_action, SIGNAL( activated() ), 1098 connect( month_action, SIGNAL( activated() ),
1089 mView->viewManager(), SLOT( showMonthView() ) ); 1099 mView->viewManager(), SLOT( showMonthView() ) );
1090 1100
1091 icon = loadPixmap( pathString + "list" ); 1101 icon = loadPixmap( pathString + "list" );
1092 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1102 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1093 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1103 Q3Action* showlist_action = new Q3Action( i18n("List View"), icon, i18n("List View"), 0, this );
1094 showlist_action->addTo( viewMenu ); 1104 showlist_action->addTo( viewMenu );
1095 connect( showlist_action, SIGNAL( activated() ), 1105 connect( showlist_action, SIGNAL( activated() ),
1096 mView->viewManager(), SLOT( showListView() ) ); 1106 mView->viewManager(), SLOT( showListView() ) );
1097 1107
1098 icon = loadPixmap( pathString + "todo" ); 1108 icon = loadPixmap( pathString + "todo" );
1099 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1109 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1100 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1110 Q3Action* todoview_action = new Q3Action( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1101 todoview_action->addTo( viewMenu ); 1111 todoview_action->addTo( viewMenu );
1102 connect( todoview_action, SIGNAL( activated() ), 1112 connect( todoview_action, SIGNAL( activated() ),
1103 mView->viewManager(), SLOT( showTodoView() ) ); 1113 mView->viewManager(), SLOT( showTodoView() ) );
1104 1114
1105 1115
1106 1116
1107#if 0 1117#if 0
1108 action = new QAction( "view_timespan", "Time Span", 0, this ); 1118 action = new Q3Action( "view_timespan", "Time Span", 0, this );
1109 action->addTo( viewMenu ); 1119 action->addTo( viewMenu );
1110 connect( action, SIGNAL( activated() ), 1120 connect( action, SIGNAL( activated() ),
1111 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1121 mView->viewManager(), SLOT( showTimeSpanView() ) );
1112#endif 1122#endif
1113 1123
1114 1124
1115 1125
1116 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1126 action = new Q3Action( "purge_completed", i18n("Purge Completed..."), 0,
1117 this ); 1127 this );
1118 action->addTo( actionMenu ); 1128 action->addTo( actionMenu );
1119 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1129 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1120 1130
1121 1131
1122 icon = loadPixmap( pathString + "search" ); 1132 icon = loadPixmap( pathString + "search" );
1123 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1133 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1124 1134
1125 1135
1126 1136
1127 actionMenu->insertSeparator(); 1137 actionMenu->insertSeparator();
1128 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1138 action = new Q3Action( "manage cat", i18n("Edit category list..."), 0,
1129 this ); 1139 this );
1130 action->addTo( actionMenu ); 1140 action->addTo( actionMenu );
1131 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1141 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1132 1142
1133 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1143 action = new Q3Action( "manage cat", i18n("Manage new categories..."), 0,
1134 this ); 1144 this );
1135 action->addTo( actionMenu ); 1145 action->addTo( actionMenu );
1136 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1146 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1137 1147
1138 1148
1139 actionMenu->insertSeparator(); 1149 actionMenu->insertSeparator();
1140 icon = loadPixmap( pathString + "configure" ); 1150 icon = loadPixmap( pathString + "configure" );
1141 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1151 action = new Q3Action( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1142 action->addTo( actionMenu ); 1152 action->addTo( actionMenu );
1143 connect( action, SIGNAL( activated() ), 1153 connect( action, SIGNAL( activated() ),
1144 mView, SLOT( edit_options() ) ); 1154 mView, SLOT( edit_options() ) );
1145 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1155 action = new Q3Action( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1146 action->addTo( actionMenu ); 1156 action->addTo( actionMenu );
1147 connect( action, SIGNAL( activated() ), 1157 connect( action, SIGNAL( activated() ),
1148 this, SLOT( calHint() ) ); 1158 this, SLOT( calHint() ) );
1149 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1159 action = new Q3Action( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1150 action->addTo( actionMenu ); 1160 action->addTo( actionMenu );
1151 connect( action, SIGNAL( activated() ), 1161 connect( action, SIGNAL( activated() ),
1152 mView, SLOT( edit_global_options() ) ); 1162 mView, SLOT( edit_global_options() ) );
1153 if ( KOPrefs::instance()->mShowFullMenu ) { 1163 if ( KOPrefs::instance()->mShowFullMenu ) {
1154 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1164 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1155 1165
1156 } 1166 }
1157 // actionMenu->insertSeparator(); 1167 // actionMenu->insertSeparator();
1158 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1168 action = new Q3Action( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1159 this ); 1169 this );
1160 action->addTo( importMenu_X ); 1170 action->addTo( importMenu_X );
1161 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1171 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1162 action = new QAction( "import_quick", i18n("Import last file"), 0, 1172 action = new Q3Action( "import_quick", i18n("Import last file"), 0,
1163 this ); 1173 this );
1164 action->addTo( importMenu_X ); 1174 action->addTo( importMenu_X );
1165 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1175 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1166 importMenu_X->insertSeparator(); 1176 importMenu_X->insertSeparator();
1167 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1177 action = new Q3Action( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1168 this ); 1178 this );
1169 action->addTo( importMenu_X ); 1179 action->addTo( importMenu_X );
1170 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1180 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1171 //#ifndef DESKTOP_VERSION 1181 //#ifndef DESKTOP_VERSION
1172 importMenu_X->insertSeparator(); 1182 importMenu_X->insertSeparator();
1173 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1183 action = new Q3Action( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1174 this ); 1184 this );
1175 action->addTo( importMenu_X ); 1185 action->addTo( importMenu_X );
1176 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1186 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1177 //#else 1187 //#else
1178#ifdef _OL_IMPORT_ 1188#ifdef _OL_IMPORT_
1179 importMenu_X->insertSeparator(); 1189 importMenu_X->insertSeparator();
1180 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1190 action = new Q3Action( "import_ol", i18n("Import from OL"), 0,
1181 this ); 1191 this );
1182 action->addTo( importMenu_X ); 1192 action->addTo( importMenu_X );
1183 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1193 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1184#endif 1194#endif
1185 //#endif 1195 //#endif
1186 1196
1187 //importMenu->insertSeparator(); 1197 //importMenu->insertSeparator();
1188#if 0 1198#if 0
1189 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1199 action = new Q3Action( "load_cal", i18n("Load Calendar Backup"), 0,
1190 this ); 1200 this );
1191 action->addTo( importMenu ); 1201 action->addTo( importMenu );
1192 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1202 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1193#endif 1203#endif
1194 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1204 action = new Q3Action( "save_cal", i18n("Save Backup..."), 0,
1195 this ); 1205 this );
1196 action->addTo( importMenu ); 1206 action->addTo( importMenu );
1197 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1207 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1198 importMenu->insertSeparator(); 1208 importMenu->insertSeparator();
1199 importMenu->insertItem( i18n("Import"), importMenu_X ); 1209 importMenu->insertItem( i18n("Import"), importMenu_X );
1200 //importMenu->insertSeparator(); 1210 //importMenu->insertSeparator();
1201 action = new QAction( "export ical", i18n("Export All Data"), 0, 1211 action = new Q3Action( "export ical", i18n("Export All Data"), 0,
1202 this ); 1212 this );
1203 action->addTo( exportMenu_X ); 1213 action->addTo( exportMenu_X );
1204 connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); 1214 connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) );
1205 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1215 action = new Q3Action( "import_qtopia", i18n("Export VCalendar"), 0,
1206 this ); 1216 this );
1207 action->addTo( exportMenu_X ); 1217 action->addTo( exportMenu_X );
1208 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1218 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1209 1219
1210 1220
1211 //LR 1221 //LR
1212 QPopupMenu *ex2phone = new QPopupMenu( this ); 1222 Q3PopupMenu *ex2phone = new Q3PopupMenu( this );
1213 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1223 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1214 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1224 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1215 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1225 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1216 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1226 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1217 1227
1218 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1228 importMenu->insertItem( i18n("Export"), exportMenu_X );
1219 mPrintSelAction = 0; 1229 mPrintSelAction = 0;
1220#ifndef DESKTOP_VERSION 1230#ifndef DESKTOP_VERSION
1221 //importMenu->insertSeparator(); 1231 //importMenu->insertSeparator();
1222 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1232 brAction = new Q3Action( "beam toggle", i18n("Beam receive enabled"), 0,
1223 this ); 1233 this );
1224 brAction->addTo( beamMenu_X ); 1234 brAction->addTo( beamMenu_X );
1225 brAction->setToggleAction (true ) ; 1235 brAction->setToggleAction (true ) ;
1226 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1236 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1227 1237
1228 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1238 action = new Q3Action( "beam all", i18n("Beam complete calendar..."), 0,
1229 this ); 1239 this );
1230 action->addTo( beamMenu_X ); 1240 action->addTo( beamMenu_X );
1231 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1241 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1232 1242
1233 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1243 action = new Q3Action( "beam all", i18n("Beam filtered calendar..."), 0,
1234 this ); 1244 this );
1235 action->addTo( beamMenu_X ); 1245 action->addTo( beamMenu_X );
1236 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1246 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1237 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1247 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1238#else 1248#else
1239 //importMenu->insertSeparator(); 1249 //importMenu->insertSeparator();
1240 icon = loadPixmap( pathString + "print" ); 1250 icon = loadPixmap( pathString + "print" );
1241 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1251 action = new Q3Action( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1242 action->addTo( beamMenu_X ); 1252 action->addTo( beamMenu_X );
1243 connect( action, SIGNAL( activated() ), 1253 connect( action, SIGNAL( activated() ),
1244 this, SLOT( printCal() ) ); 1254 this, SLOT( printCal() ) );
1245 1255
1246 icon = loadPixmap( pathString + "week" ); 1256 icon = loadPixmap( pathString + "week" );
1247 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1257 action = new Q3Action( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1248 action->addTo( beamMenu_X ); 1258 action->addTo( beamMenu_X );
1249 connect( action, SIGNAL( activated() ), 1259 connect( action, SIGNAL( activated() ),
1250 this, SLOT( printSel() ) ); 1260 this, SLOT( printSel() ) );
1251 icon = loadPixmap( pathString + "whatsnext" ); 1261 icon = loadPixmap( pathString + "whatsnext" );
1252 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1262 action = new Q3Action( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1253 action->addTo( beamMenu_X ); 1263 action->addTo( beamMenu_X );
1254 connect( action, SIGNAL( activated() ), 1264 connect( action, SIGNAL( activated() ),
1255 mView->viewManager(), SLOT( slotprintWNV() ) ); 1265 mView->viewManager(), SLOT( slotprintWNV() ) );
1256 1266
1257 1267
1258 icon = loadPixmap( pathString + "list" ); 1268 icon = loadPixmap( pathString + "list" );
1259 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1269 action = new Q3Action( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1260 action->addTo( beamMenu_X ); 1270 action->addTo( beamMenu_X );
1261 connect( action, SIGNAL( activated() ), 1271 connect( action, SIGNAL( activated() ),
1262 this, SLOT( printListView() ) ); 1272 this, SLOT( printListView() ) );
1263 1273
1264 icon = loadPixmap( pathString + "newevent" ); 1274 icon = loadPixmap( pathString + "newevent" );
1265 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1275 action = new Q3Action( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1266 action->addTo( beamMenu_X ); 1276 action->addTo( beamMenu_X );
1267 connect( action, SIGNAL( activated() ), 1277 connect( action, SIGNAL( activated() ),
1268 mView, SLOT( slotprintSelInc() ) ); 1278 mView, SLOT( slotprintSelInc() ) );
1269 mPrintSelAction = action; 1279 mPrintSelAction = action;
1270 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1280 importMenu->insertItem( i18n("Print"), beamMenu_X );
1271#endif 1281#endif
1272 1282
1273 importMenu->insertSeparator(); 1283 importMenu->insertSeparator();
1274 action = new QAction( "beam all", i18n("Save"), 0, 1284 action = new Q3Action( "beam all", i18n("Save"), 0,
1275 this ); 1285 this );
1276 action->addTo( importMenu ); 1286 action->addTo( importMenu );
1277 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1287 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1278 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1288 action = new Q3Action( "beam all", i18n("Exit (+save)"), 0,
1279 this ); 1289 this );
1280 action->addTo( importMenu ); 1290 action->addTo( importMenu );
1281 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1291 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1282 1292
1283 //menuBar->insertItem( "Configure",configureMenu ); 1293 //menuBar->insertItem( "Configure",configureMenu );
1284 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1294 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1285 icon = loadPixmap( "korganizer/korganizer" ); 1295 icon = loadPixmap( "korganizer/korganizer" );
1286 1296
1287 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1297 action = new Q3Action( "Whats New", i18n("What's new?"), 0,this );
1288 action->addTo( helpMenu ); 1298 action->addTo( helpMenu );
1289 connect( action, SIGNAL( activated() ), 1299 connect( action, SIGNAL( activated() ),
1290 SLOT( whatsNew() ) ); 1300 SLOT( whatsNew() ) );
1291 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1301 action = new Q3Action( "featureHowto", i18n("Features + hints..."), 0,this );
1292 action->addTo( helpMenu ); 1302 action->addTo( helpMenu );
1293 connect( action, SIGNAL( activated() ), 1303 connect( action, SIGNAL( activated() ),
1294 SLOT( features() ) ); 1304 SLOT( features() ) );
1295 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1305 action = new Q3Action( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1296 action->addTo( helpMenu ); 1306 action->addTo( helpMenu );
1297 connect( action, SIGNAL( activated() ), 1307 connect( action, SIGNAL( activated() ),
1298 SLOT( keyBindings() ) ); 1308 SLOT( keyBindings() ) );
1299 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1309 action = new Q3Action( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1300 action->addTo( helpMenu ); 1310 action->addTo( helpMenu );
1301 connect( action, SIGNAL( activated() ), 1311 connect( action, SIGNAL( activated() ),
1302 SLOT( storagehowto() ) ); 1312 SLOT( storagehowto() ) );
1303 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1313 action = new Q3Action( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1304 action->addTo( helpMenu ); 1314 action->addTo( helpMenu );
1305 connect( action, SIGNAL( activated() ), 1315 connect( action, SIGNAL( activated() ),
1306 SLOT( timetrackinghowto() ) ); 1316 SLOT( timetrackinghowto() ) );
1307 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1317 action = new Q3Action( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1308 action->addTo( helpMenu ); 1318 action->addTo( helpMenu );
1309 connect( action, SIGNAL( activated() ), 1319 connect( action, SIGNAL( activated() ),
1310 SLOT( synchowto() ) ); 1320 SLOT( synchowto() ) );
1311 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1321 action = new Q3Action( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1312 action->addTo( helpMenu ); 1322 action->addTo( helpMenu );
1313 connect( action, SIGNAL( activated() ), 1323 connect( action, SIGNAL( activated() ),
1314 SLOT( kdesynchowto() ) ); 1324 SLOT( kdesynchowto() ) );
1315 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1325 action = new Q3Action( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1316 action->addTo( helpMenu ); 1326 action->addTo( helpMenu );
1317 connect( action, SIGNAL( activated() ), 1327 connect( action, SIGNAL( activated() ),
1318 SLOT( multisynchowto() ) ); 1328 SLOT( multisynchowto() ) );
1319 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1329 action = new Q3Action( "Auto saving", i18n("Auto saving..."), 0, this );
1320 action->addTo( helpMenu ); 1330 action->addTo( helpMenu );
1321 connect( action, SIGNAL( activated() ), 1331 connect( action, SIGNAL( activated() ),
1322 SLOT( aboutAutoSaving() ) ); 1332 SLOT( aboutAutoSaving() ) );
1323 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1333 action = new Q3Action( "Problemd", i18n("Known Problems..."), 0,this );
1324 action->addTo( helpMenu ); 1334 action->addTo( helpMenu );
1325 connect( action, SIGNAL( activated() ), 1335 connect( action, SIGNAL( activated() ),
1326 SLOT( aboutKnownBugs() ) ); 1336 SLOT( aboutKnownBugs() ) );
1327 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1337 action = new Q3Action( "Translate Howto", i18n("User translation..."), 0,this );
1328 action->addTo( helpMenu ); 1338 action->addTo( helpMenu );
1329 connect( action, SIGNAL( activated() ), 1339 connect( action, SIGNAL( activated() ),
1330 SLOT( usertrans() ) ); 1340 SLOT( usertrans() ) );
1331 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1341 action = new Q3Action( "Frequently asked questions", i18n("FAQ..."), 0,this );
1332 action->addTo( helpMenu ); 1342 action->addTo( helpMenu );
1333 connect( action, SIGNAL( activated() ), 1343 connect( action, SIGNAL( activated() ),
1334 SLOT( faq() ) ); 1344 SLOT( faq() ) );
1335 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1345 action = new Q3Action( "licence", i18n("Licence..."), 0, this );
1336 action->addTo( helpMenu ); 1346 action->addTo( helpMenu );
1337 connect( action, SIGNAL( activated() ), 1347 connect( action, SIGNAL( activated() ),
1338 SLOT( licence() ) ); 1348 SLOT( licence() ) );
1339 action = new QAction( "about", i18n("About..."), 0, this ); 1349 action = new Q3Action( "about", i18n("About..."), 0, this );
1340 action->addTo( helpMenu ); 1350 action->addTo( helpMenu );
1341 connect( action, SIGNAL( activated() ), 1351 connect( action, SIGNAL( activated() ),
1342 SLOT( about() ) ); 1352 SLOT( about() ) );
1343 //menuBar->insertSeparator(); 1353 //menuBar->insertSeparator();
1344 1354
1345 // ****************************************************** 1355 // ******************************************************
1346 // menubar icons 1356 // menubar icons
1347 1357
1348 1358
1349 1359
1350 //menuBar->insertItem( iconToolBar ); 1360 //menuBar->insertItem( iconToolBar );
1351 //xdays_action 1361 //xdays_action
1352 if (p-> mShowIconNewEvent) 1362 if (p-> mShowIconNewEvent)
1353 ne_action->addTo( iconToolBar ); 1363 ne_action->addTo( iconToolBar );
1354 if (p->mShowIconNewTodo ) 1364 if (p->mShowIconNewTodo )
1355 nt_action->addTo( iconToolBar ); 1365 nt_action->addTo( iconToolBar );
1356 if (p-> mShowIconSearch) 1366 if (p-> mShowIconSearch)
1357 search_action->addTo( iconToolBar ); 1367 search_action->addTo( iconToolBar );
1358 if (p-> mShowIconWhatsThis) 1368 if (p-> mShowIconWhatsThis)
1359 QWhatsThis::whatsThisButton ( iconToolBar ); 1369 Q3WhatsThis::whatsThisButton ( iconToolBar );
1360 if (p-> mShowIconNext) 1370 if (p-> mShowIconNext)
1361 whatsnext_action->addTo( viewToolBar ); 1371 whatsnext_action->addTo( viewToolBar );
1362 if (p-> mShowIconNextDays) 1372 if (p-> mShowIconNextDays)
1363 xdays_action->addTo( viewToolBar ); 1373 xdays_action->addTo( viewToolBar );
1364 if (p-> mShowIconJournal) 1374 if (p-> mShowIconJournal)
1365 viewjournal_action->addTo( viewToolBar ); 1375 viewjournal_action->addTo( viewToolBar );
1366 if (p-> mShowIconDay1) 1376 if (p-> mShowIconDay1)
1367 day1_action->addTo( viewToolBar ); 1377 day1_action->addTo( viewToolBar );
1368 if (p-> mShowIconDay5) 1378 if (p-> mShowIconDay5)
1369 day5_action->addTo( viewToolBar ); 1379 day5_action->addTo( viewToolBar );
1370 if (p-> mShowIconDay7) 1380 if (p-> mShowIconDay7)
1371 day7_action->addTo( viewToolBar ); 1381 day7_action->addTo( viewToolBar );
1372 if (p-> mShowIconDay6) 1382 if (p-> mShowIconDay6)
1373 day6_action->addTo( viewToolBar ); 1383 day6_action->addTo( viewToolBar );
1374 if (p-> mShowIconMonth) 1384 if (p-> mShowIconMonth)
1375 month_action->addTo( viewToolBar ); 1385 month_action->addTo( viewToolBar );
1376 if (p-> mShowIconList) 1386 if (p-> mShowIconList)
1377 showlist_action->addTo( viewToolBar ); 1387 showlist_action->addTo( viewToolBar );
1378 if (p-> mShowIconTodoview) 1388 if (p-> mShowIconTodoview)
1379 todoview_action->addTo( viewToolBar ); 1389 todoview_action->addTo( viewToolBar );
1380 1390
1381 icon = loadPixmap( pathString + "2leftarrowB" ); 1391 icon = loadPixmap( pathString + "2leftarrowB" );
1382 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1392 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1383 if (p-> mShowIconBackFast) { 1393 if (p-> mShowIconBackFast) {
1384 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1394 action = new Q3Action( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1385 connect( action, SIGNAL( activated() ), 1395 connect( action, SIGNAL( activated() ),
1386 mView, SLOT( goPreviousMonth() ) ); 1396 mView, SLOT( goPreviousMonth() ) );
1387 action->addTo( navigatorToolBar ); 1397 action->addTo( navigatorToolBar );
1388 } 1398 }
1389 icon = loadPixmap( pathString + "1leftarrowB" ); 1399 icon = loadPixmap( pathString + "1leftarrowB" );
1390 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1400 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1391 if (p-> mShowIconBack) { 1401 if (p-> mShowIconBack) {
1392 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1402 action = new Q3Action( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1393 connect( action, SIGNAL( activated() ), 1403 connect( action, SIGNAL( activated() ),
1394 mView, SLOT( goPrevious() ) ); 1404 mView, SLOT( goPrevious() ) );
1395 action->addTo( navigatorToolBar ); 1405 action->addTo( navigatorToolBar );
1396 } 1406 }
1397 icon = loadPixmap( pathString + "today" ); 1407 icon = loadPixmap( pathString + "today" );
1398 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1408 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1399 if (p-> mShowIconToday) 1409 if (p-> mShowIconToday)
1400 today_action->addTo( navigatorToolBar ); 1410 today_action->addTo( navigatorToolBar );
1401 icon = loadPixmap( pathString + "1rightarrowB" ); 1411 icon = loadPixmap( pathString + "1rightarrowB" );
1402 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1412 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1403 if (p-> mShowIconForward) { 1413 if (p-> mShowIconForward) {
1404 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1414 action = new Q3Action( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1405 connect( action, SIGNAL( activated() ), 1415 connect( action, SIGNAL( activated() ),
1406 mView, SLOT( goNext() ) ); 1416 mView, SLOT( goNext() ) );
1407 action->addTo( navigatorToolBar ); 1417 action->addTo( navigatorToolBar );
1408 } 1418 }
1409 icon = loadPixmap( pathString + "2rightarrowB" ); 1419 icon = loadPixmap( pathString + "2rightarrowB" );
1410 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1420 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1411 if (p-> mShowIconForwardFast) { 1421 if (p-> mShowIconForwardFast) {
1412 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1422 action = new Q3Action( i18n("Next month"), icon, i18n("Next month"),0 , this );
1413 connect( action, SIGNAL( activated() ), 1423 connect( action, SIGNAL( activated() ),
1414 mView, SLOT( goNextMonth() ) ); 1424 mView, SLOT( goNextMonth() ) );
1415 action->addTo( navigatorToolBar ); 1425 action->addTo( navigatorToolBar );
1416 } 1426 }
1417 1427
1418 1428
1419 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1429 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1420 1430
1421 1431
1422 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1432 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1423 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1433 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1424 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1434 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1425 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1435 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1426 1436
1427 if (p-> mShowIconNewEvent) 1437 if (p-> mShowIconNewEvent)
1428 configureToolBarMenu->setItemChecked( 10, true ); 1438 configureToolBarMenu->setItemChecked( 10, true );
1429 if (p->mShowIconNewTodo ) 1439 if (p->mShowIconNewTodo )
1430 configureToolBarMenu->setItemChecked( 20, true ); 1440 configureToolBarMenu->setItemChecked( 20, true );
1431 if (p-> mShowIconSearch) 1441 if (p-> mShowIconSearch)
1432 configureToolBarMenu->setItemChecked( 120, true ); 1442 configureToolBarMenu->setItemChecked( 120, true );
1433 if (p-> mShowIconList) 1443 if (p-> mShowIconList)
1434 configureToolBarMenu->setItemChecked( 30, true ); 1444 configureToolBarMenu->setItemChecked( 30, true );
1435 if (p-> mShowIconDay1) 1445 if (p-> mShowIconDay1)
1436 configureToolBarMenu->setItemChecked( 40, true ); 1446 configureToolBarMenu->setItemChecked( 40, true );
1437 if (p-> mShowIconDay5) 1447 if (p-> mShowIconDay5)
1438 configureToolBarMenu->setItemChecked( 50, true ); 1448 configureToolBarMenu->setItemChecked( 50, true );
1439 if (p-> mShowIconDay6) 1449 if (p-> mShowIconDay6)
1440 configureToolBarMenu->setItemChecked( 75, true ); 1450 configureToolBarMenu->setItemChecked( 75, true );
1441 if (p-> mShowIconDay7) 1451 if (p-> mShowIconDay7)
1442 configureToolBarMenu->setItemChecked( 60, true ); 1452 configureToolBarMenu->setItemChecked( 60, true );
1443 if (p-> mShowIconMonth) 1453 if (p-> mShowIconMonth)
1444 configureToolBarMenu->setItemChecked( 70, true ); 1454 configureToolBarMenu->setItemChecked( 70, true );
1445 if (p-> mShowIconTodoview) 1455 if (p-> mShowIconTodoview)
1446 configureToolBarMenu->setItemChecked( 80, true ); 1456 configureToolBarMenu->setItemChecked( 80, true );
1447 if (p-> mShowIconBackFast) 1457 if (p-> mShowIconBackFast)
1448 configureToolBarMenu->setItemChecked( 200, true ); 1458 configureToolBarMenu->setItemChecked( 200, true );
1449 if (p-> mShowIconBack) 1459 if (p-> mShowIconBack)
1450 configureToolBarMenu->setItemChecked( 210, true ); 1460 configureToolBarMenu->setItemChecked( 210, true );
1451 if (p-> mShowIconToday) 1461 if (p-> mShowIconToday)
1452 configureToolBarMenu->setItemChecked( 130, true ); 1462 configureToolBarMenu->setItemChecked( 130, true );
1453 if (p-> mShowIconForward) 1463 if (p-> mShowIconForward)
1454 configureToolBarMenu->setItemChecked( 220, true ); 1464 configureToolBarMenu->setItemChecked( 220, true );
1455 if (p-> mShowIconForwardFast) 1465 if (p-> mShowIconForwardFast)
1456 configureToolBarMenu->setItemChecked( 230, true ); 1466 configureToolBarMenu->setItemChecked( 230, true );
1457 if (p-> mShowIconNextDays) 1467 if (p-> mShowIconNextDays)
1458 configureToolBarMenu->setItemChecked( 100, true ); 1468 configureToolBarMenu->setItemChecked( 100, true );
1459 if (p-> mShowIconNext) 1469 if (p-> mShowIconNext)
1460 configureToolBarMenu->setItemChecked( 110, true ); 1470 configureToolBarMenu->setItemChecked( 110, true );
@@ -1479,171 +1489,171 @@ void MainWindow::initActions()
1479 navigatorToolBar->setVerticalStretchable (true ); 1489 navigatorToolBar->setVerticalStretchable (true );
1480 configureToolBarMenu->setItemChecked( 5, true ); 1490 configureToolBarMenu->setItemChecked( 5, true );
1481 } 1491 }
1482 if (p-> mShowIconFilter) 1492 if (p-> mShowIconFilter)
1483 configureToolBarMenu->setItemChecked( 7, true ); 1493 configureToolBarMenu->setItemChecked( 7, true );
1484 if (p-> mShowIconOnetoolbar) 1494 if (p-> mShowIconOnetoolbar)
1485 configureToolBarMenu->setItemChecked( 6, true ); 1495 configureToolBarMenu->setItemChecked( 6, true );
1486 1496
1487 1497
1488 if ( filterMenubar ) { 1498 if ( filterMenubar ) {
1489 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1499 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1490 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1500 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1491 } 1501 }
1492 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1502 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1493 configureAgenda( p->mHourSize ); 1503 configureAgenda( p->mHourSize );
1494 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1504 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1495} 1505}
1496void MainWindow::calHint() 1506void MainWindow::calHint()
1497{ 1507{
1498 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>."); 1508 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>.");
1499 1509
1500 KMessageBox::information( this, message); 1510 KMessageBox::information( this, message);
1501} 1511}
1502void MainWindow::exportToPhone( int mode ) 1512void MainWindow::exportToPhone( int mode )
1503{ 1513{
1504 1514
1505 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1515 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1506 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1516 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1507 KOex2phonePrefs ex2phone; 1517 KOex2phonePrefs ex2phone;
1508 1518
1509 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1519 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1510 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1520 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1511 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1521 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1512 if ( mode == 1 ) 1522 if ( mode == 1 )
1513 ex2phone.setCaption(i18n("Export complete calendar")); 1523 ex2phone.setCaption(i18n("Export complete calendar"));
1514 if ( mode == 2 ) 1524 if ( mode == 2 )
1515 ex2phone.setCaption(i18n("Export filtered calendar")); 1525 ex2phone.setCaption(i18n("Export filtered calendar"));
1516 1526
1517 if ( !ex2phone.exec() ) { 1527 if ( !ex2phone.exec() ) {
1518 return; 1528 return;
1519 } 1529 }
1520 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1530 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1521 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1531 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1522 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1532 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1523 1533
1524 int inFuture = 0; 1534 int inFuture = 0;
1525 if ( ex2phone.mWriteBackFuture->isChecked() ) 1535 if ( ex2phone.mWriteBackFuture->isChecked() )
1526 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1536 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1527 QPtrList<Incidence> delSel; 1537 Q3PtrList<Incidence> delSel;
1528 if ( mode == 1 ) 1538 if ( mode == 1 )
1529 delSel = mCalendar->rawIncidences(); 1539 delSel = mCalendar->rawIncidences();
1530 if ( mode == 2 ) 1540 if ( mode == 2 )
1531 delSel = mCalendar->incidences(); 1541 delSel = mCalendar->incidences();
1532 CalendarLocal* cal = new CalendarLocal(); 1542 CalendarLocal* cal = new CalendarLocal();
1533 cal->setLocalTime(); 1543 cal->setLocalTime();
1534 Incidence *incidence = delSel.first(); 1544 Incidence *incidence = delSel.first();
1535 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1545 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1536 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1546 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1537 while ( incidence ) { 1547 while ( incidence ) {
1538 if ( incidence->typeID() != journalID ) { 1548 if ( incidence->typeID() != journalID ) {
1539 bool add = true; 1549 bool add = true;
1540 if ( inFuture ) { 1550 if ( inFuture ) {
1541 QDateTime dt; 1551 QDateTime dt;
1542 if ( incidence->typeID() == todoID ) { 1552 if ( incidence->typeID() == todoID ) {
1543 Todo * t = (Todo*)incidence; 1553 Todo * t = (Todo*)incidence;
1544 if ( t->hasDueDate() ) 1554 if ( t->hasDueDate() )
1545 dt = t->dtDue(); 1555 dt = t->dtDue();
1546 else 1556 else
1547 dt = cur.addSecs( 62 ); 1557 dt = cur.addSecs( 62 );
1548 } 1558 }
1549 else { 1559 else {
1550 bool ok; 1560 bool ok;
1551 dt = incidence->getNextOccurence( cur, &ok ); 1561 dt = incidence->getNextOccurence( cur, &ok );
1552 if ( !ok ) 1562 if ( !ok )
1553 dt = cur.addSecs( -62 ); 1563 dt = cur.addSecs( -62 );
1554 } 1564 }
1555 if ( dt < cur || dt > end ) { 1565 if ( dt < cur || dt > end ) {
1556 add = false; 1566 add = false;
1557 } 1567 }
1558 } 1568 }
1559 if ( add ) { 1569 if ( add ) {
1560 Incidence *in = incidence->clone(); 1570 Incidence *in = incidence->clone();
1561 cal->addIncidence( in ); 1571 cal->addIncidence( in );
1562 } 1572 }
1563 } 1573 }
1564 incidence = delSel.next(); 1574 incidence = delSel.next();
1565 } 1575 }
1566 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1576 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1567 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1577 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1568 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1578 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1569 1579
1570 setCaption( i18n("Writing to phone...")); 1580 setCaption( i18n("Writing to phone..."));
1571 if ( PhoneFormat::writeToPhone( cal ) ) 1581 if ( PhoneFormat::writeToPhone( cal ) )
1572 setCaption( i18n("Export to phone successful!")); 1582 setCaption( i18n("Export to phone successful!"));
1573 else 1583 else
1574 setCaption( i18n("Error exporting to phone!")); 1584 setCaption( i18n("Error exporting to phone!"));
1575 delete cal; 1585 delete cal;
1576} 1586}
1577 1587
1578 1588
1579void MainWindow::setDefaultPreferences() 1589void MainWindow::setDefaultPreferences()
1580{ 1590{
1581 KOPrefs *p = KOPrefs::instance(); 1591 KOPrefs *p = KOPrefs::instance();
1582 1592
1583 p->mCompactDialogs = true; 1593 p->mCompactDialogs = true;
1584 p->mConfirm = true; 1594 p->mConfirm = true;
1585 // p->mEnableQuickTodo = false; 1595 // p->mEnableQuickTodo = false;
1586 1596
1587} 1597}
1588 1598
1589QString MainWindow::resourcePath() 1599QString MainWindow::resourcePath()
1590{ 1600{
1591 return KGlobal::iconLoader()->iconPath(); 1601 return KGlobal::iconLoader()->iconPath();
1592} 1602}
1593 1603
1594void MainWindow::displayText( QString text ,QString cap ) 1604void MainWindow::displayText( QString text ,QString cap )
1595{ 1605{
1596 QDialog dia( this, "name", true ); ; 1606 QDialog dia( this, "name", true ); ;
1597 dia.setCaption( cap ); 1607 dia.setCaption( cap );
1598 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1608 Q3VBoxLayout* lay = new Q3VBoxLayout( &dia );
1599 lay->setSpacing( 3 ); 1609 lay->setSpacing( 3 );
1600 lay->setMargin( 3 ); 1610 lay->setMargin( 3 );
1601 QTextBrowser tb ( &dia ); 1611 Q3TextBrowser tb ( &dia );
1602 lay->addWidget( &tb ); 1612 lay->addWidget( &tb );
1603 tb.setText( text ); 1613 tb.setText( text );
1604#ifdef DESKTOP_VERSION 1614#ifdef DESKTOP_VERSION
1605 dia.resize( 640, 480); 1615 dia.resize( 640, 480);
1606#else 1616#else
1607 dia.showMaximized(); 1617 dia.showMaximized();
1608#endif 1618#endif
1609 dia.exec(); 1619 dia.exec();
1610} 1620}
1611 1621
1612void MainWindow::features() 1622void MainWindow::features()
1613{ 1623{
1614 1624
1615 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1625 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1616} 1626}
1617 1627
1618void MainWindow::usertrans() 1628void MainWindow::usertrans()
1619{ 1629{
1620 1630
1621 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1631 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1622} 1632}
1623 1633
1624void MainWindow::storagehowto() 1634void MainWindow::storagehowto()
1625{ 1635{
1626 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1636 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1627} 1637}
1628void MainWindow::timetrackinghowto() 1638void MainWindow::timetrackinghowto()
1629{ 1639{
1630 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1640 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1631} 1641}
1632void MainWindow::kdesynchowto() 1642void MainWindow::kdesynchowto()
1633{ 1643{
1634 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1644 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1635} 1645}
1636void MainWindow::multisynchowto() 1646void MainWindow::multisynchowto()
1637{ 1647{
1638 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1648 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1639} 1649}
1640void MainWindow::synchowto() 1650void MainWindow::synchowto()
1641{ 1651{
1642 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1652 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1643} 1653}
1644void MainWindow::faq() 1654void MainWindow::faq()
1645{ 1655{
1646 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1656 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1647 1657
1648} 1658}
1649void MainWindow::whatsNew() 1659void MainWindow::whatsNew()
@@ -1732,172 +1742,172 @@ void MainWindow::keyBindings()
1732 i18n("<p><b>White</b>: Item readonly</p>\n"); 1742 i18n("<p><b>White</b>: Item readonly</p>\n");
1733 displayText( text, cap); 1743 displayText( text, cap);
1734} 1744}
1735void MainWindow::aboutAutoSaving() 1745void MainWindow::aboutAutoSaving()
1736{ 1746{
1737 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"); 1747 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");
1738 1748
1739 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1749 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1740 1750
1741} 1751}
1742void MainWindow::aboutKnownBugs() 1752void MainWindow::aboutKnownBugs()
1743{ 1753{
1744 QMessageBox* msg; 1754 QMessageBox* msg;
1745 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1755 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1746 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")+ 1756 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")+
1747 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1757 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1748 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1758 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1749 i18n("\nor report them in the bugtracker on\n") + 1759 i18n("\nor report them in the bugtracker on\n") +
1750 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1760 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1751 QMessageBox::NoIcon, 1761 QMessageBox::NoIcon,
1752 QMessageBox::Ok, 1762 QMessageBox::Ok,
1753 QMessageBox::NoButton, 1763 QMessageBox::NoButton,
1754 QMessageBox::NoButton); 1764 QMessageBox::NoButton);
1755 msg->exec(); 1765 msg->exec();
1756 delete msg; 1766 delete msg;
1757 1767
1758} 1768}
1759 1769
1760QString MainWindow::defaultFileName() 1770QString MainWindow::defaultFileName()
1761{ 1771{
1762 return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); 1772 return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) );
1763} 1773}
1764QString MainWindow::syncFileName() 1774QString MainWindow::syncFileName()
1765{ 1775{
1766#ifdef DESKTOP_VERSION 1776#ifdef DESKTOP_VERSION
1767 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); 1777 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) );
1768#else 1778#else
1769 return QString( "/tmp/synccalendar.ics" ); 1779 return QString( "/tmp/synccalendar.ics" );
1770#endif 1780#endif
1771} 1781}
1772#include "koglobals.h" 1782#include "koglobals.h"
1773#include <kcalendarsystem.h> 1783#include <kcalendarsystem.h>
1774void MainWindow::updateWeek(QDate seda) 1784void MainWindow::updateWeek(QDate seda)
1775{ 1785{
1776 int weekNum = KGlobal::locale()->weekNum ( seda ); 1786 int weekNum = KGlobal::locale()->weekNum ( seda );
1777 mWeekPixmap.fill( mWeekBgColor ); 1787 mWeekPixmap.fill( mWeekBgColor );
1778 QPainter p ( &mWeekPixmap ); 1788 QPainter p ( &mWeekPixmap );
1779 p.setFont( mWeekFont ); 1789 p.setFont( mWeekFont );
1780 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1790 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),Qt::AlignCenter, QString::number( weekNum) );
1781 p.end(); 1791 p.end();
1782 QIconSet icon3 ( mWeekPixmap ); 1792 QIcon icon3 ( mWeekPixmap );
1783 mWeekAction->setIconSet ( icon3 ); 1793 mWeekAction->setIconSet ( icon3 );
1784 1794
1785} 1795}
1786void MainWindow::updateWeekNum(const DateList &selectedDates) 1796void MainWindow::updateWeekNum(const DateList &selectedDates)
1787{ 1797{
1788 updateWeek( selectedDates.first() ); 1798 updateWeek( selectedDates.first() );
1789} 1799}
1790void MainWindow::processIncidenceSelection( Incidence *incidence ) 1800void MainWindow::processIncidenceSelection( Incidence *incidence )
1791{ 1801{
1792 if ( !incidence ) { 1802 if ( !incidence ) {
1793 mShowAction->setMenuText( i18n("Show") ); 1803 mShowAction->setMenuText( i18n("Show") );
1794 enableIncidenceActions( false ); 1804 enableIncidenceActions( false );
1795 mNewSubTodoAction->setEnabled( false ); 1805 mNewSubTodoAction->setEnabled( false );
1796 setCaptionToDates(); 1806 setCaptionToDates();
1797 return; 1807 return;
1798 } 1808 }
1799 QString startString = ""; 1809 QString startString = "";
1800 if ( incidence->typeID() != todoID ) { 1810 if ( incidence->typeID() != todoID ) {
1801 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1811 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1802 if ( incidence->doesFloat() ) { 1812 if ( incidence->doesFloat() ) {
1803 startString += ": "+incidence->dtStartDateStr( true ); 1813 startString += ": "+incidence->dtStartDateStr( true );
1804 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1814 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1805 } else { 1815 } else {
1806 startString = ": "+incidence->dtStartStr(true); 1816 startString = ": "+incidence->dtStartStr(true);
1807 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1817 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1808 } 1818 }
1809 } else { 1819 } else {
1810 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1820 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1811 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1821 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1812 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1822 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1813 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1823 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1814 bool ok; 1824 bool ok;
1815 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1825 QDateTime noc = incidence->getNextOccurence( (QDateTime)mView->startDate().addDays(-1), &ok );
1816 if ( ok ) { 1826 if ( ok ) {
1817 int years = noc.date().year() - incidence->dtStart().date().year(); 1827 int years = noc.date().year() - incidence->dtStart().date().year();
1818 startString += i18n(" (%1 y.)"). arg( years ); 1828 startString += i18n(" (%1 y.)"). arg( years );
1819 } 1829 }
1820 } 1830 }
1821 else 1831 else
1822 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1832 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1823 } 1833 }
1824 } 1834 }
1825 else { 1835 else {
1826 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) 1836 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1827 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); 1837 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1828 else 1838 else
1829 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1839 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1830 } 1840 }
1831 if ( !incidence->location().isEmpty() ) 1841 if ( !incidence->location().isEmpty() )
1832 startString += " (" +incidence->location()+")"; 1842 startString += " (" +incidence->location()+")";
1833 setCaption( incidence->summary()+startString); 1843 setCaption( incidence->summary()+startString);
1834 enableIncidenceActions( true ); 1844 enableIncidenceActions( true );
1835 if ( incidence->typeID() == eventID ) { 1845 if ( incidence->typeID() == eventID ) {
1836 mShowAction->setMenuText( i18n("Show Event") ); 1846 mShowAction->setMenuText( i18n("Show Event") );
1837 mNewSubTodoAction->setEnabled( false ); 1847 mNewSubTodoAction->setEnabled( false );
1838 } else if ( incidence->typeID() == todoID ) { 1848 } else if ( incidence->typeID() == todoID ) {
1839 mShowAction->setMenuText( i18n("Show Todo") ); 1849 mShowAction->setMenuText( i18n("Show Todo") );
1840 mNewSubTodoAction->setEnabled( true ); 1850 mNewSubTodoAction->setEnabled( true );
1841 } else { 1851 } else {
1842 mShowAction->setMenuText( i18n("Show") ); 1852 mShowAction->setMenuText( i18n("Show") );
1843 mNewSubTodoAction->setEnabled( false ); 1853 mNewSubTodoAction->setEnabled( false );
1844 } 1854 }
1845#ifdef DESKTOP_VERSION 1855#ifdef DESKTOP_VERSION
1846 static QPixmap jP = SmallIcon( "journal" ); 1856 static QPixmap jP = SmallIcon( "journal" );
1847 static QPixmap eP = SmallIcon( "newevent" ); 1857 static QPixmap eP = SmallIcon( "newevent" );
1848 static QPixmap tP = SmallIcon( "newtodo" ); 1858 static QPixmap tP = SmallIcon( "newtodo" );
1849 QIconSet icon; 1859 QIcon icon;
1850 if ( incidence->typeID() == todoID ) 1860 if ( incidence->typeID() == todoID )
1851 icon = QIconSet ( tP ); 1861 icon = QIcon ( tP );
1852 else if ( incidence->typeID() == eventID ) 1862 else if ( incidence->typeID() == eventID )
1853 icon = QIconSet ( eP ); 1863 icon = QIcon ( eP );
1854 else if ( incidence->typeID() == journalID ) 1864 else if ( incidence->typeID() == journalID )
1855 icon = QIconSet ( jP ); 1865 icon = QIcon ( jP );
1856 mPrintSelAction->setIconSet ( icon ); 1866 mPrintSelAction->setIconSet ( icon );
1857#endif 1867#endif
1858} 1868}
1859 1869
1860void MainWindow::enableIncidenceActions( bool enabled ) 1870void MainWindow::enableIncidenceActions( bool enabled )
1861{ 1871{
1862 mShowAction->setEnabled( enabled ); 1872 mShowAction->setEnabled( enabled );
1863 mEditAction->setEnabled( enabled ); 1873 mEditAction->setEnabled( enabled );
1864 mDeleteAction->setEnabled( enabled ); 1874 mDeleteAction->setEnabled( enabled );
1865 1875
1866 mCloneAction->setEnabled( enabled ); 1876 mCloneAction->setEnabled( enabled );
1867 mMoveAction->setEnabled( enabled ); 1877 mMoveAction->setEnabled( enabled );
1868#ifndef DESKTOP_VERSION 1878#ifndef DESKTOP_VERSION
1869 mBeamAction->setEnabled( enabled ); 1879 mBeamAction->setEnabled( enabled );
1870#else 1880#else
1871 mPrintSelAction->setEnabled( enabled ); 1881 mPrintSelAction->setEnabled( enabled );
1872#endif 1882#endif
1873 mCancelAction->setEnabled( enabled ); 1883 mCancelAction->setEnabled( enabled );
1874} 1884}
1875 1885
1876void MainWindow::importOL() 1886void MainWindow::importOL()
1877{ 1887{
1878#ifdef _OL_IMPORT_ 1888#ifdef _OL_IMPORT_
1879 mView->clearAllViews(); 1889 mView->clearAllViews();
1880 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1890 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1881 id->exec(); 1891 id->exec();
1882 delete id; 1892 delete id;
1883 mView->calendar()->checkAlarmForIncidence( 0, true ); 1893 mView->calendar()->checkAlarmForIncidence( 0, true );
1884 mView->updateView(); 1894 mView->updateView();
1885#endif 1895#endif
1886} 1896}
1887void MainWindow::importBday() 1897void MainWindow::importBday()
1888{ 1898{
1889 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1899 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1890 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1900 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1891 i18n("Import!"), i18n("Cancel"), 0, 1901 i18n("Import!"), i18n("Cancel"), 0,
1892 0, 1 ); 1902 0, 1 );
1893 if ( result == 0 ) { 1903 if ( result == 0 ) {
1894 mView->importBday(); 1904 mView->importBday();
1895 1905
1896 } 1906 }
1897 1907
1898 1908
1899} 1909}
1900void MainWindow::importQtopia() 1910void MainWindow::importQtopia()
1901{ 1911{
1902 //#ifndef DESKTOP_VERSION 1912 //#ifndef DESKTOP_VERSION
1903 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"); 1913 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");
@@ -2000,97 +2010,97 @@ void MainWindow::slotModifiedChanged( bool )
2000 } 2010 }
2001 if ( mCalendarModifiedFlag ) { 2011 if ( mCalendarModifiedFlag ) {
2002 //qDebug(" MainWindow timer is running "); 2012 //qDebug(" MainWindow timer is running ");
2003 return; 2013 return;
2004 } 2014 }
2005 mCalendarModifiedFlag = true; 2015 mCalendarModifiedFlag = true;
2006 if ( mAutoSaveDisabled ) { 2016 if ( mAutoSaveDisabled ) {
2007 return; 2017 return;
2008 } 2018 }
2009 // we store the changes after 1 minute, 2019 // we store the changes after 1 minute,
2010 // and for safety reasons after 10 minutes again 2020 // and for safety reasons after 10 minutes again
2011 if ( !mSyncManager->blockSave() ) 2021 if ( !mSyncManager->blockSave() )
2012 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 2022 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
2013 else 2023 else
2014 msec = 1000 * 600; 2024 msec = 1000 * 600;
2015 mSaveTimer.start( msec, true ); // 1 minute 2025 mSaveTimer.start( msec, true ); // 1 minute
2016 mSaveTimerStart = QDateTime::currentDateTime(); 2026 mSaveTimerStart = QDateTime::currentDateTime();
2017 mSaveDelay = msec/1000; 2027 mSaveDelay = msec/1000;
2018 qDebug("KO: Saving File in %d secs!", msec/1000); 2028 qDebug("KO: Saving File in %d secs!", msec/1000);
2019} 2029}
2020void MainWindow::autoSaveWarning() 2030void MainWindow::autoSaveWarning()
2021{ 2031{
2022 setCaption(i18n("Autosave disabled!" )); 2032 setCaption(i18n("Autosave disabled!" ));
2023} 2033}
2024void MainWindow::saveStopTimer() 2034void MainWindow::saveStopTimer()
2025{ 2035{
2026 mSaveTimer.stop(); 2036 mSaveTimer.stop();
2027 mSaveDelay = 0; 2037 mSaveDelay = 0;
2028} 2038}
2029void MainWindow::backupAllFiles() 2039void MainWindow::backupAllFiles()
2030{ 2040{
2031 QDate reference ( 2000,1,1); 2041 QDate reference ( 2000,1,1);
2032 int daysTo = reference.daysTo ( QDate::currentDate() ); 2042 int daysTo = reference.daysTo ( QDate::currentDate() );
2033 setCaption(i18n("Creating backup ... please wait ..." )); 2043 setCaption(i18n("Creating backup ... please wait ..." ));
2034 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 2044 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
2035 // we need the file path, the backup dir and the number of bups as param 2045 // we need the file path, the backup dir and the number of bups as param
2036 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2046 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2037 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2047 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2038 bupDir = KGlobalSettings::backupDataDir(); 2048 bupDir = KGlobalSettings::backupDataDir();
2039 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 2049 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
2040 if ( retval == 0 ) { 2050 if ( retval == 0 ) {
2041 setCaption(i18n("Backup cancelled" )); 2051 setCaption(i18n("Backup cancelled" ));
2042 qDebug("KO: Backup cancelled. Will try again tomorrow "); 2052 qDebug("KO: Backup cancelled. Will try again tomorrow ");
2043 // retval == 0 : backup skipped for today, try again tomorrow 2053 // retval == 0 : backup skipped for today, try again tomorrow
2044 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 2054 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
2045 } else if ( retval == 1 ){ 2055 } else if ( retval == 1 ){
2046 qDebug("KO: Backup created."); 2056 qDebug("KO: Backup created.");
2047 // backup ok 2057 // backup ok
2048 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2058 Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2049 KopiCalendarFile * cal = calendars.first(); 2059 KopiCalendarFile * cal = calendars.first();
2050 cal = calendars.next(); 2060 cal = calendars.next();
2051 while ( cal ) { 2061 while ( cal ) {
2052 if ( !cal->mErrorOnLoad ) { 2062 if ( !cal->mErrorOnLoad ) {
2053 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 2063 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
2054 } 2064 }
2055 cal = calendars.next(); 2065 cal = calendars.next();
2056 } 2066 }
2057 KOPrefs::instance()->mLastBackupDate = daysTo; 2067 KOPrefs::instance()->mLastBackupDate = daysTo;
2058 setCaption(i18n("Backup succesfully finished" )); 2068 setCaption(i18n("Backup succesfully finished" ));
2059 } else if ( retval == 2 ){ 2069 } else if ( retval == 2 ){
2060 setCaption(i18n("Backup globally disabled" )); 2070 setCaption(i18n("Backup globally disabled" ));
2061 qDebug("KO: Backup globally cancelled."); 2071 qDebug("KO: Backup globally cancelled.");
2062 // backup globally cancelled 2072 // backup globally cancelled
2063 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2073 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2064 } 2074 }
2065 // retval == 3: do nothing, try again later 2075 // retval == 3: do nothing, try again later
2066} 2076}
2067void MainWindow::save() 2077void MainWindow::save()
2068{ 2078{
2069 if ( mSaveDelay ) { 2079 if ( mSaveDelay ) {
2070 int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); 2080 int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() );
2071 if ( mSaveDelay < elapsed ) { 2081 if ( mSaveDelay < elapsed ) {
2072 qDebug("KO: Pending save after wakeup from suspend detected."); 2082 qDebug("KO: Pending save after wakeup from suspend detected.");
2073 qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); 2083 qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed );
2074 qDebug("KO: Restarting save timer to save in 10 sec."); 2084 qDebug("KO: Restarting save timer to save in 10 sec.");
2075 int msec = 10000; 2085 int msec = 10000;
2076 mSaveTimer.start( msec, true ); 2086 mSaveTimer.start( msec, true );
2077 mSaveTimerStart = QDateTime::currentDateTime(); 2087 mSaveTimerStart = QDateTime::currentDateTime();
2078 mSaveDelay = msec/1000; 2088 mSaveDelay = msec/1000;
2079 return; 2089 return;
2080 } 2090 }
2081 } 2091 }
2082 if ( mView->viewManager()->journalView() ) 2092 if ( mView->viewManager()->journalView() )
2083 mView->viewManager()->journalView()->checkModified(); 2093 mView->viewManager()->journalView()->checkModified();
2084 if ( !mCalendarModifiedFlag ) { 2094 if ( !mCalendarModifiedFlag ) {
2085 qDebug("KO: Calendar not modified. Nothing saved."); 2095 qDebug("KO: Calendar not modified. Nothing saved.");
2086 return; 2096 return;
2087 } 2097 }
2088 if ( mSyncManager->blockSave() ) { 2098 if ( mSyncManager->blockSave() ) {
2089 slotModifiedChanged( true ); 2099 slotModifiedChanged( true );
2090 return; 2100 return;
2091 } 2101 }
2092#ifndef DESKTOP_VERSION 2102#ifndef DESKTOP_VERSION
2093 // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); 2103 // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable );
2094#endif 2104#endif
2095 mSaveDelay = 0; 2105 mSaveDelay = 0;
2096 mSyncManager->setBlockSave(true); 2106 mSyncManager->setBlockSave(true);
@@ -2296,163 +2306,163 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
2296 mView->conflictAllday(); 2306 mView->conflictAllday();
2297 else 2307 else
2298 mView->conflictAll(); 2308 mView->conflictAll();
2299 break; 2309 break;
2300 case Qt::Key_J: 2310 case Qt::Key_J:
2301 mView->viewManager()->showJournalView(); 2311 mView->viewManager()->showJournalView();
2302 break; 2312 break;
2303 case Qt::Key_B: 2313 case Qt::Key_B:
2304 mView->editIncidenceDescription();; 2314 mView->editIncidenceDescription();;
2305 break; 2315 break;
2306 // case Qt::Key_Return: 2316 // case Qt::Key_Return:
2307 case Qt::Key_E: 2317 case Qt::Key_E:
2308 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2318 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2309 mView->newEvent(); 2319 mView->newEvent();
2310 else 2320 else
2311 mView->editIncidence(); 2321 mView->editIncidence();
2312 break; 2322 break;
2313 case Qt::Key_Plus: 2323 case Qt::Key_Plus:
2314 size = p->mHourSize +2; 2324 size = p->mHourSize +2;
2315 if ( size <= 22 ) 2325 if ( size <= 22 )
2316 configureAgenda( size ); 2326 configureAgenda( size );
2317 break; 2327 break;
2318 case Qt::Key_Minus: 2328 case Qt::Key_Minus:
2319 size = p->mHourSize - 2; 2329 size = p->mHourSize - 2;
2320 if ( size >= 4 ) 2330 if ( size >= 4 )
2321 configureAgenda( size ); 2331 configureAgenda( size );
2322 break; 2332 break;
2323 2333
2324 2334
2325 default: 2335 default:
2326 e->ignore(); 2336 e->ignore();
2327 } 2337 }
2328 if ( pro > 0 ) { 2338 if ( pro > 0 ) {
2329 selectFilter( pro+1 ); 2339 selectFilter( pro+1 );
2330 } 2340 }
2331 if ( showSelectedDates ) { 2341 if ( showSelectedDates ) {
2332 ;// setCaptionToDates(); 2342 ;// setCaptionToDates();
2333 } 2343 }
2334 2344
2335} 2345}
2336void MainWindow::fillFilterMenuTB() 2346void MainWindow::fillFilterMenuTB()
2337{ 2347{
2338 selectFilterMenuTB->clear(); 2348 selectFilterMenuTB->clear();
2339 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2349 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2340 selectFilterMenuTB->insertSeparator(); 2350 selectFilterMenuTB->insertSeparator();
2341 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2351 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2342 2352
2343 selectFilterMenuTB->insertSeparator(); 2353 selectFilterMenuTB->insertSeparator();
2344 QPtrList<CalFilter> fili = mView->filters(); 2354 Q3PtrList<CalFilter> fili = mView->filters();
2345 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2355 CalFilter *curfilter = mView->filterView()->selectedFilter();
2346 CalFilter *filter = fili.first(); 2356 CalFilter *filter = fili.first();
2347 int iii = 2; 2357 int iii = 2;
2348 bool checkitem = mView->filterView()->filtersEnabled(); 2358 bool checkitem = mView->filterView()->filtersEnabled();
2349 while(filter) { 2359 while(filter) {
2350 selectFilterMenuTB->insertItem( filter->name(), iii ); 2360 selectFilterMenuTB->insertItem( filter->name(), iii );
2351 if ( filter == curfilter) 2361 if ( filter == curfilter)
2352 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2362 selectFilterMenuTB->setItemChecked( iii, checkitem );
2353 filter = fili.next(); 2363 filter = fili.next();
2354 ++iii; 2364 ++iii;
2355 } 2365 }
2356 if ( !checkitem ) 2366 if ( !checkitem )
2357 selectFilterMenuTB->setItemChecked( 1, true ); 2367 selectFilterMenuTB->setItemChecked( 1, true );
2358 2368
2359 int x = 0; 2369 int x = 0;
2360 int y = iconToolBar->height(); 2370 int y = iconToolBar->height();
2361 int dX = 0; 2371 int dX = 0;
2362 int dY = 0; 2372 int dY = 0;
2363 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2373 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2364 if ( iconToolBar->y() > height()/2 ) { 2374 if ( iconToolBar->y() > height()/2 ) {
2365 dY = selectFilterMenuTB->sizeHint().height()+8; 2375 dY = selectFilterMenuTB->sizeHint().height()+8;
2366 y = 0; 2376 y = 0;
2367 } 2377 }
2368 } else { 2378 } else {
2369 if ( iconToolBar->x() > width()/2 ) { // right side 2379 if ( iconToolBar->x() > width()/2 ) { // right side
2370 x=0; 2380 x=0;
2371 dX= selectFilterMenuTB->sizeHint().width()+8; 2381 dX= selectFilterMenuTB->sizeHint().width()+8;
2372 y = 0; 2382 y = 0;
2373 } else { 2383 } else {
2374 x= iconToolBar->width(); 2384 x= iconToolBar->width();
2375 y = 0; 2385 y = 0;
2376 } 2386 }
2377 } 2387 }
2378 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2388 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2379 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2389 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2380} 2390}
2381void MainWindow::fillFilterMenu() 2391void MainWindow::fillFilterMenu()
2382{ 2392{
2383 selectFilterMenu->clear(); 2393 selectFilterMenu->clear();
2384 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2394 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2385 selectFilterMenu->insertSeparator(); 2395 selectFilterMenu->insertSeparator();
2386 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2396 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2387 2397
2388 selectFilterMenu->insertSeparator(); 2398 selectFilterMenu->insertSeparator();
2389 QPtrList<CalFilter> fili = mView->filters(); 2399 Q3PtrList<CalFilter> fili = mView->filters();
2390 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2400 CalFilter *curfilter = mView->filterView()->selectedFilter();
2391 CalFilter *filter = fili.first(); 2401 CalFilter *filter = fili.first();
2392 int iii = 2; 2402 int iii = 2;
2393 bool checkitem = mView->filterView()->filtersEnabled(); 2403 bool checkitem = mView->filterView()->filtersEnabled();
2394 while(filter) { 2404 while(filter) {
2395 selectFilterMenu->insertItem( filter->name(), iii ); 2405 selectFilterMenu->insertItem( filter->name(), iii );
2396 if ( filter == curfilter) 2406 if ( filter == curfilter)
2397 selectFilterMenu->setItemChecked( iii, checkitem ); 2407 selectFilterMenu->setItemChecked( iii, checkitem );
2398 filter = fili.next(); 2408 filter = fili.next();
2399 ++iii; 2409 ++iii;
2400 } 2410 }
2401 if ( !checkitem ) 2411 if ( !checkitem )
2402 selectFilterMenu->setItemChecked( 1, true ); 2412 selectFilterMenu->setItemChecked( 1, true );
2403} 2413}
2404void MainWindow::fillFilterMenuPopup() 2414void MainWindow::fillFilterMenuPopup()
2405{ 2415{
2406 filterPopupMenu->clear(); 2416 filterPopupMenu->clear();
2407 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2417 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2408 2418
2409 filterPopupMenu->insertSeparator(); 2419 filterPopupMenu->insertSeparator();
2410 QPtrList<CalFilter> fili = mView->filters(); 2420 Q3PtrList<CalFilter> fili = mView->filters();
2411 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2421 CalFilter *curfilter = mView->filterView()->selectedFilter();
2412 CalFilter *filter = fili.first(); 2422 CalFilter *filter = fili.first();
2413 int iii = 1; 2423 int iii = 1;
2414 bool checkitem = mView->filterView()->filtersEnabled(); 2424 bool checkitem = mView->filterView()->filtersEnabled();
2415 while(filter) { 2425 while(filter) {
2416 filterPopupMenu->insertItem( filter->name(), iii ); 2426 filterPopupMenu->insertItem( filter->name(), iii );
2417 if ( filter == curfilter) 2427 if ( filter == curfilter)
2418 filterPopupMenu->setItemChecked( iii, checkitem ); 2428 filterPopupMenu->setItemChecked( iii, checkitem );
2419 filter = fili.next(); 2429 filter = fili.next();
2420 ++iii; 2430 ++iii;
2421 } 2431 }
2422 if ( !checkitem ) 2432 if ( !checkitem )
2423 filterPopupMenu->setItemChecked( 0, true ); 2433 filterPopupMenu->setItemChecked( 0, true );
2424} 2434}
2425void MainWindow::selectFilter( int fil ) 2435void MainWindow::selectFilter( int fil )
2426{ 2436{
2427 2437
2428 if ( fil == 0 ) { 2438 if ( fil == 0 ) {
2429 mView->editFilters( ); 2439 mView->editFilters( );
2430 } else if ( fil == 1 ){ 2440 } else if ( fil == 1 ){
2431 if ( mView->filterView()->filtersEnabled() ) 2441 if ( mView->filterView()->filtersEnabled() )
2432 mView->toggleFilerEnabled( ); 2442 mView->toggleFilerEnabled( );
2433 } else { 2443 } else {
2434 if ( !mView->filterView()->filtersEnabled() ) { 2444 if ( !mView->filterView()->filtersEnabled() ) {
2435 mView->filterView()->blockSignals( true ); 2445 mView->filterView()->blockSignals( true );
2436 mView->toggleFilerEnabled( ); 2446 mView->toggleFilerEnabled( );
2437 mView->filterView()->blockSignals( false ); 2447 mView->filterView()->blockSignals( false );
2438 } 2448 }
2439 mView->selectFilter( fil-2 ); 2449 mView->selectFilter( fil-2 );
2440 } 2450 }
2441} 2451}
2442void MainWindow::updateFilterToolbar() 2452void MainWindow::updateFilterToolbar()
2443{ 2453{
2444 if ( filterMenubar ) { 2454 if ( filterMenubar ) {
2445 if ( !mView->filterView()->filtersEnabled() ) { 2455 if ( !mView->filterView()->filtersEnabled() ) {
2446 filterMenubar->changeItem( 0, i18n("No Filter") ); 2456 filterMenubar->changeItem( 0, i18n("No Filter") );
2447 } else { 2457 } else {
2448 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2458 CalFilter *curfilter = mView->filterView()->selectedFilter();
2449 if ( curfilter ) { 2459 if ( curfilter ) {
2450 QString name = curfilter->name(); 2460 QString name = curfilter->name();
2451 if ( name.length() > 12 ) 2461 if ( name.length() > 12 )
2452 name = name.left(10)+"..."; 2462 name = name.left(10)+"...";
2453 filterMenubar->changeItem( 0, name ); 2463 filterMenubar->changeItem( 0, name );
2454 } 2464 }
2455 } 2465 }
2456 } 2466 }
2457} 2467}
2458void MainWindow::selectFilterPopup( int fil ) 2468void MainWindow::selectFilterPopup( int fil )
@@ -2774,50 +2784,50 @@ void MainWindow::weekAction()
2774 if ( iconToolBar->y() > height()/2 ) { 2784 if ( iconToolBar->y() > height()/2 ) {
2775 dY = picker->sizeHint().height()+8; 2785 dY = picker->sizeHint().height()+8;
2776 y = 0; 2786 y = 0;
2777 } 2787 }
2778 } else { 2788 } else {
2779 if ( iconToolBar->x() > width()/2 ) { // right side 2789 if ( iconToolBar->x() > width()/2 ) { // right side
2780 x=0; 2790 x=0;
2781 dX= picker->sizeHint().width()+8; 2791 dX= picker->sizeHint().width()+8;
2782 y = 0; 2792 y = 0;
2783 } else { 2793 } else {
2784 x= iconToolBar->width(); 2794 x= iconToolBar->width();
2785 y = 0; 2795 y = 0;
2786 } 2796 }
2787 } 2797 }
2788 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2798 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2789 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2799 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2790 { 2800 {
2791 month = picker->getResult(); 2801 month = picker->getResult();
2792 emit selectWeek ( month ); 2802 emit selectWeek ( month );
2793 //qDebug("weekSelected %d ", month); 2803 //qDebug("weekSelected %d ", month);
2794 } 2804 }
2795 delete popup; 2805 delete popup;
2796} 2806}
2797 2807
2798void MainWindow::hideEvent ( QHideEvent * ) 2808void MainWindow::hideEvent ( QHideEvent * )
2799{ 2809{
2800 QString message; 2810 QString message;
2801 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2811 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2802 if ( nextA.isValid() ) { 2812 if ( nextA.isValid() ) {
2803 QString sum = mCalendar->nextSummary(); 2813 QString sum = mCalendar->nextSummary();
2804 2814
2805 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2815 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2806 setCaption( message ); 2816 setCaption( message );
2807 } 2817 }
2808} 2818}
2809 2819
2810void MainWindow::resizeEvent( QResizeEvent* e) 2820void MainWindow::resizeEvent( QResizeEvent* e)
2811{ 2821{
2812#ifndef DESKTOP_VERSION 2822#ifndef DESKTOP_VERSION
2813 if ( filterToolBar ) { 2823 if ( filterToolBar ) {
2814 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2824 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2815 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2825 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2816 filterToolBar->hide(); 2826 filterToolBar->hide();
2817 else 2827 else
2818 filterToolBar->show(); 2828 filterToolBar->show();
2819 } 2829 }
2820 } 2830 }
2821#endif 2831#endif
2822 QMainWindow::resizeEvent( e); 2832 Q3MainWindow::resizeEvent( e);
2823} 2833}