summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/main.cpp2
-rw-r--r--korganizer/mainwindow.cpp6
2 files changed, 3 insertions, 5 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 4b207d9..ee9589c 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -36,75 +36,77 @@ int main( int argc, char **argv )
36 QString hd ("C:/" ); 36 QString hd ("C:/" );
37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); 37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
38 if ( QDir::homeDirPath().lower() == hd.lower() ) { 38 if ( QDir::homeDirPath().lower() == hd.lower() ) {
39 _putenv( "HOME=C:"); 39 _putenv( "HOME=C:");
40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); 40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
41 } 41 }
42 } else { 42 } else {
43 QDir app_dir; 43 QDir app_dir;
44 if ( !app_dir.exists(hdir) ) 44 if ( !app_dir.exists(hdir) )
45 app_dir.mkdir (hdir); 45 app_dir.mkdir (hdir);
46 } 46 }
47#endif 47#endif
48#endif 48#endif
49 bool exitHelp = false; 49 bool exitHelp = false;
50 if ( argc > 1 ) { 50 if ( argc > 1 ) {
51 QString command = argv[1]; 51 QString command = argv[1];
52 if ( command == "-help" ){ 52 if ( command == "-help" ){
53 printf("KO/Pi command line commands:\n"); 53 printf("KO/Pi command line commands:\n");
54 printf(" no command: Start KO/Pi in usual way\n"); 54 printf(" no command: Start KO/Pi in usual way\n");
55 printf(" -help: This output\n"); 55 printf(" -help: This output\n");
56 printf("Next Option: Open or Show after start:\n"); 56 printf("Next Option: Open or Show after start:\n");
57 printf(" -newTodo: New Todo dialog\n"); 57 printf(" -newTodo: New Todo dialog\n");
58 printf(" -newEvent: New Event dialog\n"); 58 printf(" -newEvent: New Event dialog\n");
59 printf(" -showList: List view\n"); 59 printf(" -showList: List view\n");
60 printf(" -showDay: Day view\n"); 60 printf(" -showDay: Day view\n");
61 printf(" -showWWeek: Work Week view\n"); 61 printf(" -showWWeek: Work Week view\n");
62 printf(" -showWeek: Week view\n"); 62 printf(" -showWeek: Week view\n");
63 printf(" -showTodo: Todo view\n"); 63 printf(" -showTodo: Todo view\n");
64 printf(" -showJournal: Journal view\n"); 64 printf(" -showJournal: Journal view\n");
65 printf(" -showKO: Next Days view\n"); 65 printf(" -showKO: Next Days view\n");
66 printf(" -showWNext: What's Next view\n"); 66 printf(" -showWNext: What's Next view\n");
67 printf(" -showNextXView: Next X View\n"); 67 printf(" -showNextXView: Next X View\n");
68 printf(" -new[Y] and -show[X] may be used togehther\n"); 68 printf(" -new[Y] and -show[X] may be used togehther\n");
69 printf(" KO/Pi is exiting now. Bye!\n"); 69 printf(" KO/Pi is exiting now. Bye!\n");
70 exitHelp = true; 70 exitHelp = true;
71 } 71 }
72 } 72 }
73 if ( ! exitHelp ) { 73 if ( ! exitHelp ) {
74 KGlobal::setAppName( "korganizer" ); 74 KGlobal::setAppName( "korganizer" );
75 QString fileName ; 75 QString fileName ;
76#ifndef DESKTOP_VERSION 76#ifndef DESKTOP_VERSION
77 fileName = getenv("QPEDIR"); 77 fileName = getenv("QPEDIR");
78 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 78 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
79#else 79#else
80 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 80 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
81 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 81 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
82#endif 82#endif
83 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 83 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
84
85 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
84 MainWindow m; 86 MainWindow m;
85#ifndef DESKTOP_VERSION 87#ifndef DESKTOP_VERSION
86 88
87 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 89 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
88 a.showMainWidget(&m ); 90 a.showMainWidget(&m );
89#else 91#else
90 a.setMainWidget(&m ); 92 a.setMainWidget(&m );
91 m.show(); 93 m.show();
92 //m.resize( 800, 600 ); 94 //m.resize( 800, 600 );
93 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 95 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
94#endif 96#endif
95 if ( argc > 1 ) { 97 if ( argc > 1 ) {
96 QCString command = argv[1]; 98 QCString command = argv[1];
97 if ( argc > 2 ) 99 if ( argc > 2 )
98 command += argv[2]; 100 command += argv[2];
99 qApp->processEvents(); 101 qApp->processEvents();
100 m.recieve(command, QByteArray() ); 102 m.recieve(command, QByteArray() );
101 103
102 } 104 }
103 105
104 a.exec(); 106 a.exec();
105 dumpMissing(); 107 dumpMissing();
106 108
107 KPimGlobalPrefs::instance()->writeConfig(); 109 KPimGlobalPrefs::instance()->writeConfig();
108 } 110 }
109 qDebug("KO: Bye! "); 111 qDebug("KO: Bye! ");
110} 112}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 18a4b12..ab0e4d6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -87,101 +87,97 @@ class KOex2phonePrefs : public QDialog
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
131int globalFlagBlockStartup; 131int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 133 QMainWindow( parent, name )
134{ 134{
135 135
136
137#ifdef DESKTOP_VERSION
138 setFont( QFont("Arial"), 14 );
139#endif
140 mClosed = false; 136 mClosed = false;
141 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
142 QString confFile = locateLocal("config","korganizerrc"); 138 QString confFile = locateLocal("config","korganizerrc");
143 QFileInfo finf ( confFile ); 139 QFileInfo finf ( confFile );
144 bool showWarning = !finf.exists(); 140 bool showWarning = !finf.exists();
145 setIcon(SmallIcon( "ko24" ) ); 141 setIcon(SmallIcon( "ko24" ) );
146 mBlockAtStartup = true; 142 mBlockAtStartup = true;
147 mFlagKeyPressed = false; 143 mFlagKeyPressed = false;
148 setCaption("KOrganizer/Pi"); 144 setCaption("KOrganizer/Pi");
149 KOPrefs *p = KOPrefs::instance(); 145 KOPrefs *p = KOPrefs::instance();
150 KPimGlobalPrefs::instance()->setGlobalConfig(); 146 KPimGlobalPrefs::instance()->setGlobalConfig();
151 if ( p->mHourSize > 22 ) 147 if ( p->mHourSize > 22 )
152 p->mHourSize = 22; 148 p->mHourSize = 22;
153 QMainWindow::ToolBarDock tbd; 149 QMainWindow::ToolBarDock tbd;
154 if ( p->mToolBarHor ) { 150 if ( p->mToolBarHor ) {
155 if ( p->mToolBarUp ) 151 if ( p->mToolBarUp )
156 tbd = Bottom; 152 tbd = Bottom;
157 else 153 else
158 tbd = Top; 154 tbd = Top;
159 } 155 }
160 else { 156 else {
161 if ( p->mToolBarUp ) 157 if ( p->mToolBarUp )
162 tbd = Right; 158 tbd = Right;
163 else 159 else
164 tbd = Left; 160 tbd = Left;
165 } 161 }
166 if ( KOPrefs::instance()->mUseAppColors ) 162 if ( KOPrefs::instance()->mUseAppColors )
167 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
168 globalFlagBlockStartup = 1; 164 globalFlagBlockStartup = 1;
169 iconToolBar = new QPEToolBar( this ); 165 iconToolBar = new QPEToolBar( this );
170 addToolBar (iconToolBar , tbd ); 166 addToolBar (iconToolBar , tbd );
171 mCalendarModifiedFlag = false; 167 mCalendarModifiedFlag = false;
172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
173 splash->setAlignment ( AlignCenter ); 169 splash->setAlignment ( AlignCenter );
174 setCentralWidget( splash ); 170 setCentralWidget( splash );
175#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
176 showMaximized(); 172 showMaximized();
177#endif 173#endif
178 174
179 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
180 setDefaultPreferences(); 176 setDefaultPreferences();
181 mCalendar = new CalendarLocal(); 177 mCalendar = new CalendarLocal();
182 mView = new CalendarView( mCalendar, this,"mCalendar " ); 178 mView = new CalendarView( mCalendar, this,"mCalendar " );
183 mView->hide(); 179 mView->hide();
184 //mView->resize(splash->size() ); 180 //mView->resize(splash->size() );
185 initActions(); 181 initActions();
186 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
187 mSyncManager->setBlockSave(false); 183 mSyncManager->setBlockSave(false);