-rw-r--r-- | korganizer/calendarview.cpp | 8 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/main.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 59 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 12 |
5 files changed, 77 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 884c61a..0306e07 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1189,165 +1189,169 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1189 | void CalendarView::setSyncDevice( QString s ) | 1189 | void CalendarView::setSyncDevice( QString s ) |
1190 | { | 1190 | { |
1191 | mCurrentSyncDevice= s; | 1191 | mCurrentSyncDevice= s; |
1192 | } | 1192 | } |
1193 | void CalendarView::setSyncName( QString s ) | 1193 | void CalendarView::setSyncName( QString s ) |
1194 | { | 1194 | { |
1195 | mCurrentSyncName= s; | 1195 | mCurrentSyncName= s; |
1196 | } | 1196 | } |
1197 | bool CalendarView::syncCalendar(QString filename, int mode) | 1197 | bool CalendarView::syncCalendar(QString filename, int mode) |
1198 | { | 1198 | { |
1199 | //qDebug("syncCalendar %s ", filename.latin1()); | 1199 | //qDebug("syncCalendar %s ", filename.latin1()); |
1200 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1200 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1201 | CalendarLocal* calendar = new CalendarLocal(); | 1201 | CalendarLocal* calendar = new CalendarLocal(); |
1202 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1202 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1203 | FileStorage* storage = new FileStorage( calendar ); | 1203 | FileStorage* storage = new FileStorage( calendar ); |
1204 | bool syncOK = false; | 1204 | bool syncOK = false; |
1205 | storage->setFileName( filename ); | 1205 | storage->setFileName( filename ); |
1206 | // qDebug("loading ... "); | 1206 | // qDebug("loading ... "); |
1207 | if ( storage->load() ) { | 1207 | if ( storage->load() ) { |
1208 | getEventViewerDialog()->setSyncMode( true ); | 1208 | getEventViewerDialog()->setSyncMode( true ); |
1209 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1209 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1210 | getEventViewerDialog()->setSyncMode( false ); | 1210 | getEventViewerDialog()->setSyncMode( false ); |
1211 | if ( syncOK ) { | 1211 | if ( syncOK ) { |
1212 | if ( mSyncManager->mWriteBackFile ) | 1212 | if ( mSyncManager->mWriteBackFile ) |
1213 | { | 1213 | { |
1214 | storage->setSaveFormat( new ICalFormat() ); | 1214 | storage->setSaveFormat( new ICalFormat() ); |
1215 | storage->save(); | 1215 | storage->save(); |
1216 | } | 1216 | } |
1217 | } | 1217 | } |
1218 | setModified( true ); | 1218 | setModified( true ); |
1219 | } | 1219 | } |
1220 | delete storage; | 1220 | delete storage; |
1221 | delete calendar; | 1221 | delete calendar; |
1222 | if ( syncOK ) | 1222 | if ( syncOK ) |
1223 | updateView(); | 1223 | updateView(); |
1224 | return syncOK; | 1224 | return syncOK; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | void CalendarView::syncExternal( int mode ) | 1227 | void CalendarView::syncExternal( int mode ) |
1228 | { | 1228 | { |
1229 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1229 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1230 | 1230 | ||
1231 | qApp->processEvents(); | 1231 | qApp->processEvents(); |
1232 | CalendarLocal* calendar = new CalendarLocal(); | 1232 | CalendarLocal* calendar = new CalendarLocal(); |
1233 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1233 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1234 | bool syncOK = false; | 1234 | bool syncOK = false; |
1235 | bool loadSuccess = false; | 1235 | bool loadSuccess = false; |
1236 | PhoneFormat* phoneFormat = 0; | 1236 | PhoneFormat* phoneFormat = 0; |
1237 | emit tempDisableBR(true); | ||
1237 | #ifndef DESKTOP_VERSION | 1238 | #ifndef DESKTOP_VERSION |
1238 | SharpFormat* sharpFormat = 0; | 1239 | SharpFormat* sharpFormat = 0; |
1239 | if ( mode == 0 ) { // sharp | 1240 | if ( mode == 0 ) { // sharp |
1240 | sharpFormat = new SharpFormat () ; | 1241 | sharpFormat = new SharpFormat () ; |
1241 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1242 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1242 | 1243 | ||
1243 | } else | 1244 | } else |
1244 | #endif | 1245 | #endif |
1245 | if ( mode == 1 ) { // phone | 1246 | if ( mode == 1 ) { // phone |
1246 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1247 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1247 | mSyncManager->mPhoneDevice, | 1248 | mSyncManager->mPhoneDevice, |
1248 | mSyncManager->mPhoneConnection, | 1249 | mSyncManager->mPhoneConnection, |
1249 | mSyncManager->mPhoneModel); | 1250 | mSyncManager->mPhoneModel); |
1250 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1251 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1251 | 1252 | ||
1252 | } else | 1253 | } else { |
1253 | return; | 1254 | emit tempDisableBR(false); |
1255 | return; | ||
1256 | } | ||
1254 | if ( loadSuccess ) { | 1257 | if ( loadSuccess ) { |
1255 | getEventViewerDialog()->setSyncMode( true ); | 1258 | getEventViewerDialog()->setSyncMode( true ); |
1256 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1259 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1257 | getEventViewerDialog()->setSyncMode( false ); | 1260 | getEventViewerDialog()->setSyncMode( false ); |
1258 | qApp->processEvents(); | 1261 | qApp->processEvents(); |
1259 | if ( syncOK ) { | 1262 | if ( syncOK ) { |
1260 | if ( mSyncManager->mWriteBackFile ) | 1263 | if ( mSyncManager->mWriteBackFile ) |
1261 | { | 1264 | { |
1262 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1265 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1263 | Incidence* inc = iL.first(); | 1266 | Incidence* inc = iL.first(); |
1264 | if ( phoneFormat ) { | 1267 | if ( phoneFormat ) { |
1265 | while ( inc ) { | 1268 | while ( inc ) { |
1266 | inc->removeID(mCurrentSyncDevice); | 1269 | inc->removeID(mCurrentSyncDevice); |
1267 | inc = iL.next(); | 1270 | inc = iL.next(); |
1268 | } | 1271 | } |
1269 | } | 1272 | } |
1270 | #ifndef DESKTOP_VERSION | 1273 | #ifndef DESKTOP_VERSION |
1271 | if ( sharpFormat ) | 1274 | if ( sharpFormat ) |
1272 | sharpFormat->save(calendar); | 1275 | sharpFormat->save(calendar); |
1273 | #endif | 1276 | #endif |
1274 | if ( phoneFormat ) | 1277 | if ( phoneFormat ) |
1275 | phoneFormat->save(calendar); | 1278 | phoneFormat->save(calendar); |
1276 | iL = calendar->rawIncidences(); | 1279 | iL = calendar->rawIncidences(); |
1277 | inc = iL.first(); | 1280 | inc = iL.first(); |
1278 | Incidence* loc; | 1281 | Incidence* loc; |
1279 | while ( inc ) { | 1282 | while ( inc ) { |
1280 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1283 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1281 | loc = mCalendar->incidence(inc->uid() ); | 1284 | loc = mCalendar->incidence(inc->uid() ); |
1282 | if ( loc ) { | 1285 | if ( loc ) { |
1283 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1286 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1284 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1287 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1285 | } | 1288 | } |
1286 | } | 1289 | } |
1287 | inc = iL.next(); | 1290 | inc = iL.next(); |
1288 | } | 1291 | } |
1289 | Incidence* lse = getLastSyncEvent(); | 1292 | Incidence* lse = getLastSyncEvent(); |
1290 | if ( lse ) { | 1293 | if ( lse ) { |
1291 | lse->setReadOnly( false ); | 1294 | lse->setReadOnly( false ); |
1292 | lse->setDescription( "" ); | 1295 | lse->setDescription( "" ); |
1293 | lse->setReadOnly( true ); | 1296 | lse->setReadOnly( true ); |
1294 | } | 1297 | } |
1295 | } | 1298 | } |
1296 | } | 1299 | } |
1297 | setModified( true ); | 1300 | setModified( true ); |
1298 | } else { | 1301 | } else { |
1299 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1302 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1300 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1303 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1301 | question, i18n("Ok")) ; | 1304 | question, i18n("Ok")) ; |
1302 | 1305 | ||
1303 | } | 1306 | } |
1304 | delete calendar; | 1307 | delete calendar; |
1305 | updateView(); | 1308 | updateView(); |
1309 | emit tempDisableBR(false); | ||
1306 | return ;//syncOK; | 1310 | return ;//syncOK; |
1307 | 1311 | ||
1308 | } | 1312 | } |
1309 | 1313 | ||
1310 | bool CalendarView::importBday() | 1314 | bool CalendarView::importBday() |
1311 | { | 1315 | { |
1312 | #ifndef KORG_NOKABC | 1316 | #ifndef KORG_NOKABC |
1313 | 1317 | ||
1314 | #ifdef DESKTOP_VERSION | 1318 | #ifdef DESKTOP_VERSION |
1315 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1319 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1316 | KABC::AddressBook::Iterator it; | 1320 | KABC::AddressBook::Iterator it; |
1317 | int count = 0; | 1321 | int count = 0; |
1318 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1322 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1319 | ++count; | 1323 | ++count; |
1320 | } | 1324 | } |
1321 | QProgressBar bar(count,0 ); | 1325 | QProgressBar bar(count,0 ); |
1322 | int w = 300; | 1326 | int w = 300; |
1323 | if ( QApplication::desktop()->width() < 320 ) | 1327 | if ( QApplication::desktop()->width() < 320 ) |
1324 | w = 220; | 1328 | w = 220; |
1325 | int h = bar.sizeHint().height() ; | 1329 | int h = bar.sizeHint().height() ; |
1326 | int dw = QApplication::desktop()->width(); | 1330 | int dw = QApplication::desktop()->width(); |
1327 | int dh = QApplication::desktop()->height(); | 1331 | int dh = QApplication::desktop()->height(); |
1328 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1332 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1329 | bar.show(); | 1333 | bar.show(); |
1330 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1334 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1331 | qApp->processEvents(); | 1335 | qApp->processEvents(); |
1332 | count = 0; | 1336 | count = 0; |
1333 | int addCount = 0; | 1337 | int addCount = 0; |
1334 | KCal::Attendee* a = 0; | 1338 | KCal::Attendee* a = 0; |
1335 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1339 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1336 | if ( ! bar.isVisible() ) | 1340 | if ( ! bar.isVisible() ) |
1337 | return false; | 1341 | return false; |
1338 | bar.setProgress( count++ ); | 1342 | bar.setProgress( count++ ); |
1339 | qApp->processEvents(); | 1343 | qApp->processEvents(); |
1340 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1344 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1341 | if ( (*it).birthday().date().isValid() ){ | 1345 | if ( (*it).birthday().date().isValid() ){ |
1342 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1346 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1343 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1347 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1344 | ++addCount; | 1348 | ++addCount; |
1345 | } | 1349 | } |
1346 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1350 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1347 | if ( anni.isValid() ){ | 1351 | if ( anni.isValid() ){ |
1348 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1352 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1349 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1353 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1350 | ++addCount; | 1354 | ++addCount; |
1351 | } | 1355 | } |
1352 | } | 1356 | } |
1353 | updateView(); | 1357 | updateView(); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 1cd896d..2818ee9 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -72,96 +72,97 @@ using namespace KCal; | |||
72 | 72 | ||
73 | /** | 73 | /** |
74 | This is the main calendar widget. It provides the different vies on t he | 74 | This is the main calendar widget. It provides the different vies on t he |
75 | calendar data as well as the date navigator. It also handles synchronisation | 75 | calendar data as well as the date navigator. It also handles synchronisation |
76 | of the different views and controls the different dialogs like preferences, | 76 | of the different views and controls the different dialogs like preferences, |
77 | event editor, search dialog etc. | 77 | event editor, search dialog etc. |
78 | 78 | ||
79 | @short main calendar view widget | 79 | @short main calendar view widget |
80 | @author Cornelius Schumacher | 80 | @author Cornelius Schumacher |
81 | */ | 81 | */ |
82 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 82 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
83 | { | 83 | { |
84 | Q_OBJECT | 84 | Q_OBJECT |
85 | public: | 85 | public: |
86 | /** | 86 | /** |
87 | Constructs a new calendar view widget. | 87 | Constructs a new calendar view widget. |
88 | 88 | ||
89 | @param calendar calendar document | 89 | @param calendar calendar document |
90 | @param parent parent window | 90 | @param parent parent window |
91 | @param name Qt internal widget object name | 91 | @param name Qt internal widget object name |
92 | */ | 92 | */ |
93 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 93 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 95 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
96 | const char *name = 0 ); | 96 | const char *name = 0 ); |
97 | virtual ~CalendarView(); | 97 | virtual ~CalendarView(); |
98 | 98 | ||
99 | Calendar *calendar() { return mCalendar; } | 99 | Calendar *calendar() { return mCalendar; } |
100 | 100 | ||
101 | KOViewManager *viewManager(); | 101 | KOViewManager *viewManager(); |
102 | KODialogManager *dialogManager(); | 102 | KODialogManager *dialogManager(); |
103 | 103 | ||
104 | QDate startDate(); | 104 | QDate startDate(); |
105 | QDate endDate(); | 105 | QDate endDate(); |
106 | 106 | ||
107 | QWidgetStack *viewStack(); | 107 | QWidgetStack *viewStack(); |
108 | QWidget *leftFrame(); | 108 | QWidget *leftFrame(); |
109 | NavigatorBar *navigatorBar(); | 109 | NavigatorBar *navigatorBar(); |
110 | 110 | ||
111 | DateNavigator *dateNavigator(); | 111 | DateNavigator *dateNavigator(); |
112 | KDateNavigator *dateNavigatorWidget(); | 112 | KDateNavigator *dateNavigatorWidget(); |
113 | 113 | ||
114 | void addView(KOrg::BaseView *); | 114 | void addView(KOrg::BaseView *); |
115 | void showView(KOrg::BaseView *); | 115 | void showView(KOrg::BaseView *); |
116 | KOEventViewerDialog* getEventViewerDialog(); | 116 | KOEventViewerDialog* getEventViewerDialog(); |
117 | Incidence *currentSelection(); | 117 | Incidence *currentSelection(); |
118 | 118 | ||
119 | signals: | 119 | signals: |
120 | void tempDisableBR(bool); | ||
120 | /** This todo has been modified */ | 121 | /** This todo has been modified */ |
121 | void todoModified(Todo *, int); | 122 | void todoModified(Todo *, int); |
122 | 123 | ||
123 | /** when change is made to options dialog, the topwidget will catch this | 124 | /** when change is made to options dialog, the topwidget will catch this |
124 | * and emit this signal which notifies all widgets which have registered | 125 | * and emit this signal which notifies all widgets which have registered |
125 | * for notification to update their settings. */ | 126 | * for notification to update their settings. */ |
126 | void configChanged(); | 127 | void configChanged(); |
127 | /** emitted when the topwidget is closing down, so that any attached | 128 | /** emitted when the topwidget is closing down, so that any attached |
128 | child windows can also close. */ | 129 | child windows can also close. */ |
129 | void closingDown(); | 130 | void closingDown(); |
130 | /** emitted right before we die */ | 131 | /** emitted right before we die */ |
131 | void closed(QWidget *); | 132 | void closed(QWidget *); |
132 | 133 | ||
133 | /** Emitted when state of modified flag changes */ | 134 | /** Emitted when state of modified flag changes */ |
134 | void modifiedChanged(bool); | 135 | void modifiedChanged(bool); |
135 | void signalmodified(); | 136 | void signalmodified(); |
136 | 137 | ||
137 | /** Emitted when state of read-only flag changes */ | 138 | /** Emitted when state of read-only flag changes */ |
138 | void readOnlyChanged(bool); | 139 | void readOnlyChanged(bool); |
139 | 140 | ||
140 | /** Emitted when the unit of navigation changes */ | 141 | /** Emitted when the unit of navigation changes */ |
141 | void changeNavStringPrev(const QString &); | 142 | void changeNavStringPrev(const QString &); |
142 | void changeNavStringNext(const QString &); | 143 | void changeNavStringNext(const QString &); |
143 | 144 | ||
144 | /** Emitted when state of events selection has changed and user is organizer*/ | 145 | /** Emitted when state of events selection has changed and user is organizer*/ |
145 | void organizerEventsSelected(bool); | 146 | void organizerEventsSelected(bool); |
146 | /** Emitted when state of events selection has changed and user is attendee*/ | 147 | /** Emitted when state of events selection has changed and user is attendee*/ |
147 | void groupEventsSelected(bool); | 148 | void groupEventsSelected(bool); |
148 | /** | 149 | /** |
149 | Emitted when an incidence gets selected. If the selection is cleared the | 150 | Emitted when an incidence gets selected. If the selection is cleared the |
150 | signal is emitted with 0 as argument. | 151 | signal is emitted with 0 as argument. |
151 | */ | 152 | */ |
152 | void incidenceSelected( Incidence * ); | 153 | void incidenceSelected( Incidence * ); |
153 | /** Emitted, when a todoitem is selected or deselected. */ | 154 | /** Emitted, when a todoitem is selected or deselected. */ |
154 | void todoSelected( bool ); | 155 | void todoSelected( bool ); |
155 | 156 | ||
156 | /** | 157 | /** |
157 | Emitted, when clipboard content changes. Parameter indicates if paste | 158 | Emitted, when clipboard content changes. Parameter indicates if paste |
158 | is possible or not. | 159 | is possible or not. |
159 | */ | 160 | */ |
160 | void pasteEnabled(bool); | 161 | void pasteEnabled(bool); |
161 | 162 | ||
162 | /** Emitted, when the number of incoming messages has changed. */ | 163 | /** Emitted, when the number of incoming messages has changed. */ |
163 | void numIncomingChanged(int); | 164 | void numIncomingChanged(int); |
164 | 165 | ||
165 | /** Emitted, when the number of outgoing messages has changed. */ | 166 | /** Emitted, when the number of outgoing messages has changed. */ |
166 | void numOutgoingChanged(int); | 167 | void numOutgoingChanged(int); |
167 | 168 | ||
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 16186c0..c8a55d2 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -35,74 +35,70 @@ int main( int argc, char **argv ) | |||
35 | QDir app_dir; | 35 | QDir app_dir; |
36 | if ( !app_dir.exists("C:\\kdepim") ) | 36 | if ( !app_dir.exists("C:\\kdepim") ) |
37 | app_dir.mkdir ("C:\\kdepim"); | 37 | app_dir.mkdir ("C:\\kdepim"); |
38 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 38 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
39 | app_dir.mkdir ("C:\\kdepim\\apps"); | 39 | app_dir.mkdir ("C:\\kdepim\\apps"); |
40 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 40 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
41 | app_dir.mkdir ("C:\\kdepim\\config"); | 41 | app_dir.mkdir ("C:\\kdepim\\config"); |
42 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) | 42 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) |
43 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); | 43 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); |
44 | } | 44 | } |
45 | #endif | 45 | #endif |
46 | bool exitHelp = false; | 46 | bool exitHelp = false; |
47 | if ( argc > 1 ) { | 47 | if ( argc > 1 ) { |
48 | QString command = argv[1]; | 48 | QString command = argv[1]; |
49 | if ( command == "-help" ){ | 49 | if ( command == "-help" ){ |
50 | printf("KO/Pi command line commands:\n"); | 50 | printf("KO/Pi command line commands:\n"); |
51 | printf(" no command: Start KO/Pi in usual way\n"); | 51 | printf(" no command: Start KO/Pi in usual way\n"); |
52 | printf(" -help: This output\n"); | 52 | printf(" -help: This output\n"); |
53 | printf("Next Option: Open or Show after start:\n"); | 53 | printf("Next Option: Open or Show after start:\n"); |
54 | printf(" -newTodo: New Todo dialog\n"); | 54 | printf(" -newTodo: New Todo dialog\n"); |
55 | printf(" -newEvent: New Event dialog\n"); | 55 | printf(" -newEvent: New Event dialog\n"); |
56 | printf(" -showList: List view\n"); | 56 | printf(" -showList: List view\n"); |
57 | printf(" -showDay: Day view\n"); | 57 | printf(" -showDay: Day view\n"); |
58 | printf(" -showWWeek: Work Week view\n"); | 58 | printf(" -showWWeek: Work Week view\n"); |
59 | printf(" -showWeek: Week view\n"); | 59 | printf(" -showWeek: Week view\n"); |
60 | printf(" -showTodo: Todo view\n"); | 60 | printf(" -showTodo: Todo view\n"); |
61 | printf(" -showJournal: Journal view\n"); | 61 | printf(" -showJournal: Journal view\n"); |
62 | printf(" -showKO: Next Days view\n"); | 62 | printf(" -showKO: Next Days view\n"); |
63 | printf(" -showWNext: What's Next view\n"); | 63 | printf(" -showWNext: What's Next view\n"); |
64 | printf(" -showNextXView: Next X View\n"); | 64 | printf(" -showNextXView: Next X View\n"); |
65 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 65 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
66 | printf(" KO/Pi is exiting now. Bye!\n"); | 66 | printf(" KO/Pi is exiting now. Bye!\n"); |
67 | exitHelp = true; | 67 | exitHelp = true; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | if ( ! exitHelp ) { | 70 | if ( ! exitHelp ) { |
71 | KGlobal::setAppName( "korganizer" ); | 71 | KGlobal::setAppName( "korganizer" ); |
72 | QString fileName ; | 72 | QString fileName ; |
73 | #ifndef DESKTOP_VERSION | 73 | #ifndef DESKTOP_VERSION |
74 | fileName = getenv("QPEDIR"); | 74 | fileName = getenv("QPEDIR"); |
75 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 75 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
76 | #else | 76 | #else |
77 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 77 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
78 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 78 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
79 | #endif | 79 | #endif |
80 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 80 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
81 | MainWindow m; | 81 | MainWindow m; |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; | 83 | |
84 | QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
85 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 84 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
86 | a.showMainWidget(&m ); | 85 | a.showMainWidget(&m ); |
87 | #else | 86 | #else |
88 | a.setMainWidget(&m ); | 87 | a.setMainWidget(&m ); |
89 | m.show(); | 88 | m.show(); |
90 | //m.resize( 800, 600 ); | 89 | //m.resize( 800, 600 ); |
91 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 90 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
92 | #endif | 91 | #endif |
93 | if ( argc > 1 ) { | 92 | if ( argc > 1 ) { |
94 | QCString command = argv[1]; | 93 | QCString command = argv[1]; |
95 | if ( argc > 2 ) | 94 | if ( argc > 2 ) |
96 | command += argv[2]; | 95 | command += argv[2]; |
97 | qApp->processEvents(); | 96 | qApp->processEvents(); |
98 | m.recieve(command, QByteArray() ); | 97 | m.recieve(command, QByteArray() ); |
99 | 98 | ||
100 | } | 99 | } |
101 | a.exec(); | 100 | a.exec(); |
102 | #ifndef DESKTOP_VERSION | ||
103 | delete c1; | ||
104 | #endif | ||
105 | 101 | ||
106 | } | 102 | } |
107 | qDebug("KO: Bye! "); | 103 | qDebug("KO: Bye! "); |
108 | } | 104 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 02ca523..9e215b9 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -192,142 +192,193 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
192 | } else { | 192 | } else { |
193 | vw -= iconToolBar->height(); | 193 | vw -= iconToolBar->height(); |
194 | } | 194 | } |
195 | //mView->setMaximumSize( splash->size() ); | 195 | //mView->setMaximumSize( splash->size() ); |
196 | //mView->resize( splash->size() ); | 196 | //mView->resize( splash->size() ); |
197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
198 | mView->readSettings(); | 198 | mView->readSettings(); |
199 | bool newFile = false; | 199 | bool newFile = false; |
200 | if( !QFile::exists( defaultFileName() ) ) { | 200 | if( !QFile::exists( defaultFileName() ) ) { |
201 | QFileInfo finfo ( defaultFileName() ); | 201 | QFileInfo finfo ( defaultFileName() ); |
202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
203 | qDebug("oldfile %s ", oldFile.latin1()); | 203 | qDebug("oldfile %s ", oldFile.latin1()); |
204 | 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"; | 204 | 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"; |
205 | finfo.setFile( oldFile ); | 205 | finfo.setFile( oldFile ); |
206 | if (finfo.exists() ) { | 206 | if (finfo.exists() ) { |
207 | KMessageBox::information( this, message); | 207 | KMessageBox::information( this, message); |
208 | mView->openCalendar( oldFile ); | 208 | mView->openCalendar( oldFile ); |
209 | qApp->processEvents(); | 209 | qApp->processEvents(); |
210 | } else { | 210 | } else { |
211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
212 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
213 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
214 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
215 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
216 | qApp->processEvents(); | 216 | qApp->processEvents(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | mView->saveCalendar( defaultFileName() ); | 219 | mView->saveCalendar( defaultFileName() ); |
220 | newFile = true; | 220 | newFile = true; |
221 | } | 221 | } |
222 | 222 | ||
223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
224 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
227 | 227 | ||
228 | if ( KOPrefs::instance()->mLanguageChanged ) { | 228 | if ( KOPrefs::instance()->mLanguageChanged ) { |
229 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
230 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
231 | KOPrefs::instance()->mLanguageChanged = false; | 231 | KOPrefs::instance()->mLanguageChanged = false; |
232 | } | 232 | } |
233 | processIncidenceSelection( 0 ); | 233 | processIncidenceSelection( 0 ); |
234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
235 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 235 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
237 | SLOT( slotModifiedChanged( bool ) ) ); | 237 | SLOT( slotModifiedChanged( bool ) ) ); |
238 | 238 | ||
239 | 239 | ||
240 | connect( mView, SIGNAL( tempDisableBR(bool) ), | ||
241 | SLOT( disableBR(bool) ) ); | ||
240 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 242 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
241 | mView->setModified( false ); | 243 | mView->setModified( false ); |
242 | mBlockAtStartup = false; | 244 | mBlockAtStartup = false; |
243 | mView->setModified( false ); | 245 | mView->setModified( false ); |
244 | setCentralWidget( mView ); | 246 | setCentralWidget( mView ); |
245 | globalFlagBlockStartup = 0; | 247 | globalFlagBlockStartup = 0; |
246 | mView->show(); | 248 | mView->show(); |
247 | delete splash; | 249 | delete splash; |
248 | if ( newFile ) | 250 | if ( newFile ) |
249 | mView->updateConfig(); | 251 | mView->updateConfig(); |
250 | // qApp->processEvents(); | 252 | // qApp->processEvents(); |
251 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 253 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
252 | //fillSyncMenu(); | 254 | //fillSyncMenu(); |
253 | 255 | ||
254 | 256 | ||
255 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 257 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
256 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 258 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
257 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 259 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
258 | mSyncManager->setDefaultFileName( defaultFileName()); | 260 | mSyncManager->setDefaultFileName( defaultFileName()); |
259 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 261 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
260 | mSyncManager->fillSyncMenu(); | 262 | mSyncManager->fillSyncMenu(); |
261 | 263 | ||
262 | 264 | ||
263 | 265 | ||
264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 266 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
265 | if ( showWarning ) { | 267 | if ( showWarning ) { |
266 | KMessageBox::information( this, | 268 | KMessageBox::information( this, |
267 | "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"); | 269 | "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"); |
268 | qApp->processEvents(); | 270 | qApp->processEvents(); |
269 | mView->dialogManager()->showSyncOptions(); | 271 | mView->dialogManager()->showSyncOptions(); |
270 | } | 272 | } |
271 | 273 | ||
272 | //US listen for result adressed from Ka/Pi | 274 | //US listen for result adressed from Ka/Pi |
273 | #ifndef DESKTOP_VERSION | 275 | #ifndef DESKTOP_VERSION |
274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 276 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
275 | #endif | 277 | #endif |
276 | 278 | #ifndef DESKTOP_VERSION | |
279 | infrared = 0; | ||
280 | #endif | ||
281 | |||
282 | mBRdisabled = false; | ||
283 | toggleBeamReceive(); | ||
277 | } | 284 | } |
278 | MainWindow::~MainWindow() | 285 | MainWindow::~MainWindow() |
279 | { | 286 | { |
280 | //qDebug("MainWindow::~MainWindow() "); | 287 | //qDebug("MainWindow::~MainWindow() "); |
281 | //save toolbar location | 288 | //save toolbar location |
282 | delete mCalendar; | 289 | delete mCalendar; |
283 | delete mSyncManager; | 290 | delete mSyncManager; |
291 | if ( infrared ) | ||
292 | delete infrared; | ||
293 | |||
294 | |||
295 | } | ||
296 | |||
297 | void MainWindow::disableBR(bool b) | ||
298 | { | ||
299 | if ( b ) { | ||
300 | if ( infrared ) { | ||
301 | toggleBeamReceive(); | ||
302 | mBRdisabled = true; | ||
303 | } | ||
304 | } else { | ||
305 | if ( mBRdisabled ) { | ||
306 | mBRdisabled = false; | ||
307 | toggleBeamReceive(); | ||
308 | } | ||
309 | } | ||
284 | 310 | ||
311 | } | ||
312 | bool MainWindow::beamReceiveEnabled() | ||
313 | { | ||
314 | #ifndef DESKTOP_VERSION | ||
315 | return ( infrared != 0 ); | ||
316 | #endif | ||
317 | return false; | ||
318 | } | ||
285 | 319 | ||
320 | void MainWindow::toggleBeamReceive() | ||
321 | { | ||
322 | if ( mBRdisabled ) | ||
323 | return; | ||
324 | #ifndef DESKTOP_VERSION | ||
325 | if ( infrared ) { | ||
326 | qDebug("disable BeamReceive "); | ||
327 | delete infrared; | ||
328 | infrared = 0; | ||
329 | brAction->setOn(false); | ||
330 | return; | ||
331 | } | ||
332 | qDebug("enable BeamReceive "); | ||
333 | brAction->setOn(true); | ||
334 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | ||
335 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
336 | #endif | ||
286 | } | 337 | } |
287 | void MainWindow::showMaximized () | 338 | void MainWindow::showMaximized () |
288 | { | 339 | { |
289 | #ifndef DESKTOP_VERSION | 340 | #ifndef DESKTOP_VERSION |
290 | if ( ! globalFlagBlockStartup ) | 341 | if ( ! globalFlagBlockStartup ) |
291 | if ( mClosed ) | 342 | if ( mClosed ) |
292 | mView->goToday(); | 343 | mView->goToday(); |
293 | #endif | 344 | #endif |
294 | QWidget::showMaximized () ; | 345 | QWidget::showMaximized () ; |
295 | mClosed = false; | 346 | mClosed = false; |
296 | } | 347 | } |
297 | void MainWindow::closeEvent( QCloseEvent* ce ) | 348 | void MainWindow::closeEvent( QCloseEvent* ce ) |
298 | { | 349 | { |
299 | 350 | ||
300 | 351 | ||
301 | 352 | ||
302 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 353 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
303 | saveOnClose(); | 354 | saveOnClose(); |
304 | mClosed = true; | 355 | mClosed = true; |
305 | ce->accept(); | 356 | ce->accept(); |
306 | return; | 357 | return; |
307 | 358 | ||
308 | } | 359 | } |
309 | 360 | ||
310 | switch( QMessageBox::information( this, "KO/Pi", | 361 | switch( QMessageBox::information( this, "KO/Pi", |
311 | i18n("Do you really want\nto close KO/Pi?"), | 362 | i18n("Do you really want\nto close KO/Pi?"), |
312 | i18n("Close"), i18n("No"), | 363 | i18n("Close"), i18n("No"), |
313 | 0, 0 ) ) { | 364 | 0, 0 ) ) { |
314 | case 0: | 365 | case 0: |
315 | saveOnClose(); | 366 | saveOnClose(); |
316 | mClosed = true; | 367 | mClosed = true; |
317 | ce->accept(); | 368 | ce->accept(); |
318 | break; | 369 | break; |
319 | case 1: | 370 | case 1: |
320 | ce->ignore(); | 371 | ce->ignore(); |
321 | break; | 372 | break; |
322 | case 2: | 373 | case 2: |
323 | 374 | ||
324 | default: | 375 | default: |
325 | break; | 376 | break; |
326 | } | 377 | } |
327 | 378 | ||
328 | 379 | ||
329 | } | 380 | } |
330 | 381 | ||
331 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 382 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
332 | { | 383 | { |
333 | QDataStream stream( data, IO_ReadOnly ); | 384 | QDataStream stream( data, IO_ReadOnly ); |
@@ -706,96 +757,102 @@ void MainWindow::initActions() | |||
706 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 757 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
707 | #ifndef DESKTOP_VERSION | 758 | #ifndef DESKTOP_VERSION |
708 | importMenu->insertSeparator(); | 759 | importMenu->insertSeparator(); |
709 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 760 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
710 | this ); | 761 | this ); |
711 | action->addTo( importMenu ); | 762 | action->addTo( importMenu ); |
712 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 763 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
713 | #else | 764 | #else |
714 | #ifdef _WIN32_ | 765 | #ifdef _WIN32_ |
715 | importMenu->insertSeparator(); | 766 | importMenu->insertSeparator(); |
716 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 767 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
717 | this ); | 768 | this ); |
718 | action->addTo( importMenu ); | 769 | action->addTo( importMenu ); |
719 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 770 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
720 | #endif | 771 | #endif |
721 | #endif | 772 | #endif |
722 | 773 | ||
723 | importMenu->insertSeparator(); | 774 | importMenu->insertSeparator(); |
724 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 775 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
725 | this ); | 776 | this ); |
726 | action->addTo( importMenu ); | 777 | action->addTo( importMenu ); |
727 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 778 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
728 | 779 | ||
729 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 780 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
730 | this ); | 781 | this ); |
731 | action->addTo( importMenu ); | 782 | action->addTo( importMenu ); |
732 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 783 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
733 | 784 | ||
734 | importMenu->insertSeparator(); | 785 | importMenu->insertSeparator(); |
735 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 786 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
736 | this ); | 787 | this ); |
737 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 788 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
738 | 789 | ||
739 | 790 | ||
740 | //LR | 791 | //LR |
741 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 792 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
742 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 793 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
743 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 794 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
744 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 795 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
745 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 796 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
746 | 797 | ||
747 | importMenu->insertSeparator(); | 798 | importMenu->insertSeparator(); |
748 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 799 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
749 | this ); | 800 | this ); |
750 | action->addTo( importMenu ); | 801 | action->addTo( importMenu ); |
751 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 802 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
752 | #ifndef DESKTOP_VERSION | 803 | #ifndef DESKTOP_VERSION |
753 | importMenu->insertSeparator(); | 804 | importMenu->insertSeparator(); |
805 | brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0, | ||
806 | this ); | ||
807 | brAction->addTo( importMenu ); | ||
808 | brAction->setToggleAction (true ) ; | ||
809 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | ||
810 | |||
754 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 811 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
755 | this ); | 812 | this ); |
756 | action->addTo( importMenu ); | 813 | action->addTo( importMenu ); |
757 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 814 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
758 | 815 | ||
759 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 816 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
760 | this ); | 817 | this ); |
761 | action->addTo( importMenu ); | 818 | action->addTo( importMenu ); |
762 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 819 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
763 | #else | 820 | #else |
764 | importMenu->insertSeparator(); | 821 | importMenu->insertSeparator(); |
765 | icon = loadPixmap( pathString + "print" ); | 822 | icon = loadPixmap( pathString + "print" ); |
766 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 823 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
767 | action->addTo( importMenu ); | 824 | action->addTo( importMenu ); |
768 | connect( action, SIGNAL( activated() ), | 825 | connect( action, SIGNAL( activated() ), |
769 | this, SLOT( printCal() ) ); | 826 | this, SLOT( printCal() ) ); |
770 | 827 | ||
771 | icon = loadPixmap( pathString + "print" ); | 828 | icon = loadPixmap( pathString + "print" ); |
772 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 829 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
773 | action->addTo( importMenu ); | 830 | action->addTo( importMenu ); |
774 | connect( action, SIGNAL( activated() ), | 831 | connect( action, SIGNAL( activated() ), |
775 | this, SLOT( printSel() ) ); | 832 | this, SLOT( printSel() ) ); |
776 | #endif | 833 | #endif |
777 | importMenu->insertSeparator(); | 834 | importMenu->insertSeparator(); |
778 | action = new QAction( "beam all", i18n("Save"), 0, | 835 | action = new QAction( "beam all", i18n("Save"), 0, |
779 | this ); | 836 | this ); |
780 | action->addTo( importMenu ); | 837 | action->addTo( importMenu ); |
781 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 838 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
782 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 839 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
783 | this ); | 840 | this ); |
784 | action->addTo( importMenu ); | 841 | action->addTo( importMenu ); |
785 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 842 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
786 | 843 | ||
787 | //menuBar->insertItem( "Configure",configureMenu ); | 844 | //menuBar->insertItem( "Configure",configureMenu ); |
788 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 845 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
789 | icon = loadPixmap( "korganizer/korganizer" ); | 846 | icon = loadPixmap( "korganizer/korganizer" ); |
790 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 847 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
791 | action->addTo( helpMenu ); | 848 | action->addTo( helpMenu ); |
792 | connect( action, SIGNAL( activated() ), | 849 | connect( action, SIGNAL( activated() ), |
793 | SLOT( keyBindings() ) ); | 850 | SLOT( keyBindings() ) ); |
794 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 851 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
795 | action->addTo( helpMenu ); | 852 | action->addTo( helpMenu ); |
796 | connect( action, SIGNAL( activated() ), | 853 | connect( action, SIGNAL( activated() ), |
797 | SLOT( features() ) ); | 854 | SLOT( features() ) ); |
798 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 855 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
799 | action->addTo( helpMenu ); | 856 | action->addTo( helpMenu ); |
800 | connect( action, SIGNAL( activated() ), | 857 | connect( action, SIGNAL( activated() ), |
801 | SLOT( aboutAutoSaving() ) ); | 858 | SLOT( aboutAutoSaving() ) ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index e3383ed..0926313 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,128 +1,138 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qtextstream.h> | 8 | #include <qtextstream.h> |
9 | #include <qregexp.h> | 9 | #include <qregexp.h> |
10 | 10 | ||
11 | #include <libkcal/incidence.h> | 11 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 12 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | 14 | #ifndef DESKTOP_VERSION | |
15 | #include <qcopchannel_qws.h> | ||
16 | #endif | ||
15 | class QAction; | 17 | class QAction; |
16 | class CalendarView; | 18 | class CalendarView; |
17 | class KSyncProfile; | 19 | class KSyncProfile; |
18 | #ifdef DESKTOP_VERSION | 20 | #ifdef DESKTOP_VERSION |
19 | 21 | ||
20 | #define QPEToolBar QToolBar | 22 | #define QPEToolBar QToolBar |
21 | #define QPEMenuBar QMenuBar | 23 | #define QPEMenuBar QMenuBar |
22 | #endif | 24 | #endif |
23 | class QPEToolBar; | 25 | class QPEToolBar; |
24 | 26 | ||
25 | 27 | ||
26 | namespace KCal { | 28 | namespace KCal { |
27 | class CalendarLocal; | 29 | class CalendarLocal; |
28 | } | 30 | } |
29 | 31 | ||
30 | using namespace KCal; | 32 | using namespace KCal; |
31 | 33 | ||
32 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
33 | { | 35 | { |
34 | Q_OBJECT | 36 | Q_OBJECT |
35 | public: | 37 | public: |
36 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
37 | ~MainWindow(); | 39 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | ||
38 | public slots: | 41 | public slots: |
39 | virtual void showMaximized (); | 42 | virtual void showMaximized (); |
40 | void configureAgenda( int ); | 43 | void configureAgenda( int ); |
41 | void recieve( const QCString& msg, const QByteArray& data ); | 44 | void recieve( const QCString& msg, const QByteArray& data ); |
42 | static QString defaultFileName(); | 45 | static QString defaultFileName(); |
43 | static QString syncFileName(); | 46 | static QString syncFileName(); |
44 | static QString resourcePath(); | 47 | static QString resourcePath(); |
45 | protected slots: | 48 | protected slots: |
46 | void setCaptionToDates(); | 49 | void setCaptionToDates(); |
47 | void about(); | 50 | void about(); |
48 | void licence(); | 51 | void licence(); |
49 | void faq(); | 52 | void faq(); |
50 | void usertrans(); | 53 | void usertrans(); |
51 | void features(); | 54 | void features(); |
52 | void synchowto(); | 55 | void synchowto(); |
53 | void whatsNew(); | 56 | void whatsNew(); |
54 | void keyBindings(); | 57 | void keyBindings(); |
55 | void aboutAutoSaving();; | 58 | void aboutAutoSaving();; |
56 | void aboutKnownBugs(); | 59 | void aboutKnownBugs(); |
57 | 60 | ||
58 | void processIncidenceSelection( Incidence * ); | 61 | void processIncidenceSelection( Incidence * ); |
59 | 62 | ||
60 | void importQtopia(); | 63 | void importQtopia(); |
61 | void importBday(); | 64 | void importBday(); |
62 | void importOL(); | 65 | void importOL(); |
63 | void importIcal(); | 66 | void importIcal(); |
64 | void importFile( QString, bool ); | 67 | void importFile( QString, bool ); |
65 | void quickImportIcal(); | 68 | void quickImportIcal(); |
66 | 69 | ||
67 | void slotModifiedChanged( bool ); | 70 | void slotModifiedChanged( bool ); |
68 | 71 | ||
69 | void save(); | 72 | void save(); |
70 | void configureToolBar( int ); | 73 | void configureToolBar( int ); |
71 | void printSel(); | 74 | void printSel(); |
72 | void printCal(); | 75 | void printCal(); |
73 | void saveCalendar(); | 76 | void saveCalendar(); |
74 | void loadCalendar(); | 77 | void loadCalendar(); |
75 | void exportVCalendar(); | 78 | void exportVCalendar(); |
76 | void fillFilterMenu(); | 79 | void fillFilterMenu(); |
77 | void selectFilter( int ); | 80 | void selectFilter( int ); |
78 | void exportToPhone( int ); | 81 | void exportToPhone( int ); |
82 | void toggleBeamReceive(); | ||
83 | void disableBR(bool); | ||
79 | 84 | ||
80 | 85 | ||
81 | protected: | 86 | protected: |
82 | void displayText( QString, QString); | 87 | void displayText( QString, QString); |
83 | void displayFile( QString, QString); | 88 | void displayFile( QString, QString); |
84 | 89 | ||
85 | void enableIncidenceActions( bool ); | 90 | void enableIncidenceActions( bool ); |
86 | 91 | ||
87 | private slots: | 92 | private slots: |
88 | QSocket* piSocket; | 93 | QSocket* piSocket; |
89 | QString piFileString; | 94 | QString piFileString; |
90 | QTime piTime; | 95 | QTime piTime; |
91 | void getFile( bool ); | 96 | void getFile( bool ); |
92 | void syncFileRequest(); | 97 | void syncFileRequest(); |
93 | private: | 98 | private: |
99 | bool mBRdisabled; | ||
100 | #ifndef DESKTOP_VERSION | ||
101 | QCopChannel* infrared; | ||
102 | #endif | ||
103 | QAction* brAction; | ||
94 | KSyncManager* mSyncManager; | 104 | KSyncManager* mSyncManager; |
95 | bool mClosed; | 105 | bool mClosed; |
96 | void saveOnClose(); | 106 | void saveOnClose(); |
97 | bool mFlagKeyPressed; | 107 | bool mFlagKeyPressed; |
98 | bool mBlockAtStartup; | 108 | bool mBlockAtStartup; |
99 | QPEToolBar *iconToolBar; | 109 | QPEToolBar *iconToolBar; |
100 | void initActions(); | 110 | void initActions(); |
101 | void setDefaultPreferences(); | 111 | void setDefaultPreferences(); |
102 | void keyPressEvent ( QKeyEvent * ) ; | 112 | void keyPressEvent ( QKeyEvent * ) ; |
103 | void keyReleaseEvent ( QKeyEvent * ) ; | 113 | void keyReleaseEvent ( QKeyEvent * ) ; |
104 | QPopupMenu *configureToolBarMenu; | 114 | QPopupMenu *configureToolBarMenu; |
105 | QPopupMenu *selectFilterMenu; | 115 | QPopupMenu *selectFilterMenu; |
106 | QPopupMenu *configureAgendaMenu, *syncMenu; | 116 | QPopupMenu *configureAgendaMenu, *syncMenu; |
107 | CalendarLocal *mCalendar; | 117 | CalendarLocal *mCalendar; |
108 | CalendarView *mView; | 118 | CalendarView *mView; |
109 | QAction *mNewSubTodoAction; | 119 | QAction *mNewSubTodoAction; |
110 | 120 | ||
111 | QAction *mShowAction; | 121 | QAction *mShowAction; |
112 | QAction *mEditAction; | 122 | QAction *mEditAction; |
113 | QAction *mDeleteAction; | 123 | QAction *mDeleteAction; |
114 | QAction *mCloneAction; | 124 | QAction *mCloneAction; |
115 | QAction *mMoveAction; | 125 | QAction *mMoveAction; |
116 | QAction *mBeamAction; | 126 | QAction *mBeamAction; |
117 | QAction *mCancelAction; | 127 | QAction *mCancelAction; |
118 | 128 | ||
119 | void closeEvent( QCloseEvent* ce ); | 129 | void closeEvent( QCloseEvent* ce ); |
120 | SimpleAlarmClient mAlarmClient; | 130 | SimpleAlarmClient mAlarmClient; |
121 | QTimer mSaveTimer; | 131 | QTimer mSaveTimer; |
122 | //bool mBlockSaveFlag; | 132 | //bool mBlockSaveFlag; |
123 | bool mCalendarModifiedFlag; | 133 | bool mCalendarModifiedFlag; |
124 | QPixmap loadPixmap( QString ); | 134 | QPixmap loadPixmap( QString ); |
125 | }; | 135 | }; |
126 | 136 | ||
127 | 137 | ||
128 | #endif | 138 | #endif |