summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/main.cpp1
-rw-r--r--korganizer/mainwindow.cpp6
2 files changed, 3 insertions, 4 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 6339370..a96f7c2 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,115 +1,114 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#include <stdlib.h> 14#include <stdlib.h>
15#endif 15#endif
16#include <qtextcodec.h> 16#include <qtextcodec.h>
17 17
18#include <qdir.h> 18#include <qdir.h>
19#include <kstandarddirs.h> 19#include <kstandarddirs.h>
20#include <kglobal.h> 20#include <kglobal.h>
21#include <stdio.h> 21#include <stdio.h>
22#include "mainwindow.h" 22#include "mainwindow.h"
23#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
24void dumpMissing(); 24void dumpMissing();
25 25
26 26
27int main( int argc, char **argv ) 27int main( int argc, char **argv )
28{ 28{
29#ifndef DESKTOP_VERSION 29#ifndef DESKTOP_VERSION
30 QPEApplication a( argc, argv ); 30 QPEApplication a( argc, argv );
31 a.setKeepRunning (); 31 a.setKeepRunning ();
32#else 32#else
33 QApplication a( argc, argv ); 33 QApplication a( argc, argv );
34 QApplication::setStyle( new QPlatinumStyle ()); 34 QApplication::setStyle( new QPlatinumStyle ());
35#ifdef _WIN32_ 35#ifdef _WIN32_
36 QString hdir ( getenv( "HOME") ); 36 QString hdir ( getenv( "HOME") );
37 if ( hdir.isEmpty() ) { 37 if ( hdir.isEmpty() ) {
38 QString hd ("C:/" ); 38 QString hd ("C:/" );
39 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); 39 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
40 if ( QDir::homeDirPath().lower() == hd.lower() ) { 40 if ( QDir::homeDirPath().lower() == hd.lower() ) {
41 _putenv( "HOME=C:"); 41 _putenv( "HOME=C:");
42 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); 42 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
43 } 43 }
44 } else { 44 } else {
45 QDir app_dir; 45 QDir app_dir;
46 if ( !app_dir.exists(hdir) ) 46 if ( !app_dir.exists(hdir) )
47 app_dir.mkdir (hdir); 47 app_dir.mkdir (hdir);
48 } 48 }
49#endif 49#endif
50#endif 50#endif
51 bool exitHelp = false; 51 bool exitHelp = false;
52 if ( argc > 1 ) { 52 if ( argc > 1 ) {
53 QString command = argv[1]; 53 QString command = argv[1];
54 if ( command == "-help" ){ 54 if ( command == "-help" ){
55 printf("KO/Pi command line commands:\n"); 55 printf("KO/Pi command line commands:\n");
56 printf(" no command: Start KO/Pi in usual way\n"); 56 printf(" no command: Start KO/Pi in usual way\n");
57 printf(" -help: This output\n"); 57 printf(" -help: This output\n");
58 printf("Next Option: Open or Show after start:\n"); 58 printf("Next Option: Open or Show after start:\n");
59 printf(" -newTodo: New Todo dialog\n"); 59 printf(" -newTodo: New Todo dialog\n");
60 printf(" -newEvent: New Event dialog\n"); 60 printf(" -newEvent: New Event dialog\n");
61 printf(" -showList: List view\n"); 61 printf(" -showList: List view\n");
62 printf(" -showDay: Day view\n"); 62 printf(" -showDay: Day view\n");
63 printf(" -showWWeek: Work Week view\n"); 63 printf(" -showWWeek: Work Week view\n");
64 printf(" -showWeek: Week view\n"); 64 printf(" -showWeek: Week view\n");
65 printf(" -showTodo: Todo view\n"); 65 printf(" -showTodo: Todo view\n");
66 printf(" -showJournal: Journal view\n"); 66 printf(" -showJournal: Journal view\n");
67 printf(" -showKO: Next Days view\n"); 67 printf(" -showKO: Next Days view\n");
68 printf(" -showWNext: What's Next view\n"); 68 printf(" -showWNext: What's Next view\n");
69 printf(" -showNextXView: Next X View\n"); 69 printf(" -showNextXView: Next X View\n");
70 printf(" -new[Y] and -show[X] may be used togehther\n"); 70 printf(" -new[Y] and -show[X] may be used togehther\n");
71 printf(" KO/Pi is exiting now. Bye!\n"); 71 printf(" KO/Pi is exiting now. Bye!\n");
72 exitHelp = true; 72 exitHelp = true;
73 } 73 }
74 } 74 }
75 if ( ! exitHelp ) { 75 if ( ! exitHelp ) {
76 KGlobal::setAppName( "korganizer" ); 76 KGlobal::setAppName( "korganizer" );
77 QString fileName ; 77 QString fileName ;
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 fileName = getenv("QPEDIR"); 79 fileName = getenv("QPEDIR");
80 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 80 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
81#else 81#else
82 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 82 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
83 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 83 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
84#endif 84#endif
85 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 85 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
86 86
87 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); 87 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
88 KPimGlobalPrefs::instance()->setGlobalConfig(); 88 KPimGlobalPrefs::instance()->setGlobalConfig();
89 MainWindow m; 89 MainWindow m;
90#ifndef DESKTOP_VERSION 90#ifndef DESKTOP_VERSION
91 91
92 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& ))); 92 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& )));
93 a.showMainWidget(&m ); 93 a.showMainWidget(&m );
94#else 94#else
95 a.setMainWidget(&m ); 95 a.setMainWidget(&m );
96 m.show(); 96 m.show();
97 //m.resize( 800, 600 ); 97 //m.resize( 800, 600 );
98 //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 98 //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
99#endif 99#endif
100 if ( argc > 1 ) { 100 if ( argc > 1 ) {
101 QCString command = argv[1]; 101 QCString command = argv[1];
102 if ( argc > 2 ) 102 if ( argc > 2 )
103 command += argv[2]; 103 command += argv[2];
104 qApp->processEvents();
105 m.recieve(command, QByteArray() ); 104 m.recieve(command, QByteArray() );
106 105
107 } 106 }
108 107
109 a.exec(); 108 a.exec();
110 dumpMissing(); 109 dumpMissing();
111 110
112 KPimGlobalPrefs::instance()->writeConfig(); 111 KPimGlobalPrefs::instance()->writeConfig();
113 } 112 }
114 qDebug("KO: Bye! "); 113 qDebug("KO: Bye! ");
115} 114}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 883a9d1..d1e369c 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1174 +1,1174 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qtopia/alarmserver.h> 27#include <qtopia/alarmserver.h>
28#include <qtopia/qcopenvelope_qws.h> 28#include <qtopia/qcopenvelope_qws.h>
29#include <unistd.h> // for sleep 29#include <unistd.h> // for sleep
30#else 30#else
31#include <qtoolbar.h> 31#include <qtoolbar.h>
32#include <qapplication.h> 32#include <qapplication.h>
33//#include <resource.h> 33//#include <resource.h>
34 34
35#endif 35#endif
36#include <libkcal/calendarlocal.h> 36#include <libkcal/calendarlocal.h>
37#include <libkcal/todo.h> 37#include <libkcal/todo.h>
38#include <libkcal/phoneformat.h> 38#include <libkcal/phoneformat.h>
39#include <libkdepim/ksyncprofile.h> 39#include <libkdepim/ksyncprofile.h>
40#include <libkdepim/phoneaccess.h> 40#include <libkdepim/phoneaccess.h>
41#include <libkcal/kincidenceformatter.h> 41#include <libkcal/kincidenceformatter.h>
42#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
43 43
44#include "calendarview.h" 44#include "calendarview.h"
45#include "koviewmanager.h" 45#include "koviewmanager.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47#include "koagendaview.h" 47#include "koagendaview.h"
48#include "kojournalview.h" 48#include "kojournalview.h"
49#include "koagenda.h" 49#include "koagenda.h"
50#include "kodialogmanager.h" 50#include "kodialogmanager.h"
51#include "kdialogbase.h" 51#include "kdialogbase.h"
52#include "kapplication.h" 52#include "kapplication.h"
53#include "kofilterview.h" 53#include "kofilterview.h"
54#include "kstandarddirs.h" 54#include "kstandarddirs.h"
55#include "koprefs.h" 55#include "koprefs.h"
56#include "kfiledialog.h" 56#include "kfiledialog.h"
57#include "koglobals.h" 57#include "koglobals.h"
58#include "kglobal.h" 58#include "kglobal.h"
59#include "ktoolbar.h" 59#include "ktoolbar.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "externalapphandler.h" 62#include "externalapphandler.h"
63#include <kglobalsettings.h> 63#include <kglobalsettings.h>
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131QPixmap* sgListViewCompletedPix[6]; 131QPixmap* sgListViewCompletedPix[6];
132QPixmap* sgListViewJournalPix; 132QPixmap* sgListViewJournalPix;
133 133
134 134
135int globalFlagBlockStartup; 135int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name ) : 136MainWindow::MainWindow( QWidget *parent, const char *name ) :
137 QMainWindow( parent, name ) 137 QMainWindow( parent, name )
138{ 138{
139 sgListViewCompletedPix[5] = &listviewPix; 139 sgListViewCompletedPix[5] = &listviewPix;
140 sgListViewCompletedPix[0] = &listviewPix0; 140 sgListViewCompletedPix[0] = &listviewPix0;
141 sgListViewCompletedPix[1] = &listviewPix20; 141 sgListViewCompletedPix[1] = &listviewPix20;
142 sgListViewCompletedPix[2] = &listviewPix40; 142 sgListViewCompletedPix[2] = &listviewPix40;
143 sgListViewCompletedPix[3] = &listviewPix60; 143 sgListViewCompletedPix[3] = &listviewPix60;
144 sgListViewCompletedPix[4] = &listviewPix80; 144 sgListViewCompletedPix[4] = &listviewPix80;
145 //int size = 12; 145 //int size = 12;
146 { 146 {
147 sgListViewCompletedPix[5]->resize( 11, 11 ); 147 sgListViewCompletedPix[5]->resize( 11, 11 );
148 sgListViewCompletedPix[5]->fill( Qt::white ); 148 sgListViewCompletedPix[5]->fill( Qt::white );
149 QPainter p ( sgListViewCompletedPix[5] ); 149 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 150 p.drawRect( 0,0,11,11);
151 p.drawLine ( 2, 5, 4 , 7 ) ; 151 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 152 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 153 int iii = 0;
154 for ( iii = 0; iii < 5; ++iii ) { 154 for ( iii = 0; iii < 5; ++iii ) {
155 sgListViewCompletedPix[iii]->resize( 11, 11 ); 155 sgListViewCompletedPix[iii]->resize( 11, 11 );
156 sgListViewCompletedPix[iii]->fill( Qt::white ); 156 sgListViewCompletedPix[iii]->fill( Qt::white );
157 QPainter p ( sgListViewCompletedPix[iii] ); 157 QPainter p ( sgListViewCompletedPix[iii] );
158 p.drawRect( 0,0,11,11); 158 p.drawRect( 0,0,11,11);
159 if ( iii ) 159 if ( iii )
160 p.fillRect( 1,1,iii*2,9,Qt::gray ); 160 p.fillRect( 1,1,iii*2,9,Qt::gray );
161 } 161 }
162 sgListViewJournalPix = &journalPix; 162 sgListViewJournalPix = &journalPix;
163 sgListViewJournalPix->resize( 11, 11 ); 163 sgListViewJournalPix->resize( 11, 11 );
164 sgListViewJournalPix->fill( Qt::white ); 164 sgListViewJournalPix->fill( Qt::white );
165 { 165 {
166 QPainter p ( sgListViewJournalPix ); 166 QPainter p ( sgListViewJournalPix );
167 p.drawRect( 0,0,11,11); 167 p.drawRect( 0,0,11,11);
168 p.drawLine( 2,3,5,3); 168 p.drawLine( 2,3,5,3);
169 p.drawLine( 2,5,8,5); 169 p.drawLine( 2,5,8,5);
170 p.drawLine( 2,7,6,7); 170 p.drawLine( 2,7,6,7);
171 } 171 }
172 } 172 }
173 mClosed = false; 173 mClosed = false;
174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
175 QString confFile = locateLocal("config","korganizerrc"); 175 QString confFile = locateLocal("config","korganizerrc");
176 QFileInfo finf ( confFile ); 176 QFileInfo finf ( confFile );
177 bool showWarning = !finf.exists(); 177 bool showWarning = !finf.exists();
178 setIcon(SmallIcon( "ko24" ) ); 178 setIcon(SmallIcon( "ko24" ) );
179 mBlockAtStartup = true; 179 mBlockAtStartup = true;
180 mFlagKeyPressed = false; 180 mFlagKeyPressed = false;
181 setCaption("KO/Pi"); 181 setCaption("KO/Pi");
182 KOPrefs *p = KOPrefs::instance(); 182 KOPrefs *p = KOPrefs::instance();
183 //KPimGlobalPrefs::instance()->setGlobalConfig(); 183 //KPimGlobalPrefs::instance()->setGlobalConfig();
184 p->mCurrentDisplayedView = 0; 184 p->mCurrentDisplayedView = 0;
185 if ( p->mHourSize > 22 ) 185 if ( p->mHourSize > 22 )
186 p->mHourSize = 22; 186 p->mHourSize = 22;
187 QMainWindow::ToolBarDock tbd; 187 QMainWindow::ToolBarDock tbd;
188 if ( p->mToolBarHor ) { 188 if ( p->mToolBarHor ) {
189 if ( p->mToolBarUp ) 189 if ( p->mToolBarUp )
190 tbd = Bottom; 190 tbd = Bottom;
191 else 191 else
192 tbd = Top; 192 tbd = Top;
193 } 193 }
194 else { 194 else {
195 if ( p->mToolBarUp ) 195 if ( p->mToolBarUp )
196 tbd = Right; 196 tbd = Right;
197 else 197 else
198 tbd = Left; 198 tbd = Left;
199 } 199 }
200 if ( KOPrefs::instance()->mUseAppColors ) 200 if ( KOPrefs::instance()->mUseAppColors )
201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
202 globalFlagBlockStartup = 1; 202 globalFlagBlockStartup = 1;
203 iconToolBar = new QPEToolBar( this ); 203 iconToolBar = new QPEToolBar( this );
204 addToolBar (iconToolBar , tbd ); 204 addToolBar (iconToolBar , tbd );
205 205
206#ifdef DESKTOP_VERSION 206#ifdef DESKTOP_VERSION
207 if ( KOPrefs::instance()->mShowIconFilter ) 207 if ( KOPrefs::instance()->mShowIconFilter )
208#else 208#else
209 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) 209 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) )
210#endif 210#endif
211 211
212{ 212{
213 if ( p->mToolBarHorF ) { 213 if ( p->mToolBarHorF ) {
214 if ( p->mToolBarUpF ) 214 if ( p->mToolBarUpF )
215 tbd = Bottom; 215 tbd = Bottom;
216 else 216 else
217 tbd = Top; 217 tbd = Top;
218 } 218 }
219 else { 219 else {
220 if ( p->mToolBarUpF ) 220 if ( p->mToolBarUpF )
221 tbd = Right; 221 tbd = Right;
222 else 222 else
223 tbd = Left; 223 tbd = Left;
224 } 224 }
225 filterToolBar = new QPEToolBar ( this ); 225 filterToolBar = new QPEToolBar ( this );
226 filterMenubar = new KMenuBar( 0 ); 226 filterMenubar = new KMenuBar( 0 );
227 QFontMetrics fm ( filterMenubar->font() ); 227 QFontMetrics fm ( filterMenubar->font() );
228#ifndef DESKTOP_VERSION 228#ifndef DESKTOP_VERSION
229 filterToolBar->setFocusPolicy( NoFocus ); 229 filterToolBar->setFocusPolicy( NoFocus );
230 filterMenubar->setFocusPolicy( NoFocus ); 230 filterMenubar->setFocusPolicy( NoFocus );
231#endif 231#endif
232 filterPopupMenu = new QPopupMenu( this ); 232 filterPopupMenu = new QPopupMenu( this );
233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
234 QString addTest = "A"; 234 QString addTest = "A";
235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
236#ifdef DESKTOP_VERSION 236#ifdef DESKTOP_VERSION
237 addTest = "AAAAAABBBCCCx"; 237 addTest = "AAAAAABBBCCCx";
238#else 238#else
239 addTest = "AAAAAx"; 239 addTest = "AAAAAx";
240#endif 240#endif
241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
242 addToolBar (filterToolBar , tbd ); 242 addToolBar (filterToolBar , tbd );
243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
246 filterToolBar->hide(); 246 filterToolBar->hide();
247 } else { 247 } else {
248 filterToolBar = 0; 248 filterToolBar = 0;
249 filterMenubar = 0; 249 filterMenubar = 0;
250 filterPopupMenu = 0; 250 filterPopupMenu = 0;
251 } 251 }
252 if ( p->mShowIconOnetoolbar ) { 252 if ( p->mShowIconOnetoolbar ) {
253 viewToolBar = iconToolBar ; 253 viewToolBar = iconToolBar ;
254 navigatorToolBar = iconToolBar ; 254 navigatorToolBar = iconToolBar ;
255 } else { 255 } else {
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 setToolBarsMovable( false ); 257 setToolBarsMovable( false );
258#endif 258#endif
259 if ( p->mToolBarHorV ) { 259 if ( p->mToolBarHorV ) {
260 if ( p->mToolBarUpV ) 260 if ( p->mToolBarUpV )
261 tbd = Bottom; 261 tbd = Bottom;
262 else 262 else
263 tbd = Top; 263 tbd = Top;
264 } 264 }
265 else { 265 else {
266 if ( p->mToolBarUpV ) 266 if ( p->mToolBarUpV )
267 tbd = Right; 267 tbd = Right;
268 else 268 else
269 tbd = Left; 269 tbd = Left;
270 } 270 }
271 viewToolBar = new QPEToolBar( this ); 271 viewToolBar = new QPEToolBar( this );
272 addToolBar (viewToolBar , tbd ); 272 addToolBar (viewToolBar , tbd );
273 if ( p->mToolBarHorN ) { 273 if ( p->mToolBarHorN ) {
274 if ( p->mToolBarUpN ) 274 if ( p->mToolBarUpN )
275 tbd = Bottom; 275 tbd = Bottom;
276 else 276 else
277 tbd = Top; 277 tbd = Top;
278 } 278 }
279 else { 279 else {
280 if ( p->mToolBarUpN ) 280 if ( p->mToolBarUpN )
281 tbd = Right; 281 tbd = Right;
282 else 282 else
283 tbd = Left; 283 tbd = Left;
284 } 284 }
285 navigatorToolBar = new QPEToolBar( this ); 285 navigatorToolBar = new QPEToolBar( this );
286 addToolBar (navigatorToolBar , tbd ); 286 addToolBar (navigatorToolBar , tbd );
287 } 287 }
288 288
289 289
290 290
291 mCalendarModifiedFlag = false; 291 mCalendarModifiedFlag = false;
292 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 292 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
293 //splash->setAlignment ( AlignCenter ); 293 //splash->setAlignment ( AlignCenter );
294 //setCentralWidget( splash ); 294 //setCentralWidget( splash );
295#ifndef DESKTOP_VERSION 295#ifndef DESKTOP_VERSION
296 //showMaximized(); 296 //showMaximized();
297#endif 297#endif
298 298
299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
300 setDefaultPreferences(); 300 setDefaultPreferences();
301 mCalendar = new CalendarLocal(); 301 mCalendar = new CalendarLocal();
302 mView = new CalendarView( mCalendar, this,"mCalendar " ); 302 mView = new CalendarView( mCalendar, this,"mCalendar " );
303 setCentralWidget( mView ); 303 setCentralWidget( mView );
304 //mView->hide(); 304 //mView->hide();
305 //mView->resize(splash->size() ); 305 //mView->resize(splash->size() );
306 initActions(); 306 initActions();
307 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 307 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
308 mSyncManager->setBlockSave(false); 308 mSyncManager->setBlockSave(false);
309 mView->setSyncManager(mSyncManager); 309 mView->setSyncManager(mSyncManager);
310#ifndef DESKTOP_VERSION 310#ifndef DESKTOP_VERSION
311 //iconToolBar->show(); 311 iconToolBar->show();
312 //qApp->processEvents(); 312 qApp->processEvents();
313#endif 313#endif
314 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 314 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
315 int vh = height() ; 315 int vh = height() ;
316 int vw = width(); 316 int vw = width();
317 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 317 //qDebug("Toolbar hei %d ",iconToolBar->height() );
318 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 318 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
319 vh -= iconToolBar->height(); 319 vh -= iconToolBar->height();
320 } else { 320 } else {
321 vw -= iconToolBar->height(); 321 vw -= iconToolBar->height();
322 } 322 }
323 //mView->setMaximumSize( splash->size() ); 323 //mView->setMaximumSize( splash->size() );
324 //mView->resize( splash->size() ); 324 //mView->resize( splash->size() );
325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
326 mView->readSettings(); 326 mView->readSettings();
327 bool newFile = false; 327 bool newFile = false;
328 if( !QFile::exists( defaultFileName() ) ) { 328 if( !QFile::exists( defaultFileName() ) ) {
329 QFileInfo finfo ( defaultFileName() ); 329 QFileInfo finfo ( defaultFileName() );
330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
331 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 331 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
332 finfo.setFile( oldFile ); 332 finfo.setFile( oldFile );
333 if (finfo.exists() ) { 333 if (finfo.exists() ) {
334 KMessageBox::information( this, message); 334 KMessageBox::information( this, message);
335 mView->openCalendar( oldFile ); 335 mView->openCalendar( oldFile );
336 qApp->processEvents(); 336 qApp->processEvents();
337 } else { 337 } else {
338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
339 finfo.setFile( oldFile ); 339 finfo.setFile( oldFile );
340 if (finfo.exists() ) { 340 if (finfo.exists() ) {
341 KMessageBox::information( this, message); 341 KMessageBox::information( this, message);
342 mView->openCalendar( oldFile ); 342 mView->openCalendar( oldFile );
343 qApp->processEvents(); 343 qApp->processEvents();
344 } 344 }
345 } 345 }
346 mView->saveCalendar( defaultFileName() ); 346 mView->saveCalendar( defaultFileName() );
347 newFile = true; 347 newFile = true;
348 } 348 }
349 349
350 //QTime neededSaveTime = QDateTime::currentDateTime().time(); 350 //QTime neededSaveTime = QDateTime::currentDateTime().time();
351 //mView->loadCalendars(); 351 //mView->loadCalendars();
352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
353 //qDebug("KO: Calendar loading time: %d ms",msNeeded ); 353 //qDebug("KO: Calendar loading time: %d ms",msNeeded );
354 354
355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
356 KOPrefs::instance()->setAllDefaults(); 356 KOPrefs::instance()->setAllDefaults();
357 } 357 }
358 358
359 359
360 connect( mView, SIGNAL( tempDisableBR(bool) ), 360 connect( mView, SIGNAL( tempDisableBR(bool) ),
361 SLOT( disableBR(bool) ) ); 361 SLOT( disableBR(bool) ) );
362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
363 setCentralWidget( mView ); 363 setCentralWidget( mView );
364 globalFlagBlockStartup = 0; 364 globalFlagBlockStartup = 0;
365 //mView->show(); 365 //mView->show();
366 //delete splash; 366 //delete splash;
367 if ( newFile ) 367 if ( newFile )
368 mView->updateConfig(); 368 mView->updateConfig();
369 // qApp->processEvents(); 369 // qApp->processEvents();
370 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 370 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
371 //fillSyncMenu(); 371 //fillSyncMenu();
372 372
373 373
374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
378 mSyncManager->setDefaultFileName( sentSyncFile()); 378 mSyncManager->setDefaultFileName( sentSyncFile());
379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
380 mSyncManager->fillSyncMenu(); 380 mSyncManager->fillSyncMenu();
381 381
382 382
383 383
384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
385 if ( showWarning ) { 385 if ( showWarning ) {
386 KMessageBox::information( this, 386 KMessageBox::information( this,
387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
388 //qApp->processEvents(); 388 //qApp->processEvents();
389 mView->dialogManager()->showSyncOptions(); 389 mView->dialogManager()->showSyncOptions();
390 } 390 }
391 391
392 //US listen for result adressed from Ka/Pi 392 //US listen for result adressed from Ka/Pi
393 393
394#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
395 infrared = 0; 395 infrared = 0;
396#endif 396#endif
397 updateFilterToolbar(); 397 updateFilterToolbar();
398 updateWeek( mView->startDate() ); 398 updateWeek( mView->startDate() );
399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
400 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 400 SLOT( updateWeekNum( const KCal::DateList & ) ) );
401 mBRdisabled = false; 401 mBRdisabled = false;
402 //toggleBeamReceive(); 402 //toggleBeamReceive();
403 403
404 setCaption(i18n("Loading calendar files ... please wait" )); 404 setCaption(i18n("Loading calendar files ... please wait" ));
405 mSaveDelay = 0; 405 mSaveDelay = 0;
406 QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); 406 QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() ));
407} 407}
408MainWindow::~MainWindow() 408MainWindow::~MainWindow()
409{ 409{
410 //qDebug("MainWindow::~MainWindow() "); 410 //qDebug("MainWindow::~MainWindow() ");
411 //save toolbar location 411 //save toolbar location
412 delete mCalendar; 412 delete mCalendar;
413 delete mSyncManager; 413 delete mSyncManager;
414#ifndef DESKTOP_VERSION 414#ifndef DESKTOP_VERSION
415 if ( infrared ) 415 if ( infrared )
416 delete infrared; 416 delete infrared;
417#endif 417#endif
418 418
419 419
420} 420}
421 421
422void MainWindow::loadDataAfterStart() 422void MainWindow::loadDataAfterStart()
423{ 423{
424 qDebug("KO: Start loading files..." ); 424 qDebug("KO: Start loading files..." );
425 QTime neededSaveTime = QDateTime::currentDateTime().time(); 425 QTime neededSaveTime = QDateTime::currentDateTime().time();
426 mView->loadCalendars(); 426 mView->loadCalendars();
427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
428 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 428 qDebug("KO: Calendar loading time: %d ms",msNeeded );
429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
430 mView->setModified( false ); 430 mView->setModified( false );
431 mBlockAtStartup = false; 431 mBlockAtStartup = false;
432 mView->setModified( false ); 432 mView->setModified( false );
433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
434 processIncidenceSelection( 0 ); 434 processIncidenceSelection( 0 );
435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
436 SLOT( processIncidenceSelection( Incidence * ) ) ); 436 SLOT( processIncidenceSelection( Incidence * ) ) );
437 connect( mView, SIGNAL( modifiedChanged( bool ) ), 437 connect( mView, SIGNAL( modifiedChanged( bool ) ),
438 SLOT( slotModifiedChanged( bool ) ) ); 438 SLOT( slotModifiedChanged( bool ) ) );
439#ifndef DESKTOP_VERSION 439#ifndef DESKTOP_VERSION
440 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 440 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
441 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); 441 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& )));
442 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); 442 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& )));
443 if ( !mCStringMess.isEmpty() ) 443 if ( !mCStringMess.isEmpty() )
444 recieve( mCStringMess, mByteData ); 444 recieve( mCStringMess, mByteData );
445#endif 445#endif
446 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 446 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
447} 447}
448 448
449void MainWindow::slotResetFocus() 449void MainWindow::slotResetFocus()
450{ 450{
451 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 451 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
452 mFocusLoop = 3; 452 mFocusLoop = 3;
453 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 453 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
454} 454}
455void MainWindow::slotResetFocusLoop() 455void MainWindow::slotResetFocusLoop()
456{ 456{
457 --mFocusLoop; 457 --mFocusLoop;
458 QWidget* fw = mView->viewManager()->currentView(); 458 QWidget* fw = mView->viewManager()->currentView();
459 if ( fw ) { 459 if ( fw ) {
460 //qDebug("loop "); 460 //qDebug("loop ");
461 fw->setFocus(); 461 fw->setFocus();
462 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 462 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
463 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 463 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
464 } 464 }
465 465
466} 466}
467void MainWindow::disableBR(bool b) 467void MainWindow::disableBR(bool b)
468{ 468{
469#ifndef DESKTOP_VERSION 469#ifndef DESKTOP_VERSION
470 if ( b ) { 470 if ( b ) {
471 if ( infrared ) { 471 if ( infrared ) {
472 toggleBeamReceive(); 472 toggleBeamReceive();
473 mBRdisabled = true; 473 mBRdisabled = true;
474 } 474 }
475 mBRdisabled = true; 475 mBRdisabled = true;
476 } else { 476 } else {
477 if ( mBRdisabled ) { 477 if ( mBRdisabled ) {
478 mBRdisabled = false; 478 mBRdisabled = false;
479 //makes no sense,because other cal ap is probably running 479 //makes no sense,because other cal ap is probably running
480 // toggleBeamReceive(); 480 // toggleBeamReceive();
481 } 481 }
482 } 482 }
483#endif 483#endif
484 484
485} 485}
486bool MainWindow::beamReceiveEnabled() 486bool MainWindow::beamReceiveEnabled()
487{ 487{
488#ifndef DESKTOP_VERSION 488#ifndef DESKTOP_VERSION
489 return ( infrared != 0 ); 489 return ( infrared != 0 );
490#endif 490#endif
491 return false; 491 return false;
492} 492}
493 493
494void MainWindow::toggleBeamReceive() 494void MainWindow::toggleBeamReceive()
495{ 495{
496 if ( mBRdisabled ) 496 if ( mBRdisabled )
497 return; 497 return;
498#ifndef DESKTOP_VERSION 498#ifndef DESKTOP_VERSION
499 if ( infrared ) { 499 if ( infrared ) {
500 qDebug("KO: Disable BeamReceive "); 500 qDebug("KO: Disable BeamReceive ");
501 delete infrared; 501 delete infrared;
502 infrared = 0; 502 infrared = 0;
503 brAction->setOn(false); 503 brAction->setOn(false);
504 return; 504 return;
505 } 505 }
506 qDebug("KO: Enable BeamReceive "); 506 qDebug("KO: Enable BeamReceive ");
507 brAction->setOn(true); 507 brAction->setOn(true);
508 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 508 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
509 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 509 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
510#endif 510#endif
511} 511}
512void MainWindow::showMaximized () 512void MainWindow::showMaximized ()
513{ 513{
514#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
515 if ( ! globalFlagBlockStartup ) 515 if ( ! globalFlagBlockStartup )
516 if ( mClosed ) 516 if ( mClosed )
517 mView->goToday(); 517 mView->goToday();
518#endif 518#endif
519 QWidget::showMaximized () ; 519 QWidget::showMaximized () ;
520 mClosed = false; 520 mClosed = false;
521} 521}
522 522
523bool MainWindow::askForQuitOnSaveError() 523bool MainWindow::askForQuitOnSaveError()
524{ 524{
525 bool retval = false; 525 bool retval = false;
526 switch( QMessageBox::information( this, "KO/Pi", 526 switch( QMessageBox::information( this, "KO/Pi",
527 i18n("Error saving data") + "!\n" + 527 i18n("Error saving data") + "!\n" +
528 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + 528 i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" +
529 i18n("Do you really want\nto close KO/Pi?"), 529 i18n("Do you really want\nto close KO/Pi?"),
530 i18n(" Yes, close "), i18n("No"), 530 i18n(" Yes, close "), i18n("No"),
531 0, 1 ) ) { 531 0, 1 ) ) {
532 case 0: 532 case 0:
533 retval = true; 533 retval = true;
534 break; 534 break;
535 default: 535 default:
536 break; 536 break;
537 } 537 }
538 return retval; 538 return retval;
539} 539}
540 540
541void MainWindow::closeEvent( QCloseEvent* ce ) 541void MainWindow::closeEvent( QCloseEvent* ce )
542{ 542{
543 543
544 544
545 545
546 if ( ! KOPrefs::instance()->mAskForQuit ) { 546 if ( ! KOPrefs::instance()->mAskForQuit ) {
547 saveOnClose(); 547 saveOnClose();
548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 548 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
549 ce->ignore(); 549 ce->ignore();
550 return; 550 return;
551 } 551 }
552 mClosed = true; 552 mClosed = true;
553 ce->accept(); 553 ce->accept();
554 return; 554 return;
555 555
556 } 556 }
557 557
558 switch( QMessageBox::information( this, "KO/Pi", 558 switch( QMessageBox::information( this, "KO/Pi",
559 i18n("Do you really want\nto close KO/Pi?"), 559 i18n("Do you really want\nto close KO/Pi?"),
560 i18n("Close"), i18n("No"), 560 i18n("Close"), i18n("No"),
561 0, 0 ) ) { 561 0, 0 ) ) {
562 case 0: 562 case 0:
563 saveOnClose(); 563 saveOnClose();
564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) { 564 if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
565 ce->ignore(); 565 ce->ignore();
566 return; 566 return;
567 } 567 }
568 mClosed = true; 568 mClosed = true;
569 ce->accept(); 569 ce->accept();
570 break; 570 break;
571 case 1: 571 case 1:
572 ce->ignore(); 572 ce->ignore();
573 break; 573 break;
574 case 2: 574 case 2:
575 575
576 default: 576 default:
577 break; 577 break;
578 } 578 }
579 579
580 580
581} 581}
582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 582void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
583{ 583{
584 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 584 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
585 mCStringMess = cmsg; 585 mCStringMess = cmsg;
586 mByteData = data; 586 mByteData = data;
587} 587}
588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 588void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
589{ 589{
590 QDataStream stream( data, IO_ReadOnly ); 590 QDataStream stream( data, IO_ReadOnly );
591 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 591 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
592 //QString datamess; 592 //QString datamess;
593 //qDebug("message "); 593 //qDebug("message ");
594 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 594 qDebug("KO: QCOP message received: %s ", cmsg.data() );
595 595
596 if ( cmsg == "setDocument(QString)" ) { 596 if ( cmsg == "setDocument(QString)" ) {
597 QDataStream stream( data, IO_ReadOnly ); 597 QDataStream stream( data, IO_ReadOnly );
598 QString fileName; 598 QString fileName;
599 stream >> fileName; 599 stream >> fileName;
600 //qDebug("filename %s ", fileName.latin1()); 600 //qDebug("filename %s ", fileName.latin1());
601 showMaximized(); 601 showMaximized();
602 raise(); 602 raise();
603 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 603 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
604 mSyncManager->slotSyncMenu( 1002 ); 604 mSyncManager->slotSyncMenu( 1002 );
605 return; 605 return;
606 } 606 }
607 607
608 if ( cmsg == "-writeFile" ) { 608 if ( cmsg == "-writeFile" ) {
609 // I made from the "-writeFile" an "-writeAlarm" 609 // I made from the "-writeFile" an "-writeAlarm"
610 mView->viewManager()->showWhatsNextView(); 610 mView->viewManager()->showWhatsNextView();
611 mCalendar->checkAlarmForIncidence( 0, true); 611 mCalendar->checkAlarmForIncidence( 0, true);
612 showMaximized(); 612 showMaximized();
613 raise(); 613 raise();
614 return; 614 return;
615 615
616 } 616 }
617 if ( cmsg == "-writeFileSilent" ) { 617 if ( cmsg == "-writeFileSilent" ) {
618 // I made from the "-writeFile" an "-writeAlarm" 618 // I made from the "-writeFile" an "-writeAlarm"
619 // mView->viewManager()->showWhatsNextView(); 619 // mView->viewManager()->showWhatsNextView();
620 mCalendar->checkAlarmForIncidence( 0, true); 620 mCalendar->checkAlarmForIncidence( 0, true);
621 //showMaximized(); 621 //showMaximized();
622 //raise(); 622 //raise();
623 //hide(); 623 //hide();
624 return; 624 return;
625 } 625 }
626 if ( cmsg == "-newCountdown" ) { 626 if ( cmsg == "-newCountdown" ) {
627 qDebug("newCountdown "); 627 qDebug("newCountdown ");
628 628
629 } 629 }
630 QString msg ; 630 QString msg ;
631 QString allmsg = cmsg; 631 QString allmsg = cmsg;
632 while ( allmsg.length() > 0 ) { 632 while ( allmsg.length() > 0 ) {
633 int nextC = allmsg.find( "-", 1 ); 633 int nextC = allmsg.find( "-", 1 );
634 if ( nextC == -1 ) { 634 if ( nextC == -1 ) {
635 msg = allmsg; 635 msg = allmsg;
636 allmsg = ""; 636 allmsg = "";
637 } else{ 637 } else{
638 msg = allmsg.left( nextC ); 638 msg = allmsg.left( nextC );
639 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 639 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
640 } 640 }
641 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 641 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
642 if ( msg == "-newEvent" ) { 642 if ( msg == "-newEvent" ) {
643 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 643 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
644 } 644 }
645 if ( msg == "-newTodo" ) { 645 if ( msg == "-newTodo" ) {
646 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 646 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
647 } 647 }
648 if ( msg == "-showWN" ) { 648 if ( msg == "-showWN" ) {
649 mView->viewManager()->showWhatsNextView(); 649 mView->viewManager()->showWhatsNextView();
650 } 650 }
651 if ( msg == "-showList" ) { 651 if ( msg == "-showList" ) {
652 mView->viewManager()->showListView(); 652 mView->viewManager()->showListView();
653 } 653 }
654 else if ( msg == "-showDay" ) { 654 else if ( msg == "-showDay" ) {
655 mView->viewManager()->showDayView(); 655 mView->viewManager()->showDayView();
656 } 656 }
657 else if ( msg == "-showWWeek" ) { 657 else if ( msg == "-showWWeek" ) {
658 mView->viewManager()->showWorkWeekView(); 658 mView->viewManager()->showWorkWeekView();
659 } 659 }
660 else if ( msg == "-ringSync" ) { 660 else if ( msg == "-ringSync" ) {
661 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 661 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
662 } 662 }
663 else if ( msg == "-showWeek" ) { 663 else if ( msg == "-showWeek" ) {
664 mView->viewManager()->showWeekView(); 664 mView->viewManager()->showWeekView();
665 } 665 }
666 else if ( msg == "-showTodo" ) { 666 else if ( msg == "-showTodo" ) {
667 mView->viewManager()->showTodoView(); 667 mView->viewManager()->showTodoView();
668 } 668 }
669 else if ( msg == "-showJournal" ) { 669 else if ( msg == "-showJournal" ) {
670 mView->dateNavigator()->selectDates( 1 ); 670 mView->dateNavigator()->selectDates( 1 );
671 mView->dateNavigator()->selectToday(); 671 mView->dateNavigator()->selectToday();
672 mView->viewManager()->showJournalView(); 672 mView->viewManager()->showJournalView();
673 } 673 }
674 else if ( msg == "-showKO" ) { 674 else if ( msg == "-showKO" ) {
675 mView->viewManager()->showNextXView(); 675 mView->viewManager()->showNextXView();
676 } 676 }
677 else if ( msg == "-showWNext" ) { 677 else if ( msg == "-showWNext" ) {
678 mView->viewManager()->showWhatsNextView(); 678 mView->viewManager()->showWhatsNextView();
679 } 679 }
680 else if ( msg == "nextView()" ) { 680 else if ( msg == "nextView()" ) {
681 mView->viewManager()->showNextView(); 681 mView->viewManager()->showNextView();
682 } 682 }
683 else if ( msg == "-showNextXView" ) { 683 else if ( msg == "-showNextXView" ) {
684 mView->viewManager()->showNextXView(); 684 mView->viewManager()->showNextXView();
685 } 685 }
686 686
687 687
688 } 688 }
689 689
690 showMaximized(); 690 showMaximized();
691 raise(); 691 raise();
692} 692}
693void MainWindow::startMultiSync() 693void MainWindow::startMultiSync()
694{ 694{
695 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 695 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
696 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 696 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
697 question, 697 question,
698 i18n("Yes"), i18n("No"), 698 i18n("Yes"), i18n("No"),
699 0, 0 ) != 0 ) { 699 0, 0 ) != 0 ) {
700 setCaption(i18n("Aborted! Nothing synced!")); 700 setCaption(i18n("Aborted! Nothing synced!"));
701 return; 701 return;
702 } 702 }
703 mSyncManager->multiSync( false ); 703 mSyncManager->multiSync( false );
704#ifndef DESKTOP_VERSION 704#ifndef DESKTOP_VERSION
705 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 705 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
706#endif 706#endif
707} 707}
708QPixmap MainWindow::loadPixmap( QString name ) 708QPixmap MainWindow::loadPixmap( QString name )
709{ 709{
710 return SmallIcon( name ); 710 return SmallIcon( name );
711 711
712} 712}
713void MainWindow::setUsesBigPixmaps ( bool b ) 713void MainWindow::setUsesBigPixmaps ( bool b )
714{ 714{
715 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 715 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
716 if ( b ) 716 if ( b )
717 qDebug("KO: BigPixmaps are not supported "); 717 qDebug("KO: BigPixmaps are not supported ");
718} 718}
719void MainWindow::initActions() 719void MainWindow::initActions()
720{ 720{
721 //KOPrefs::instance()->mShowFullMenu 721 //KOPrefs::instance()->mShowFullMenu
722 iconToolBar->clear(); 722 iconToolBar->clear();
723 KOPrefs *p = KOPrefs::instance(); 723 KOPrefs *p = KOPrefs::instance();
724 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 724 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
725 725
726 QPopupMenu *viewMenu = new QPopupMenu( this ); 726 QPopupMenu *viewMenu = new QPopupMenu( this );
727 QPopupMenu *actionMenu = new QPopupMenu( this ); 727 QPopupMenu *actionMenu = new QPopupMenu( this );
728 mCurrentItemMenu = new QPopupMenu ( this ); 728 mCurrentItemMenu = new QPopupMenu ( this );
729 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 729 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
730 QPopupMenu *importMenu = new QPopupMenu( this ); 730 QPopupMenu *importMenu = new QPopupMenu( this );
731 QPopupMenu *importMenu_X = new QPopupMenu( this ); 731 QPopupMenu *importMenu_X = new QPopupMenu( this );
732 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 732 QPopupMenu *exportMenu_X = new QPopupMenu( this );
733 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 733 QPopupMenu *beamMenu_X = new QPopupMenu( this );
734 selectFilterMenu = new QPopupMenu( this ); 734 selectFilterMenu = new QPopupMenu( this );
735 selectFilterMenu->setCheckable( true ); 735 selectFilterMenu->setCheckable( true );
736 syncMenu = new QPopupMenu( this ); 736 syncMenu = new QPopupMenu( this );
737 configureAgendaMenu = new QPopupMenu( this ); 737 configureAgendaMenu = new QPopupMenu( this );
738 configureToolBarMenu = new QPopupMenu( this ); 738 configureToolBarMenu = new QPopupMenu( this );
739 QPopupMenu *helpMenu = new QPopupMenu( this ); 739 QPopupMenu *helpMenu = new QPopupMenu( this );
740 QIconSet icon; 740 QIconSet icon;
741 int pixWid = 22, pixHei = 22; 741 int pixWid = 22, pixHei = 22;
742 QString pathString = ""; 742 QString pathString = "";
743 if ( !p->mToolBarMiniIcons ) { 743 if ( !p->mToolBarMiniIcons ) {
744 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 744 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
745 pathString += "icons16/"; 745 pathString += "icons16/";
746 pixWid = 18; pixHei = 16; 746 pixWid = 18; pixHei = 16;
747 } 747 }
748 } else { 748 } else {
749 pathString += "iconsmini/"; 749 pathString += "iconsmini/";
750 pixWid = 18; pixHei = 16; 750 pixWid = 18; pixHei = 16;
751 } 751 }
752 752
753 if ( KOPrefs::instance()->mShowFullMenu ) { 753 if ( KOPrefs::instance()->mShowFullMenu ) {
754 menuBar1 = new KMenuBar( this );//menuBar(); 754 menuBar1 = new KMenuBar( this );//menuBar();
755 //setMenuBar( menuBar1 ); 755 //setMenuBar( menuBar1 );
756 menuBar1->show(); 756 menuBar1->show();
757 menuBar1->insertItem( i18n("File"), importMenu ); 757 menuBar1->insertItem( i18n("File"), importMenu );
758 menuBar1->insertItem( i18n("View"), viewMenu ); 758 menuBar1->insertItem( i18n("View"), viewMenu );
759 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 759 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
760 menuBar1->insertItem( i18n("Action"), actionMenu ); 760 menuBar1->insertItem( i18n("Action"), actionMenu );
761#ifdef DESKTOP_VERSION 761#ifdef DESKTOP_VERSION
762 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 762 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
763 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 763 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
764#else 764#else
765 menuBar1->insertItem( i18n("Sync"), syncMenu ); 765 menuBar1->insertItem( i18n("Sync"), syncMenu );
766 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 766 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
767#endif 767#endif
768 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 768 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
769 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 769 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
770 menuBar1->insertItem( i18n("Help"), helpMenu ); 770 menuBar1->insertItem( i18n("Help"), helpMenu );
771 } else { 771 } else {
772 menuBar1 = new KMenuBar( iconToolBar ); 772 menuBar1 = new KMenuBar( iconToolBar );
773 QPopupMenu *menuBar = new QPopupMenu( this ); 773 QPopupMenu *menuBar = new QPopupMenu( this );
774 icon = loadPixmap( pathString + "z_menu" ); 774 icon = loadPixmap( pathString + "z_menu" );
775 menuBar1->insertItem( icon.pixmap(), menuBar); 775 menuBar1->insertItem( icon.pixmap(), menuBar);
776 //menuBar1->insertItem( i18n("ME"), menuBar); 776 //menuBar1->insertItem( i18n("ME"), menuBar);
777 menuBar->insertItem( i18n("File"), importMenu ); 777 menuBar->insertItem( i18n("File"), importMenu );
778 menuBar->insertItem( i18n("View"), viewMenu ); 778 menuBar->insertItem( i18n("View"), viewMenu );
779 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 779 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
780 menuBar->insertItem( i18n("Action"), actionMenu ); 780 menuBar->insertItem( i18n("Action"), actionMenu );
781 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 781 menuBar->insertItem( i18n("Synchronize"), syncMenu );
782 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 782 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
783 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 783 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
784 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 784 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
785 menuBar->insertItem( i18n("Help"), helpMenu ); 785 menuBar->insertItem( i18n("Help"), helpMenu );
786 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 786 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
787 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 787 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
788 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 788 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
789 } 789 }
790 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 790 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
791 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 791 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
792 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 792 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
793 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 793 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
794 794
795 795
796 mWeekBgColor = iconToolBar->backgroundColor(); 796 mWeekBgColor = iconToolBar->backgroundColor();
797 mWeekPixmap.resize( pixWid , pixHei ); 797 mWeekPixmap.resize( pixWid , pixHei );
798 mWeekPixmap.fill( mWeekBgColor ); 798 mWeekPixmap.fill( mWeekBgColor );
799 icon = mWeekPixmap; 799 icon = mWeekPixmap;
800 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 800 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
801 if ( p-> mShowIconWeekNum ) 801 if ( p-> mShowIconWeekNum )
802 mWeekAction->addTo( iconToolBar ); 802 mWeekAction->addTo( iconToolBar );
803 mWeekFont = font(); 803 mWeekFont = font();
804 804
805 int fontPoint = mWeekFont.pointSize(); 805 int fontPoint = mWeekFont.pointSize();
806 QFontMetrics f( mWeekFont ); 806 QFontMetrics f( mWeekFont );
807 int fontWid = f.width( "30" ); 807 int fontWid = f.width( "30" );
808 while ( fontWid > pixWid ) { 808 while ( fontWid > pixWid ) {
809 --fontPoint; 809 --fontPoint;
810 mWeekFont.setPointSize( fontPoint ); 810 mWeekFont.setPointSize( fontPoint );
811 QFontMetrics f( mWeekFont ); 811 QFontMetrics f( mWeekFont );
812 fontWid = f.width( "30" ); 812 fontWid = f.width( "30" );
813 //qDebug("dec-- "); 813 //qDebug("dec-- ");
814 } 814 }
815 815
816 connect( mWeekAction, SIGNAL( activated() ), 816 connect( mWeekAction, SIGNAL( activated() ),
817 this, SLOT( weekAction() ) ); 817 this, SLOT( weekAction() ) );
818 818
819 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 819 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
820 if ( p->mShowIconFilterview ) { 820 if ( p->mShowIconFilterview ) {
821 icon = loadPixmap( pathString + "filter" ); 821 icon = loadPixmap( pathString + "filter" );
822 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 822 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
823 connect( actionFilterMenuTB, SIGNAL( activated() ), 823 connect( actionFilterMenuTB, SIGNAL( activated() ),
824 this, SLOT( fillFilterMenuTB() ) ); 824 this, SLOT( fillFilterMenuTB() ) );
825 actionFilterMenuTB->addTo( iconToolBar ); 825 actionFilterMenuTB->addTo( iconToolBar );
826 selectFilterMenuTB = new QPopupMenu( this ); 826 selectFilterMenuTB = new QPopupMenu( this );
827 selectFilterMenuTB->setCheckable( true ); 827 selectFilterMenuTB->setCheckable( true );
828 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 828 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
829 } 829 }
830 830
831 //#endif 831 //#endif
832 // ****************** 832 // ******************
833 QAction *action; 833 QAction *action;
834 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 834 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
835 configureToolBarMenu->setCheckable( true ); 835 configureToolBarMenu->setCheckable( true );
836 836
837 837
838 configureAgendaMenu->setCheckable( true ); 838 configureAgendaMenu->setCheckable( true );
839 int iii ; 839 int iii ;
840 for ( iii = 1;iii<= 10 ;++iii ){ 840 for ( iii = 1;iii<= 10 ;++iii ){
841 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 841 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
842 } 842 }
843 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 843 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
844 844
845 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 845 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
846 this, SLOT( showConfigureAgenda( ) ) ); 846 this, SLOT( showConfigureAgenda( ) ) );
847 icon = loadPixmap( pathString + "today" ); 847 icon = loadPixmap( pathString + "today" );
848 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 848 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
849 today_action->addTo( actionMenu ); 849 today_action->addTo( actionMenu );
850 connect( today_action, SIGNAL( activated() ), 850 connect( today_action, SIGNAL( activated() ),
851 mView, SLOT( goToday() ) ); 851 mView, SLOT( goToday() ) );
852 852
853 icon = loadPixmap( pathString + "picker" ); 853 icon = loadPixmap( pathString + "picker" );
854 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 854 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
855 dPickerAction->addTo( actionMenu ); 855 dPickerAction->addTo( actionMenu );
856 connect( dPickerAction, SIGNAL( activated() ), 856 connect( dPickerAction, SIGNAL( activated() ),
857 mView, SLOT( showDatePicker() ) ); 857 mView, SLOT( showDatePicker() ) );
858 858
859 icon = loadPixmap( pathString + "search" ); 859 icon = loadPixmap( pathString + "search" );
860 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 860 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
861 search_action->addTo( actionMenu ); 861 search_action->addTo( actionMenu );
862 connect( search_action, SIGNAL( activated() ), 862 connect( search_action, SIGNAL( activated() ),
863 mView->dialogManager(), SLOT( showSearchDialog() ) ); 863 mView->dialogManager(), SLOT( showSearchDialog() ) );
864 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 864 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
865 865
866 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 866 action = new QAction( "Undo Delete", i18n("All events"), 0, this );
867 action->addTo( nextConflictMenu ); 867 action->addTo( nextConflictMenu );
868 connect( action, SIGNAL( activated() ), 868 connect( action, SIGNAL( activated() ),
869 mView, SLOT( conflictAll() ) ); 869 mView, SLOT( conflictAll() ) );
870 870
871 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 871 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
872 action->addTo( nextConflictMenu ); 872 action->addTo( nextConflictMenu );
873 connect( action, SIGNAL( activated() ), 873 connect( action, SIGNAL( activated() ),
874 mView, SLOT( conflictAllday() ) ); 874 mView, SLOT( conflictAllday() ) );
875 875
876 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 876 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
877 action->addTo( nextConflictMenu ); 877 action->addTo( nextConflictMenu );
878 connect( action, SIGNAL( activated() ), 878 connect( action, SIGNAL( activated() ),
879 mView, SLOT( conflictNotAll() ) ); 879 mView, SLOT( conflictNotAll() ) );
880 880
881 actionMenu->insertSeparator(); 881 actionMenu->insertSeparator();
882 882
883 icon = loadPixmap( pathString + "newevent" ); 883 icon = loadPixmap( pathString + "newevent" );
884 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 884 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
885 ne_action->addTo( mCurrentItemMenu ); 885 ne_action->addTo( mCurrentItemMenu );
886 connect( ne_action, SIGNAL( activated() ), 886 connect( ne_action, SIGNAL( activated() ),
887 mView, SLOT( newEvent() ) ); 887 mView, SLOT( newEvent() ) );
888 icon = loadPixmap( pathString + "newtodo" ); 888 icon = loadPixmap( pathString + "newtodo" );
889 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 889 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
890 nt_action->addTo( mCurrentItemMenu ); 890 nt_action->addTo( mCurrentItemMenu );
891 connect( nt_action, SIGNAL( activated() ), 891 connect( nt_action, SIGNAL( activated() ),
892 mView, SLOT( newTodo() ) ); 892 mView, SLOT( newTodo() ) );
893 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 893 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
894 this ); 894 this );
895 mNewSubTodoAction->addTo( mCurrentItemMenu ); 895 mNewSubTodoAction->addTo( mCurrentItemMenu );
896 connect( mNewSubTodoAction, SIGNAL( activated() ), 896 connect( mNewSubTodoAction, SIGNAL( activated() ),
897 mView, SLOT( newSubTodo() ) ); 897 mView, SLOT( newSubTodo() ) );
898 898
899 mCurrentItemMenu->insertSeparator(); 899 mCurrentItemMenu->insertSeparator();
900 icon = loadPixmap( pathString + "newevent" ); 900 icon = loadPixmap( pathString + "newevent" );
901 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 901 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
902 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 902 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
903 configureToolBarMenu->insertSeparator(); 903 configureToolBarMenu->insertSeparator();
904 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 904 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
905 configureToolBarMenu->insertSeparator(); 905 configureToolBarMenu->insertSeparator();
906 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 906 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
907 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 907 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
908 icon = loadPixmap( pathString + "newtodo" ); 908 icon = loadPixmap( pathString + "newtodo" );
909 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 909 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
910 910
911 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 911 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
912 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 912 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
913 mShowAction->addTo( mCurrentItemMenu ); 913 mShowAction->addTo( mCurrentItemMenu );
914 connect( mShowAction, SIGNAL( activated() ), 914 connect( mShowAction, SIGNAL( activated() ),
915 mView, SLOT( showIncidence() ) ); 915 mView, SLOT( showIncidence() ) );
916 916
917 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 917 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
918 mEditAction->addTo( mCurrentItemMenu ); 918 mEditAction->addTo( mCurrentItemMenu );
919 connect( mEditAction, SIGNAL( activated() ), 919 connect( mEditAction, SIGNAL( activated() ),
920 mView, SLOT( editIncidence() ) ); 920 mView, SLOT( editIncidence() ) );
921 921
922 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 922 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
923 mDeleteAction->addTo( mCurrentItemMenu ); 923 mDeleteAction->addTo( mCurrentItemMenu );
924 connect( mDeleteAction, SIGNAL( activated() ), 924 connect( mDeleteAction, SIGNAL( activated() ),
925 mView, SLOT( deleteIncidence() ) ); 925 mView, SLOT( deleteIncidence() ) );
926 926
927 927
928 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 928 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
929 mCloneAction->addTo( mCurrentItemMenu ); 929 mCloneAction->addTo( mCurrentItemMenu );
930 connect( mCloneAction, SIGNAL( activated() ), 930 connect( mCloneAction, SIGNAL( activated() ),
931 mView, SLOT( cloneIncidence() ) ); 931 mView, SLOT( cloneIncidence() ) );
932 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 932 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
933 mMoveAction->addTo( mCurrentItemMenu ); 933 mMoveAction->addTo( mCurrentItemMenu );
934 connect( mMoveAction, SIGNAL( activated() ), 934 connect( mMoveAction, SIGNAL( activated() ),
935 mView, SLOT( moveIncidence() ) ); 935 mView, SLOT( moveIncidence() ) );
936#ifndef DESKTOP_VERSION 936#ifndef DESKTOP_VERSION
937 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 937 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
938 mBeamAction->addTo(mCurrentItemMenu ); 938 mBeamAction->addTo(mCurrentItemMenu );
939 connect( mBeamAction, SIGNAL( activated() ), 939 connect( mBeamAction, SIGNAL( activated() ),
940 mView, SLOT( beamIncidence() ) ); 940 mView, SLOT( beamIncidence() ) );
941#endif 941#endif
942 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 942 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
943 mCancelAction->addTo( mCurrentItemMenu ); 943 mCancelAction->addTo( mCurrentItemMenu );
944 connect( mCancelAction, SIGNAL( activated() ), 944 connect( mCancelAction, SIGNAL( activated() ),
945 mView, SLOT( toggleCancelIncidence() ) ); 945 mView, SLOT( toggleCancelIncidence() ) );
946 946
947 947
948 mCurrentItemMenu->insertSeparator(); 948 mCurrentItemMenu->insertSeparator();
949 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 949 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
950 action->addTo( mCurrentItemMenu ); 950 action->addTo( mCurrentItemMenu );
951 connect( action, SIGNAL( activated() ), 951 connect( action, SIGNAL( activated() ),
952 mView, SLOT( undo_delete() ) ); 952 mView, SLOT( undo_delete() ) );
953 953
954 // *********************** 954 // ***********************
955 if ( KOPrefs::instance()->mVerticalScreen ) { 955 if ( KOPrefs::instance()->mVerticalScreen ) {
956 icon = SmallIcon( "1updownarrow" ); 956 icon = SmallIcon( "1updownarrow" );
957 } else { 957 } else {
958 icon = SmallIcon("1leftrightarrow" ); 958 icon = SmallIcon("1leftrightarrow" );
959 } 959 }
960 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 960 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
961 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 961 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
962 FSaction->addTo( viewMenu ); 962 FSaction->addTo( viewMenu );
963 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 963 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
964 964
965 965
966 icon = loadPixmap( pathString + "filter" ); 966 icon = loadPixmap( pathString + "filter" );
967 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 967 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
968 icon = loadPixmap( pathString + "configure" ); 968 icon = loadPixmap( pathString + "configure" );
969 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 969 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
970 action->addTo( viewMenu ); 970 action->addTo( viewMenu );
971 connect( action, SIGNAL( activated() ), 971 connect( action, SIGNAL( activated() ),
972 mView, SLOT( toggleFilter() ) ); 972 mView, SLOT( toggleFilter() ) );
973 mToggleFilter = action; 973 mToggleFilter = action;
974 icon = loadPixmap( pathString + "navi" ); 974 icon = loadPixmap( pathString + "navi" );
975 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 975 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
976 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 976 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
977 action->addTo( viewMenu ); 977 action->addTo( viewMenu );
978 connect( action, SIGNAL( activated() ), 978 connect( action, SIGNAL( activated() ),
979 mView, SLOT( toggleDateNavigatorWidget() ) ); 979 mView, SLOT( toggleDateNavigatorWidget() ) );
980 mToggleNav = action ; 980 mToggleNav = action ;
981 icon = loadPixmap( pathString + "allday" ); 981 icon = loadPixmap( pathString + "allday" );
982 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 982 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
983 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 983 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
984 action->addTo( viewMenu ); 984 action->addTo( viewMenu );
985 connect( action, SIGNAL( activated() ), 985 connect( action, SIGNAL( activated() ),
986 mView, SLOT( toggleAllDaySize() ) ); 986 mView, SLOT( toggleAllDaySize() ) );
987 mToggleAllday = action; 987 mToggleAllday = action;
988 988
989 989
990 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 990 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
991 mToggleNav, SLOT( setEnabled ( bool ) ) ); 991 mToggleNav, SLOT( setEnabled ( bool ) ) );
992 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 992 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
993 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 993 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
994 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 994 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
995 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 995 mToggleAllday, SLOT( setEnabled ( bool ) ) );
996 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 996 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
997 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 997 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
998 998
999 999
1000 dPickerAction->addTo( iconToolBar ); 1000 dPickerAction->addTo( iconToolBar );
1001 viewMenu->insertSeparator(); 1001 viewMenu->insertSeparator();
1002 1002
1003 if ( p-> mShowIconToggleFull ) 1003 if ( p-> mShowIconToggleFull )
1004 FSaction->addTo( iconToolBar ); 1004 FSaction->addTo( iconToolBar );
1005 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 1005 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
1006 1006
1007 //******************** 1007 //********************
1008 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 1008 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
1009 1009
1010 1010
1011 icon = loadPixmap( pathString + "whatsnext" ); 1011 icon = loadPixmap( pathString + "whatsnext" );
1012 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 1012 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
1013 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 1013 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
1014 whatsnext_action->addTo( viewMenu ); 1014 whatsnext_action->addTo( viewMenu );
1015 connect( whatsnext_action, SIGNAL( activated() ), 1015 connect( whatsnext_action, SIGNAL( activated() ),
1016 mView->viewManager(), SLOT( showWhatsNextView() ) ); 1016 mView->viewManager(), SLOT( showWhatsNextView() ) );
1017 1017
1018 icon = loadPixmap( pathString + "xdays" ); 1018 icon = loadPixmap( pathString + "xdays" );
1019 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 1019 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
1020 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 1020 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
1021 xdays_action->addTo( viewMenu ); 1021 xdays_action->addTo( viewMenu );
1022 connect( xdays_action, SIGNAL( activated() ), 1022 connect( xdays_action, SIGNAL( activated() ),
1023 mView->viewManager(), SLOT( showNextXView() ) ); 1023 mView->viewManager(), SLOT( showNextXView() ) );
1024 1024
1025 1025
1026 icon = loadPixmap( pathString + "journal" ); 1026 icon = loadPixmap( pathString + "journal" );
1027 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 1027 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
1028 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 1028 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
1029 viewjournal_action->addTo( viewMenu ); 1029 viewjournal_action->addTo( viewMenu );
1030 connect( viewjournal_action, SIGNAL( activated() ), 1030 connect( viewjournal_action, SIGNAL( activated() ),
1031 mView->viewManager(), SLOT( showJournalView() ) ); 1031 mView->viewManager(), SLOT( showJournalView() ) );
1032 1032
1033 1033
1034 icon = loadPixmap( pathString + "day" ); 1034 icon = loadPixmap( pathString + "day" );
1035 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 1035 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
1036 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 1036 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
1037 day1_action->addTo( viewMenu ); 1037 day1_action->addTo( viewMenu );
1038 // action->addTo( toolBar ); 1038 // action->addTo( toolBar );
1039 connect( day1_action, SIGNAL( activated() ), 1039 connect( day1_action, SIGNAL( activated() ),
1040 mView->viewManager(), SLOT( showDayView() ) ); 1040 mView->viewManager(), SLOT( showDayView() ) );
1041 1041
1042 icon = loadPixmap( pathString + "workweek" ); 1042 icon = loadPixmap( pathString + "workweek" );
1043 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 1043 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
1044 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 1044 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
1045 day5_action->addTo( viewMenu ); 1045 day5_action->addTo( viewMenu );
1046 connect( day5_action, SIGNAL( activated() ), 1046 connect( day5_action, SIGNAL( activated() ),
1047 mView->viewManager(), SLOT( showWorkWeekView() ) ); 1047 mView->viewManager(), SLOT( showWorkWeekView() ) );
1048 1048
1049 icon = loadPixmap( pathString + "week" ); 1049 icon = loadPixmap( pathString + "week" );
1050 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 1050 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
1051 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 1051 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
1052 day7_action->addTo( viewMenu ); 1052 day7_action->addTo( viewMenu );
1053 connect( day7_action, SIGNAL( activated() ), 1053 connect( day7_action, SIGNAL( activated() ),
1054 mView->viewManager(), SLOT( showWeekView() ) ); 1054 mView->viewManager(), SLOT( showWeekView() ) );
1055 1055
1056 icon = loadPixmap( pathString + "workweek2" ); 1056 icon = loadPixmap( pathString + "workweek2" );
1057 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1057 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
1058 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1058 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
1059 day6_action->addTo( viewMenu ); 1059 day6_action->addTo( viewMenu );
1060 connect( day6_action, SIGNAL( activated() ), 1060 connect( day6_action, SIGNAL( activated() ),
1061 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1061 mView->viewManager(), SLOT( showMonthViewWeek() ) );
1062 1062
1063 icon = loadPixmap( pathString + "month" ); 1063 icon = loadPixmap( pathString + "month" );
1064 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1064 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
1065 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1065 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
1066 month_action->addTo( viewMenu ); 1066 month_action->addTo( viewMenu );
1067 connect( month_action, SIGNAL( activated() ), 1067 connect( month_action, SIGNAL( activated() ),
1068 mView->viewManager(), SLOT( showMonthView() ) ); 1068 mView->viewManager(), SLOT( showMonthView() ) );
1069 1069
1070 icon = loadPixmap( pathString + "list" ); 1070 icon = loadPixmap( pathString + "list" );
1071 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1071 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1072 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1072 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
1073 showlist_action->addTo( viewMenu ); 1073 showlist_action->addTo( viewMenu );
1074 connect( showlist_action, SIGNAL( activated() ), 1074 connect( showlist_action, SIGNAL( activated() ),
1075 mView->viewManager(), SLOT( showListView() ) ); 1075 mView->viewManager(), SLOT( showListView() ) );
1076 1076
1077 icon = loadPixmap( pathString + "todo" ); 1077 icon = loadPixmap( pathString + "todo" );
1078 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1078 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1079 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1079 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1080 todoview_action->addTo( viewMenu ); 1080 todoview_action->addTo( viewMenu );
1081 connect( todoview_action, SIGNAL( activated() ), 1081 connect( todoview_action, SIGNAL( activated() ),
1082 mView->viewManager(), SLOT( showTodoView() ) ); 1082 mView->viewManager(), SLOT( showTodoView() ) );
1083 1083
1084 1084
1085 1085
1086#if 0 1086#if 0
1087 action = new QAction( "view_timespan", "Time Span", 0, this ); 1087 action = new QAction( "view_timespan", "Time Span", 0, this );
1088 action->addTo( viewMenu ); 1088 action->addTo( viewMenu );
1089 connect( action, SIGNAL( activated() ), 1089 connect( action, SIGNAL( activated() ),
1090 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1090 mView->viewManager(), SLOT( showTimeSpanView() ) );
1091#endif 1091#endif
1092 1092
1093 1093
1094 1094
1095 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1095 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
1096 this ); 1096 this );
1097 action->addTo( actionMenu ); 1097 action->addTo( actionMenu );
1098 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1098 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1099 1099
1100 1100
1101 icon = loadPixmap( pathString + "search" ); 1101 icon = loadPixmap( pathString + "search" );
1102 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1102 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1103 1103
1104 1104
1105 1105
1106 actionMenu->insertSeparator(); 1106 actionMenu->insertSeparator();
1107 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1107 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1108 this ); 1108 this );
1109 action->addTo( actionMenu ); 1109 action->addTo( actionMenu );
1110 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1110 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1111 1111
1112 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1112 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1113 this ); 1113 this );
1114 action->addTo( actionMenu ); 1114 action->addTo( actionMenu );
1115 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1115 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1116 1116
1117 1117
1118 actionMenu->insertSeparator(); 1118 actionMenu->insertSeparator();
1119 icon = loadPixmap( pathString + "configure" ); 1119 icon = loadPixmap( pathString + "configure" );
1120 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1120 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1121 action->addTo( actionMenu ); 1121 action->addTo( actionMenu );
1122 connect( action, SIGNAL( activated() ), 1122 connect( action, SIGNAL( activated() ),
1123 mView, SLOT( edit_options() ) ); 1123 mView, SLOT( edit_options() ) );
1124 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1124 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1125 action->addTo( actionMenu ); 1125 action->addTo( actionMenu );
1126 connect( action, SIGNAL( activated() ), 1126 connect( action, SIGNAL( activated() ),
1127 this, SLOT( calHint() ) ); 1127 this, SLOT( calHint() ) );
1128 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1128 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1129 action->addTo( actionMenu ); 1129 action->addTo( actionMenu );
1130 connect( action, SIGNAL( activated() ), 1130 connect( action, SIGNAL( activated() ),
1131 mView, SLOT( edit_global_options() ) ); 1131 mView, SLOT( edit_global_options() ) );
1132 if ( KOPrefs::instance()->mShowFullMenu ) { 1132 if ( KOPrefs::instance()->mShowFullMenu ) {
1133 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1133 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1134 1134
1135 } 1135 }
1136 // actionMenu->insertSeparator(); 1136 // actionMenu->insertSeparator();
1137 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1137 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1138 this ); 1138 this );
1139 action->addTo( importMenu_X ); 1139 action->addTo( importMenu_X );
1140 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1140 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1141 action = new QAction( "import_quick", i18n("Import last file"), 0, 1141 action = new QAction( "import_quick", i18n("Import last file"), 0,
1142 this ); 1142 this );
1143 action->addTo( importMenu_X ); 1143 action->addTo( importMenu_X );
1144 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1144 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1145 importMenu_X->insertSeparator(); 1145 importMenu_X->insertSeparator();
1146 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1146 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1147 this ); 1147 this );
1148 action->addTo( importMenu_X ); 1148 action->addTo( importMenu_X );
1149 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1149 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1150 //#ifndef DESKTOP_VERSION 1150 //#ifndef DESKTOP_VERSION
1151 importMenu_X->insertSeparator(); 1151 importMenu_X->insertSeparator();
1152 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1152 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1153 this ); 1153 this );
1154 action->addTo( importMenu_X ); 1154 action->addTo( importMenu_X );
1155 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1155 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1156 //#else 1156 //#else
1157#ifdef _OL_IMPORT_ 1157#ifdef _OL_IMPORT_
1158 importMenu_X->insertSeparator(); 1158 importMenu_X->insertSeparator();
1159 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1159 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1160 this ); 1160 this );
1161 action->addTo( importMenu_X ); 1161 action->addTo( importMenu_X );
1162 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1162 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1163#endif 1163#endif
1164 //#endif 1164 //#endif
1165 1165
1166 //importMenu->insertSeparator(); 1166 //importMenu->insertSeparator();
1167#if 0 1167#if 0
1168 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1168 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1169 this ); 1169 this );
1170 action->addTo( importMenu ); 1170 action->addTo( importMenu );
1171 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1171 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1172#endif 1172#endif
1173 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1173 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1174 this ); 1174 this );