summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
authorzautrix <zautrix>2005-02-11 05:36:14 (UTC)
committer zautrix <zautrix>2005-02-11 05:36:14 (UTC)
commit0c1191e3253542b4858261241975c159ee7910c6 (patch) (unidiff)
treebe97b6665d130f0b72db82005726fbf7cc030abb /korganizer/mainwindow.cpp
parent38c6a7b6ae1e98cba0fdf2d0fba59ad4b9060940 (diff)
downloadkdepimpi-0c1191e3253542b4858261241975c159ee7910c6.zip
kdepimpi-0c1191e3253542b4858261241975c159ee7910c6.tar.gz
kdepimpi-0c1191e3253542b4858261241975c159ee7910c6.tar.bz2
font fixes
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 18a4b12..ab0e4d6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -39,197 +39,193 @@
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.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
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);
188 mView->setSyncManager(mSyncManager); 184 mView->setSyncManager(mSyncManager);
189#ifndef DESKTOP_VERSION 185#ifndef DESKTOP_VERSION
190 iconToolBar->show(); 186 iconToolBar->show();
191 qApp->processEvents(); 187 qApp->processEvents();
192#endif 188#endif
193 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
194 int vh = height() ; 190 int vh = height() ;
195 int vw = width(); 191 int vw = width();
196 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 192 //qDebug("Toolbar hei %d ",iconToolBar->height() );
197 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 193 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
198 vh -= iconToolBar->height(); 194 vh -= iconToolBar->height();
199 } else { 195 } else {
200 vw -= iconToolBar->height(); 196 vw -= iconToolBar->height();
201 } 197 }
202 //mView->setMaximumSize( splash->size() ); 198 //mView->setMaximumSize( splash->size() );
203 //mView->resize( splash->size() ); 199 //mView->resize( splash->size() );
204 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
205 mView->readSettings(); 201 mView->readSettings();
206 bool newFile = false; 202 bool newFile = false;
207 if( !QFile::exists( defaultFileName() ) ) { 203 if( !QFile::exists( defaultFileName() ) ) {
208 QFileInfo finfo ( defaultFileName() ); 204 QFileInfo finfo ( defaultFileName() );
209 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
210 qDebug("oldfile %s ", oldFile.latin1()); 206 qDebug("oldfile %s ", oldFile.latin1());
211 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"; 207 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";
212 finfo.setFile( oldFile ); 208 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 209 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 210 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 211 mView->openCalendar( oldFile );
216 qApp->processEvents(); 212 qApp->processEvents();
217 } else { 213 } else {
218 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
219 finfo.setFile( oldFile ); 215 finfo.setFile( oldFile );
220 if (finfo.exists() ) { 216 if (finfo.exists() ) {
221 KMessageBox::information( this, message); 217 KMessageBox::information( this, message);
222 mView->openCalendar( oldFile ); 218 mView->openCalendar( oldFile );
223 qApp->processEvents(); 219 qApp->processEvents();
224 } 220 }
225 } 221 }
226 mView->saveCalendar( defaultFileName() ); 222 mView->saveCalendar( defaultFileName() );
227 newFile = true; 223 newFile = true;
228 } 224 }
229 225
230 QTime neededSaveTime = QDateTime::currentDateTime().time(); 226 QTime neededSaveTime = QDateTime::currentDateTime().time();
231 mView->openCalendar( defaultFileName() ); 227 mView->openCalendar( defaultFileName() );
232 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
233 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 229 qDebug("KO: Calendar loading time: %d ms",msNeeded );
234 230
235 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {