-rw-r--r-- | bin/kdepim/WhatsNew.txt | 6 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 5 | ||||
-rw-r--r-- | korganizer/datenavigator.cpp | 6 | ||||
-rw-r--r-- | korganizer/datenavigator.h | 1 | ||||
-rw-r--r-- | korganizer/interfaces/korganizer/baseview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 |
6 files changed, 19 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index eb7cf13..4fff7e1 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,535 +1,541 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 1.9.14 ************ Fixed some problems with the dialog sizes when switching portrait/landscape mode on 640x480 PDA display. Fixed some other small bugs. Fixed an ugly bug in KOpieMail: KOpieMail was not able to write files (mails) to MSDOS file system, like on an usual preformatted SD card. That should work now. To save your mail data on the Sd card do the following: Create a dir on the SD card: mkdir /mnt/card/localmail Go to your home dir: cd Go to kopiemail data storage dir: cd kdepim/apps/kopiemail Create a symlink to the SD card: ls -s /mnt/card/localmail Now KOpieMail will store all mails on the SD card. +KO/Pi Monthview: +Now "Go to Today" selects the current month from day 1-end, +not the current date + some days. +I.e. "Go to Today" shows now always +the current month with first day of month in the first row. + ********** VERSION 1.9.13 ************ Fixed nasty PwM/Pi file reading bug, when the used hash algo of file is different then the global hash algo. Added KA/Pi support for opie mailit mailapplication. Fixed some bugs in OM/Pi. Now character conversion tables are available for the Zaurus to make OM/Pi working properly. To get the character conversion in OM/Pi working, please download at the sourceforge project site the package sr-character-conversion_SharpROM_arm.ipk.zip (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) from the section "general files for KDE/Pim" Instructions how to install this package are in a ReadMe in this file. Fixed the orientation change problem in KA/Pi when switching portrait/landscape mode. French translation available for KA/Pi and OM/Pi. Fixed some problems with categories in KO/Pi in DTM sync. Added selection dialog for export to phone in KA/Pi. If in KO/Pi is an attendee selected to add to a meeting and this attendee is already in the list of attendees, this person is not added again. Some menu cleanup in KA/Pi. ********** VERSION 1.9.12 ************ Fix for the bug in KO/Pi What's Next view of version 1.9.11. Bugfix: Licence file is now shown again. OM/Pi now supports Unicode (utf8 charset). Fixed some bugs in OM/Pi. KA/Pi has more German translation. ********** VERSION 1.9.11 ************ Fixed several problems in PWM/Pi, like asking the user, if unsaved changed are pending when closing the app. And PwM/Pi handles now different texts for the fields Description, Username, Password, configurable per category. Fixed a crash in KO/Pi , when importing/loading vcs files which have an entry with an attendee with state: NEEDS ACTION Fixed some problems in the German translation of OM/Pi, which makes some dialogs not fitting on the screen of the Z 5500. Fixed Qtopia crash, when disabling/deinstalling KO/Pi alarm applet. Implemented direct KDE<->KA/Pi sync for KA/Pi running on Linux desktop. Added feature "remove sync info" to sync menu. Tweaked the KO/Pi What's next view a bit, added setting to hide events that are done. Disabled "beam receive enabled" on startup to avoid problems if Fastload is enabled. Please set "beam receive enabled", if you want to receive data via IR. Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running on Linux desktop. Made in KA/Pi scrolling possible, if details view is selected. (The keyboard focus is set automatically to the search line) Fixed a bug in DMT sync, that a new entry in DTM was added on every sync to Kx/Pi. Fixed missing writing of KA/Pi categories to DMT entries when syncing. Fixed a bug in DMT sync with todos created in KO/Pi containing non-latin1 characters. Rearranged package contents of Sharp-ipks and made all packages installable on SD again. Fixed the writing of addressbook data in DTM sync. Empty fields in KA/Pi were not removed. Added better category handling in KA/Pi: Added item Edit Categories and Manage new categories to the settings menu. Possible to configure a view to display categories. Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. Fixed displaying of "free" days and time in KO Monthview and Agendaview. ... and many other bugfixes. ********** VERSION 1.9.10 ************ Many internal small bugfixes. And fix of the "big" bug in KO/Pi, that after Syncing the appointments had an offset by several hours. That was a problem with the internal timezone setting, introduced by the changed timezone configuration settings. German translation for OM/Pi is now available. ********** VERSION 1.9.9 ************ KDE-Pim/Pi has a new Member! It is called PWM/Pi (Passwordmanager/platform-independent) and it is available for the Zaurus. It is planned, that it will be available later for Windows. (And for Linux, of course). It is a port of the Passwordmanager of KDE. It will need the MicroKDElibs to run. Made loading of addressbooks in KA/Pi up to 7 times faster! The bigger your addressbook file, the more starting speed will you gain. (relatively) The Qtopia addressbook connector is now platform independend as well and should work on any platform for importing/exporting Qtopia and Opie XML files. Added a +30min feature to the timezone settings to make KDE-Pim/Pi useable in Australia and other parts on the world with strange timezones ;-) German "Umlaute" should now be sorted correctly on the Z in KA/Pi. It is now possible to disable the "receive data via infrared" feature, such that syncing with Outlook is now possible again with Kx/Pi runing. Please disable it, before syncing Sharp DTM with Outlook. For your convenience, the "receive data via infrared" feature is disabled automatically, if you sync Kx/Pi with DTM. You have to enable it again manually after syncing. Enabling this feature makes it impossible to start the Sharp DTM apps. If this feature is enabled, you will only get the alarm notification from KO/Pi and not from the Sharp calendar. This is very useful if you sync KO/Pi with Sharp DTM, because after syncing you usually would get notified about an alarm by KO/Pi and the Sharp Calendar. Together with the Linux desktop version of KO/Pi it is now possible to sync KO/Pi on the Zaurus with the complete KDE-desktop (3.3 or later) calendar data easily. That makes it possible to sync the Z with one click of a mouse with the KDE-Desktop. This feature it available for all Zaurus platforms KO/Pi is running on. The only thing needed is a running KO/Pi on Linux and a compiled version of the small KDE-Pim/Pi<->KDE-Desktop access command line program, which is in the KDE-Pim/Pi sources available. The "KDE-desktop" syncing feature for KA/Pi will follow in the next releases. Fixed the vcard export bug, which had the version 1.9.8. Added missing GERMAN translation to KO/Pi. Hi PsionX, could you add the missing french translation?Thx! Translation files for KA/Pi are available as well. GERMAN translation will be available in the next release. PsionX ( yres, you again ;-) ), could you start translating KA/Pi? Thx! You can download the version 1.9.9 at http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 Note: To run the mail program OM/Pi you need libopenssl. A link to a download loaction is available at ZSI at www.killefiz.de ********** VERSION 1.9.8 ************ Fixed character decoding in OM/Pi. (e.g. German "Umlaute" were not displayed properly.) Made is possible to reparent todos in KO/Pi. Use contextmenu or keys (look at Help-Keys + Colors) for that. Added the missing Sync-Howto and WhatsNew to the packages. KO/Pi on Linux desktop can now sync with KDE desktop. That means: When using KO/Pi on Linux desktop for syncing with KDE desktop and the Zaurus, the Zaurus can be synced now with all KDE-Calendar resources, not only with one local file. (That makes it possible to sync the Zaurus with the calendar data on a Kolab server) KA/Pi syncing with KDE desktop will be available in the next version. ********** VERSION 1.9.7 ************ KO/Pi - KA/Pi on Windows: Now a directory can be defined by the user, where the application/config data should be saved. Define your desired path in the evironment variable MICROKDEHOME before starting KO/Pi or KA/Pi. An easy Kx/Pi to Kx/Pi syncing is now possible (it is called Pi-Sync) via network. Please look at the Sync Howto. Exporting of calendar data and contacts to mobile phones is now possible. The SyncHowto is updated with information howto access/sync mobile phones. Please look at the Sync Howto. Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. Please disable Fastload for the original contact/calendar applications and close them. KO/Pi and KA/Pi must be running in order to receive the data. (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) In the KA/Pi details view are now the preferred tel. numbers displayed on top of the other data ( emails/tel.numbers/addresses) Fixed some syncing problems in KA/Pi. Added font settings for the KA/Pi details view. Added fields "children's name" and "gender" to KA/Pi. Made searching in KA/Pi better: Now the first item in a view is selected after a search automatically and the views can be scrolled up/down when the search input field has the keyboard focus. And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. ********** VERSION 1.9.6 ************ Changes in the external application communication on the Zaurus in order to use less RAM when the apps are running. First syncing of addressbooks (KA/Pi) is possible. ********** VERSION 1.9.5a ************ Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. Fixed some small bugs. KA/Pi shows now the birthday in summary view. Now OM/Pi and KA/Pi are using the date format defined in KO/Pi for displaying dates. ********** VERSION 1.9.5 ************ There is still no Addressbook syncing! New in 1.9.5: Many bugfixes. Better searching in KA/Pi. You can configure in KA/Pi if you want to search only after <return> key pressed. Better mail downloading in OM/Pi. First experimental alpha version of sync of KO/Pi with mobile phones. See gammu documentation for supported phones. You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. Quick hint how to use: NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. Create syncprofile - mobile device Remove entry for model. (Leave empty ). Enable infrared on Zaurus and your Phone. Sync. To get a more detailed log, start kopi from konsole. ********** VERSION 1.9.4 ************ This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. WARNING: PLEASE BACKUP ALL YOUR DATA! We have changed a lot and maybe there are some unknown problems. SYNC HANDLING HAS CHANGED! Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. As programs are available: KO/Pi (korganizer ipk) - a calendar program. KA/Pi (kaddressbook ipk ) - an addressbook OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) All the applications are installed in a "Pim" TAB. If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk All the application are integrated. Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. HINT: If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. What's new? SYNC HANDLING HAS CHANGED! Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). New in OM/Pi: When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. New in KO/Pi: French is now available for KO/Pi. Choose menu:Actions - Configure:TAB locale Syncing has changed. Phone sync available soon. Not much changes, I cannot remember them ... New in KA/Pi: Beaming possible. Sharp DTM readonly access possible( create a new DTM resource ); Better searching possible. Search is performed only after pressing the return key. Use wildcard * to specify parts of a name. Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . A big improvement is the new management of the contact access. In version 1.9.3, every application was using their own addressbook access data. That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. That was wasting of memory, if you had several hundreds of contacts. Now only KA/Pi accesses the addressbook. If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. New in the KO/Pi alarm applet: Configure your own timer popup menu! (Text and minutes for timer countdown) Just edit the file (yourhomedir)/.kopialarmtimerrc and start/stop a timer to get a new menu with the data of this file. ********** VERSION 1.9.3 ************ 1) Now KO/Pi on Windows imports directly the calendar data of an installed Outlook. Should work with OL version >= 2000. ********** VERSION 1.9.2 ************ 1) KDE-Pim/Pi has got a new member: KmicroMail (KM/Pi) is a mail program, which can handle IMAP and POP mail access. It is based on Opie-Mail v3. All dependencies to the Opie libraries ar removed, such that no additional Opie lib is needed. It is already integrated in KO/Pi and KA/Pi. It it now available for the Zaurus,probably it will be available for other platforms later. Hint: Create your own contact (name + email) in KA/Pi, select this contact and choose menu: Settings - Set Who Am I. Now the settings of this contact are used as the sender data in KM/Pi. 2) KDE-Pim/Pi is split up in five different packages now precompiled for Sharp Zaurus: --kmicrokdelibs_1.9.2_arm.ipk The libs are needed for any of the following programs: --kaddressbook_1.9.2_arm.ipk --kmicromail_1.9.2_arm.ipk --korganizer_1.9.2_arm.ipk Independ from that, there is the alarm applet available for KO/Pi, which also offers quick access for a new mail or showing the addressbook.: --korganizer-alarm_1.9.2_arm.ipk Independend means, that the alarm applet does not need any of the libs or programs above to run. But it would be quite useless without these programs. NOTE: If you get a "This application depends on other programs" during installation of --kmicrokdelibs_1.9.2_arm.ipk you probably do not have to care about that. kmicrokdelibs_1.9.2 will come with some resource plugins, which needs additional libraries. (E.g. libopie1, if you want to use the opie resource connector in KA/Pi). If you do not have this libraries installed, you simply cannot use the resource. To make it clear: If the libraries are missing, the applications using kmicrokdelibs will start, because the resources are plugins. 3) KO/Pi and friends are now installable on SD-Card! It is recommended to install all libs and apps on the SD card or all in the internal storage. There may be problems, if this is mixed. 4) Fixed two bugs in the alarm notification on Windows. 5) Great improvement! KO/Pi uses now the latest version of libical. Libical is the library which actually reads the calendar files and extract the data from it. With the old version, there were problems (crashes or program hangs) when licical did read files, which were not stored from KO/Pi. I do not know, if the new libical works perfect, but actually it works much better than the old version. There are no problems with compatibility with old calendar files of KO/Pi, of course! 6) New in KA/Pi: Opie addressbook resource connector available! You will need libopie1 and the opie addressbook, of course. With the Opie addressbook resource connector, you can access the Opie addressbook readonly in KA/Pi. If you want to edit or import the data into KA/Pi, do this: a) Create an Opie resource. (Menu: Settings-Configure Resources). After configuration and restarting KA/Pi you should see the Opie contacts in KA/Pi. b) Select some or all Opie contacts. (NOTE: +++++ To know exactly, what contacts are Opie contacts, do this: Choose menu: View-Modify View - TAB Fields. Select in the above list "Resource" and click down arrow to add it to the "Selected fields". Click OK. Now you have a new column "Resource" in your list, where you can see, what an Opie resource is. ++++ NOTE end.) Ok, we do have now some Opie contacts seleted. (Use SHIFT or CTRL key in order to multiple select). c) Choose menu: Edit-Copy. d) Choose menu: Edit-Paste. e) Select the resource, you want to add the contacts to. Congrats! Now you have read/write access to the copied opie contacts as "real" KA/Pi contacts. ********** VERSION 1.9.1 ************ 1) +++ IMPORTANT 1 +++ The storing place of the default calendar file has changed! The default calendar file was Applications/korganizer/mycalendar.ics on Zaurus and (yourHomeDir)/korganizer/mycalendar.ics on Windows/Linux desktop. Now it is (yourHomeDir)/kdepim/korganizer/mycalendar.ics on Zaurus, Windows and Linux. To load the old file, choose menu File-Load calendar backup. (It should be loaded automatically at startup with a warning message displayed). The place of the configuration file has changed too. If you want to use your old KO/Pi config, copy it to (yourHomeDir)/kdepim/config/korganizerrc Please read VERSION 1.9.0 - topic 3) as well! +++ IMPORTANT 2 +++ Because of the new paths, you will need a new version of the KO/Pi alarm applet for Zaurus. Use version >= 1.9.1 2) Now the QWhat'sThis Icon works for items in the month view as well. diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3908dbb..47cd488 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1482,1025 +1482,1028 @@ bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a if ( a ) { ev->addAttendee( a ); } QString kind; if ( birthday ) kind = i18n( "Birthday" ); else kind = i18n( "Anniversary" ); ev->setSummary( name + " - " + kind ); ev->setOrganizer(a->email()); ev->setCategories( kind ); ev->setDtStart( QDateTime(date) ); ev->setDtEnd( QDateTime(date) ); ev->setFloats( true ); Recurrence * rec = ev->recurrence(); rec->setYearly(Recurrence::rYearlyMonth,1,-1); rec->addYearlyNum( date.month() ); if ( !mCalendar->addAnniversaryNoDup( ev ) ) { delete ev; return false; } return true; } bool CalendarView::importQtopia( const QString &categories, const QString &datebook, const QString &todolist ) { QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); updateView(); return true; #if 0 mGlobalSyncMode = SYNC_MODE_QTOPIA; mCurrentSyncDevice = "qtopia-XML"; if ( mSyncManager->mAskForPreferences ) edit_sync_options(); qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); bool syncOK = false; QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); bool loadOk = true; if ( !categories.isEmpty() ) loadOk = qtopiaFormat.load( calendar, categories ); if ( loadOk && !datebook.isEmpty() ) loadOk = qtopiaFormat.load( calendar, datebook ); if ( loadOk && !todolist.isEmpty() ) loadOk = qtopiaFormat.load( calendar, todolist ); if ( loadOk ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( mSyncManager->mWriteBackFile ) { // write back XML file } setModified( true ); } } else { QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), question, i18n("Ok")) ; } delete calendar; updateView(); return syncOK; #endif } void CalendarView::setSyncEventsReadOnly() { Event * ev; QPtrList<Event> eL = mCalendar->rawEvents(); ev = eL.first(); while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) ev->setReadOnly( true ); ev = eL.next(); } } bool CalendarView::openCalendar(QString filename, bool merge) { if (filename.isEmpty()) { return false; } if (!QFile::exists(filename)) { KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); return false; } globalFlagBlockAgenda = 1; if (!merge) mCalendar->close(); mStorage->setFileName( filename ); if ( mStorage->load() ) { if ( merge ) ;//setModified( true ); else { //setModified( true ); mViewManager->setDocumentId( filename ); mDialogManager->setDocumentId( filename ); mTodoList->setDocumentId( filename ); } globalFlagBlockAgenda = 2; // if ( getLastSyncEvent() ) // getLastSyncEvent()->setReadOnly( true ); mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); if ( filename != MainWindow::defaultFileName() ) { saveCalendar( MainWindow::defaultFileName() ); } else { QFileInfo finf ( MainWindow::defaultFileName()); if ( finf.exists() ) { setLoadedFileVersion( finf.lastModified () ); } } return true; } else { // while failing to load, the calendar object could // have become partially populated. Clear it out. if ( !merge ) { mCalendar->close(); mViewManager->setDocumentId( filename ); mDialogManager->setDocumentId( filename ); mTodoList->setDocumentId( filename ); } //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); globalFlagBlockAgenda = 2; mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); } return false; } void CalendarView::showOpenError() { KMessageBox::error(this,i18n("Couldn't load calendar\n.")); } void CalendarView::setLoadedFileVersion(QDateTime dt) { loadedFileVersion = dt; } bool CalendarView::checkFileChanged(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); if ( dt <= loadedFileVersion ) return false; return true; } void CalendarView::watchSavedFile() { QFileInfo finf ( MainWindow::defaultFileName()); if ( !finf.exists() ) return; QDateTime dt = finf.lastModified (); if ( dt < loadedFileVersion ) { //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); return; } loadedFileVersion = dt; } bool CalendarView::checkFileVersion(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); //qDebug("file on disk version %s",dt.toString().latin1()); if ( dt <= loadedFileVersion ) return true; int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , i18n("KO/Pi Warning"),i18n("Overwrite"), i18n("Sync+save")); if ( km == KMessageBox::Cancel ) return false; if ( km == KMessageBox::Yes ) return true; setSyncDevice("deleteaftersync" ); mSyncManager->mAskForPreferences = true; mSyncManager->mSyncAlgoPrefs = 3; mSyncManager->mWriteBackFile = false; mSyncManager->mWriteBackExistingOnly = false; mSyncManager->mShowSyncSummary = false; syncCalendar( fn, 3 ); Event * e = getLastSyncEvent(); mCalendar->deleteEvent ( e ); updateView(); return true; } bool CalendarView::saveCalendar( QString filename ) { // Store back all unsaved data into calendar object // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); if ( mViewManager->currentView() ) mViewManager->currentView()->flushView(); QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); mStorage->setSaveFormat( new ICalFormat() ); mStorage->setFileName( filename ); bool success; success = mStorage->save(); if ( !success ) { return false; } if ( filename == MainWindow::defaultFileName() ) { setLoadedFileVersion( lfv ); watchSavedFile(); } return true; } void CalendarView::closeCalendar() { // child windows no longer valid emit closingDown(); mCalendar->close(); setModified(false); updateView(); } void CalendarView::archiveCalendar() { mDialogManager->showArchiveDialog(); } void CalendarView::readSettings() { // mViewManager->showAgendaView(); QString str; //qDebug("CalendarView::readSettings() "); // read settings from the KConfig, supplying reasonable // defaults where none are to be found KConfig *config = KOGlobals::config(); #ifndef KORG_NOSPLITTER config->setGroup("KOrganizer Geometry"); QValueList<int> sizes = config->readIntListEntry("Separator1"); if (sizes.count() != 2) { sizes << mDateNavigator->minimumSizeHint().width(); sizes << 300; } mPanner->setSizes(sizes); sizes = config->readIntListEntry("Separator2"); if ( ( mResourceView && sizes.count() == 4 ) || ( !mResourceView && sizes.count() == 3 ) ) { mLeftSplitter->setSizes(sizes); } #endif globalFlagBlockAgenda = 1; mViewManager->showAgendaView(); //mViewManager->readSettings( config ); mTodoList->restoreLayout(config,QString("Todo Layout")); readFilterSettings(config); config->setGroup( "Views" ); int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); if ( dateCount == 5 ) mNavigator->selectWorkWeek(); else if ( dateCount == 7 ) mNavigator->selectWeek(); else mNavigator->selectDates( dateCount ); // mViewManager->readSettings( config ); updateConfig(); globalFlagBlockAgenda = 2; mViewManager->readSettings( config ); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list; list = config->readListEntry("MainLayout"); int x,y,w,h; if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); topLevelWidget()->setGeometry(x,y,w,h); } else { topLevelWidget()->setGeometry( 40 ,40 , 640, 440); } list = config->readListEntry("EditEventLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); mEventEditor->setGeometry(x,y,w,h); } list = config->readListEntry("EditTodoLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); mTodoEditor->setGeometry(x,y,w,h); } list = config->readListEntry("ViewerLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); getEventViewerDialog()->setGeometry(x,y,w,h); } #endif } void CalendarView::writeSettings() { // kdDebug() << "CalendarView::writeSettings" << endl; KConfig *config = KOGlobals::config(); #ifndef KORG_NOSPLITTER config->setGroup("KOrganizer Geometry"); QValueList<int> list = mPanner->sizes(); config->writeEntry("Separator1",list); list = mLeftSplitter->sizes(); config->writeEntry("Separator2",list); #endif mViewManager->writeSettings( config ); mTodoList->saveLayout(config,QString("Todo Layout")); mDialogManager->writeSettings( config ); //KOPrefs::instance()->usrWriteConfig(); KOPrefs::instance()->writeConfig(); writeFilterSettings(config); config->setGroup( "Views" ); config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list ;//= config->readListEntry("MainLayout"); int x,y,w,h; QWidget* wid; wid = topLevelWidget(); x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("MainLayout",list ); wid = mEventEditor; x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("EditEventLayout",list ); wid = mTodoEditor; x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("EditTodoLayout",list ); wid = getEventViewerDialog(); x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("ViewerLayout",list ); wid = mDialogManager->getSearchDialog(); if ( wid ) { x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("SearchLayout",list ); } #endif config->sync(); } void CalendarView::readFilterSettings(KConfig *config) { // kdDebug() << "CalendarView::readFilterSettings()" << endl; mFilters.clear(); config->setGroup("General"); QStringList filterList = config->readListEntry("CalendarFilters"); QStringList::ConstIterator it = filterList.begin(); QStringList::ConstIterator end = filterList.end(); while(it != end) { // kdDebug() << " filter: " << (*it) << endl; CalFilter *filter; filter = new CalFilter(*it); config->setGroup("Filter_" + (*it)); //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); filter->setCriteria(config->readNumEntry("Criteria",0)); filter->setCategoryList(config->readListEntry("CategoryList")); mFilters.append(filter); ++it; } if (mFilters.count() == 0) { CalFilter *filter = new CalFilter(i18n("Default")); mFilters.append(filter); } mFilterView->updateFilters(); config->setGroup("FilterView"); mFilterView->blockSignals(true); mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); mFilterView->setSelectedFilter(config->readEntry("Current Filter")); mFilterView->blockSignals(false); // We do it manually to avoid it being done twice by the above calls updateFilter(); } void CalendarView::writeFilterSettings(KConfig *config) { // kdDebug() << "CalendarView::writeFilterSettings()" << endl; QStringList filterList; CalFilter *filter = mFilters.first(); while(filter) { // kdDebug() << " fn: " << filter->name() << endl; filterList << filter->name(); config->setGroup("Filter_" + filter->name()); config->writeEntry("Criteria",filter->criteria()); config->writeEntry("CategoryList",filter->categoryList()); filter = mFilters.next(); } config->setGroup("General"); config->writeEntry("CalendarFilters",filterList); config->setGroup("FilterView"); config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); } void CalendarView::goToday() { - mNavigator->selectToday(); + if ( mViewManager->currentView()->isMonthView() ) + mNavigator->selectTodayMonth(); + else + mNavigator->selectToday(); } void CalendarView::goNext() { mNavigator->selectNext(); } void CalendarView::goPrevious() { mNavigator->selectPrevious(); } void CalendarView::goNextMonth() { mNavigator->selectNextMonth(); } void CalendarView::goPreviousMonth() { mNavigator->selectPreviousMonth(); } void CalendarView::writeLocale() { //KPimGlobalPrefs::instance()->setGlobalConfig(); #if 0 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); QString dummy = KOPrefs::instance()->mUserDateFormatLong; KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); dummy = KOPrefs::instance()->mUserDateFormatShort; KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, KOPrefs::instance()->mDaylightsavingStart, KOPrefs::instance()->mDaylightsavingEnd ); KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); #endif } void CalendarView::updateConfig() { writeLocale(); if ( KOPrefs::instance()->mUseAppColors ) QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); emit configChanged(); mTodoList->updateConfig(); // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); // To make the "fill window" configurations work //mViewManager->raiseCurrentView(); } void CalendarView::eventChanged(Event *event) { changeEventDisplay(event,KOGlobals::EVENTEDITED); //updateUnmanagedViews(); } void CalendarView::eventAdded(Event *event) { changeEventDisplay(event,KOGlobals::EVENTADDED); } void CalendarView::eventToBeDeleted(Event *) { kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; } void CalendarView::eventDeleted() { changeEventDisplay(0,KOGlobals::EVENTDELETED); } void CalendarView::changeTodoDisplay(Todo *which, int action) { changeIncidenceDisplay((Incidence *)which, action); mDateNavigator->updateView(); //LR //mDialogManager->updateSearchDialog(); if (which) { mViewManager->updateWNview(); //mTodoList->updateView(); } } void CalendarView::changeIncidenceDisplay(Incidence *which, int action) { updateUnmanagedViews(); //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); if ( action == KOGlobals::EVENTDELETED ) { //delete mCalendar->checkAlarmForIncidence( 0, true ); if ( mEventViewerDialog ) mEventViewerDialog->hide(); } else mCalendar->checkAlarmForIncidence( which , false ); } // most of the changeEventDisplays() right now just call the view's // total update mode, but they SHOULD be recoded to be more refresh-efficient. void CalendarView::changeEventDisplay(Event *which, int action) { // kdDebug() << "CalendarView::changeEventDisplay" << endl; changeIncidenceDisplay((Incidence *)which, action); mDateNavigator->updateView(); //mDialogManager->updateSearchDialog(); if (which) { // If there is an event view visible update the display mViewManager->currentView()->changeEventDisplay(which,action); // TODO: check, if update needed // if (which->getTodoStatus()) { mTodoList->updateView(); // } } else { mViewManager->currentView()->updateView(); } } void CalendarView::updateTodoViews() { mTodoList->updateView(); mViewManager->currentView()->updateView(); } void CalendarView::updateView(const QDate &start, const QDate &end) { mTodoList->updateView(); mViewManager->updateView(start, end); //mDateNavigator->updateView(); } void CalendarView::updateView() { DateList tmpList = mNavigator->selectedDates(); // We assume that the navigator only selects consecutive days. updateView( tmpList.first(), tmpList.last() ); } void CalendarView::updateUnmanagedViews() { mDateNavigator->updateDayMatrix(); } int CalendarView::msgItemDelete() { return KMessageBox::warningContinueCancel(this, i18n("This item will be\npermanently deleted."), i18n("KO/Pi Confirmation"),i18n("Delete")); } void CalendarView::edit_cut() { Event *anEvent=0; Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); if (mViewManager->currentView()->isEventView()) { if ( incidence && incidence->type() == "Event" ) { anEvent = static_cast<Event *>(incidence); } } if (!anEvent) { KNotifyClient::beep(); return; } DndFactory factory( mCalendar ); factory.cutEvent(anEvent); changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); } void CalendarView::edit_copy() { Event *anEvent=0; Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); if (mViewManager->currentView()->isEventView()) { if ( incidence && incidence->type() == "Event" ) { anEvent = static_cast<Event *>(incidence); } } if (!anEvent) { KNotifyClient::beep(); return; } DndFactory factory( mCalendar ); factory.copyEvent(anEvent); } void CalendarView::edit_paste() { QDate date = mNavigator->selectedDates().first(); DndFactory factory( mCalendar ); Event *pastedEvent = factory.pasteEvent( date ); changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); } void CalendarView::edit_options() { mDialogManager->showOptionsDialog(); //writeSettings(); } void CalendarView::slotSelectPickerDate( QDate d) { mDateFrame->hide(); if ( mDatePickerMode == 1 ) { mNavigator->slotDaySelect( d ); } else if ( mDatePickerMode == 2 ) { if ( mMoveIncidence->type() == "Todo" ) { Todo * to = (Todo *) mMoveIncidence; QTime tim; if ( to->hasDueDate() ) tim = to->dtDue().time(); else { tim = QTime ( 0,0,0 ); to->setFloats( true ); to->setHasDueDate( true ); } QDateTime dt ( d,tim ); to->setDtDue( dt ); todoChanged( to ); } else { QTime tim = mMoveIncidence->dtStart().time(); int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); QDateTime dt ( d,tim ); mMoveIncidence->setDtStart( dt ); ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); } mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); } } void CalendarView::removeCategories() { QPtrList<Incidence> incList = mCalendar->rawIncidences(); QStringList catList = KOPrefs::instance()->mCustomCategories; QStringList catIncList; QStringList newCatList; Incidence* inc = incList.first(); int i; int count = 0; while ( inc ) { newCatList.clear(); catIncList = inc->categories() ; for( i = 0; i< catIncList.count(); ++i ) { if ( catList.contains (catIncList[i])) newCatList.append( catIncList[i] ); } newCatList.sort(); inc->setCategories( newCatList.join(",") ); inc = incList.next(); } } int CalendarView::addCategories() { QPtrList<Incidence> incList = mCalendar->rawIncidences(); QStringList catList = KOPrefs::instance()->mCustomCategories; QStringList catIncList; Incidence* inc = incList.first(); int i; int count = 0; while ( inc ) { catIncList = inc->categories() ; for( i = 0; i< catIncList.count(); ++i ) { if ( !catList.contains (catIncList[i])) { catList.append( catIncList[i] ); //qDebug("add cat %s ", catIncList[i].latin1()); ++count; } } inc = incList.next(); } catList.sort(); KOPrefs::instance()->mCustomCategories = catList; return count; } void CalendarView::manageCategories() { KOCatPrefs* cp = new KOCatPrefs(); cp->show(); int w =cp->sizeHint().width() ; int h = cp->sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); if ( !cp->exec() ) { delete cp; return; } int count = 0; if ( cp->addCat() ) { count = addCategories(); if ( count ) { topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); writeSettings(); } else topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); } else { removeCategories(); updateView(); } delete cp; } void CalendarView::beamIncidence(Incidence * Inc) { QPtrList<Incidence> delSel ; delSel.append(Inc); beamIncidenceList( delSel ); } void CalendarView::beamCalendar() { QPtrList<Incidence> delSel = mCalendar->rawIncidences(); //qDebug("beamCalendar() "); beamIncidenceList( delSel ); } void CalendarView::beamFilteredCalendar() { QPtrList<Incidence> delSel = mCalendar->incidences(); //qDebug("beamFilteredCalendar() "); beamIncidenceList( delSel ); } void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) { if ( beamDialog->exec () == QDialog::Rejected ) return; #ifdef DESKTOP_VERSION QString fn = locateLocal( "tmp", "kopibeamfile" ); #else QString fn = "/tmp/kopibeamfile"; #endif QString mes; bool createbup = true; if ( createbup ) { QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); if ( beamDialog->beamLocal() ) cal->setLocalTime(); else cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); bool addText = false; if ( delSel.count() < 10 ) addText = true; else { description.sprintf(i18n(" %d items?"),delSel.count() ); } while ( incidence ) { Incidence *in = incidence->clone(); if ( ! in->summary().isEmpty() ) { in->setDescription(""); } else { in->setSummary( in->description().left(20)); in->setDescription(""); } if ( addText ) description += in->summary() + "\n"; cal->addIncidence( in ); incidence = delSel.next(); } if ( beamDialog->beamVcal() ) { fn += ".vcs"; FileStorage storage( cal, fn, new VCalFormat ); storage.save(); } else { fn += ".ics"; FileStorage storage( cal, fn, new ICalFormat( ) ); storage.save(); } delete cal; mes = i18n("KO/Pi: Ready for beaming"); topLevelWidget()->setCaption(mes); KApplication::convert2latin1( fn ); #ifndef DESKTOP_VERSION Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); ir->send( fn, description, "text/x-vCalendar" ); #endif } } void CalendarView::beamDone( Ir *ir ) { #ifndef DESKTOP_VERSION delete ir; #endif topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); topLevelWidget()->raise(); } void CalendarView::moveIncidence(Incidence * inc ) { if ( !inc ) return; // qDebug("showDatePickerForIncidence( ) "); if ( mDateFrame->isVisible() ) mDateFrame->hide(); else { int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); mDateFrame->show(); } mDatePickerMode = 2; mMoveIncidence = inc ; QDate da; if ( mMoveIncidence->type() == "Todo" ) { Todo * to = (Todo *) mMoveIncidence; if ( to->hasDueDate() ) da = to->dtDue().date(); else da = QDate::currentDate(); } else { da = mMoveIncidence->dtStart().date(); } mDatePicker->setDate( da ); } void CalendarView::showDatePicker( ) { //qDebug("CalendarView::showDatePicker( ) "); if ( mDateFrame->isVisible() ) mDateFrame->hide(); else { int w =mDatePicker->sizeHint().width() ; int h = mDatePicker->sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); mDateFrame->show(); } mDatePickerMode = 1; mDatePicker->setDate( mNavigator->selectedDates().first() ); } void CalendarView::showEventEditor() { #ifdef DESKTOP_VERSION mEventEditor->show(); #else if ( mEventEditor->width() != QApplication::desktop()->width() ) mEventEditor->hide(); mEventEditor->showMaximized(); #endif } void CalendarView::showTodoEditor() { #ifdef DESKTOP_VERSION mTodoEditor->show(); #else if ( mTodoEditor->width() != QApplication::desktop()->width() ) mTodoEditor->hide(); mTodoEditor->showMaximized(); #endif } void CalendarView::cloneIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { cloneIncidence(incidence); } } void CalendarView::moveIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { moveIncidence(incidence); } } void CalendarView::beamIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { beamIncidence(incidence); } } void CalendarView::toggleCancelIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { cancelIncidence(incidence); } } void CalendarView::cancelIncidence(Incidence * inc ) { inc->setCancelled( ! inc->cancelled() ); changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); updateView(); } void CalendarView::cloneIncidence(Incidence * orgInc ) diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index e26e20b..3156b2b 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp @@ -1,287 +1,293 @@ /* This file is part of KOrganizer. Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include "datenavigator.h" #include "koglobals.h" #include <kcalendarsystem.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> using namespace KCal; DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) : QObject( parent, name ) { mViewManager = v; mSelectedDates.append( QDate::currentDate() ); } DateNavigator::~DateNavigator() { } void DateNavigator::slotMonthSelect( int m ) { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); int diff = m - firstSelected.month() ; firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) selectMonthByDate( firstSelected ); else selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::slotDaySelect( QDate d ) { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); //int diff = firstSelected.daysTo( d ) ; firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectMonthByDate( const QDate & firstSelected ) { int monthDay = firstSelected.day(); QDate date = firstSelected.addDays( 1-monthDay ); selectDates( date , date.daysInMonth ()); } void DateNavigator::selectMonth() { QDate date =mSelectedDates.first(); selectMonthByDate( date ); } DateList DateNavigator::selectedDates() { return mSelectedDates; } int DateNavigator::datesCount() const { return mSelectedDates.count(); } void DateNavigator::selectDates( const DateList& dateList ) { if (dateList.count() > 0) { mSelectedDates = dateList; emitSelected(); } } void DateNavigator::selectDate( const QDate &date ) { QDate d = date; if ( !d.isValid() ) { d = QDate::currentDate(); } mSelectedDates.clear(); mSelectedDates.append( d ); emitSelected(); } void DateNavigator::selectDates( int count ) { QDate d = mSelectedDates.first(); selectDates( d, count ); } void DateNavigator::selectDates( const QDate &d, int count ) { DateList dates; int i; for( i = 0; i < count; ++i ) { dates.append( d.addDays( i ) ); } mSelectedDates = dates; emitSelected(); } void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) { // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); int dateCount = mSelectedDates.count(); bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); else if ( weekStart && dateCount == 7 ) selectWeek( d ); else selectDates( d, dateCount ); } void DateNavigator::selectWeek() { QDate d = mSelectedDates.first(); selectWeek( d ); } void DateNavigator::selectWeek( int num ) { int year = mSelectedDates.first().year(); if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) ++year; if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) --year; QDate d = QDate ( year, 1,1); while ( d.dayOfWeek() != 4 ) d = d.addDays( 1 ); selectWeek( d.addDays ( (num-1) *7 ) ); } void DateNavigator::selectWeek( const QDate &d ) { int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); int weekStart = KGlobal::locale()->weekStartDay(); QDate firstDate = d.addDays( weekStart - dayOfWeek ); if ( weekStart != 1 && dayOfWeek < weekStart ) { firstDate = firstDate.addDays(-7 ); } selectDates( firstDate, 7 ); } void DateNavigator::selectWorkWeek() { QDate d = mSelectedDates.first(); selectWorkWeek( d ); } void DateNavigator::selectWorkWeek( const QDate &d ) { int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); QDate firstDate = d.addDays( 1 - dayOfWeek ); int weekStart = KGlobal::locale()->weekStartDay(); if ( weekStart != 1 && dayOfWeek >= weekStart ) { firstDate = firstDate.addDays( 7 ); } selectDates( firstDate, 5 ); } +void DateNavigator::selectTodayMonth() +{ + QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); + selectDates( date , date.daysInMonth ()); + +} void DateNavigator::selectToday() { QDate d = QDate::currentDate(); int dateCount = mSelectedDates.count(); if ( dateCount == 5 ) selectWorkWeek( d ); else if ( dateCount == 7 ) selectWeek( d ); else selectDates( d, dateCount ); } void DateNavigator::selectPreviousYear() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectPreviousMonth() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) selectMonthByDate( firstSelected ); else selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectNextMonth() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) selectMonthByDate( firstSelected ); else selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectNextYear() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); selectWeekByDay( weekDay, firstSelected ); } void DateNavigator::selectPrevious() { int offset = -7; if ( datesCount() == 1 ) { offset = -1; } if ( mViewManager ) if ( mViewManager->showsNextDays() ) offset = -datesCount(); selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); } void DateNavigator::selectNext() { int offset = 7; if ( datesCount() == 1 ) { offset = 1; } if ( mViewManager ) if ( mViewManager->showsNextDays() ) offset = datesCount(); selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); } void DateNavigator::emitSelected() { emit datesSelected( mSelectedDates ); } //#include "datenavigator.moc" diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h index 747e3d3..4a19e17 100644 --- a/korganizer/datenavigator.h +++ b/korganizer/datenavigator.h @@ -1,89 +1,90 @@ /* This file is part of KOrganizer. Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef DATENAVIGATOR_H #define DATENAVIGATOR_H #include <libkcal/incidencebase.h> #include <qobject.h> #include "koviewmanager.h" /** This class controls date navigation. All requests to move the views to another date are sent to the DateNavigator. The DateNavigator processes the new selection of dates and emits the required signals for the views. */ class DateNavigator : public QObject { Q_OBJECT public: DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); ~DateNavigator(); KCal::DateList selectedDates(); int datesCount() const; public slots: void selectDates( const KCal::DateList & ); void selectDate( const QDate & ); void selectDates( int count ); void selectDates( const QDate &, int count ); void selectWeek(); void selectWeek( int weeknum ); void selectWeek( const QDate & ); void selectWorkWeek(); void selectWorkWeek( const QDate & ); void selectWeekByDay( int weekDay, const QDate & ); void selectToday(); + void selectTodayMonth(); void selectPreviousYear(); void selectPreviousMonth(); void selectNextMonth(); void selectNextYear(); void selectMonth(); void selectMonthByDate( const QDate & ); void selectPrevious(); void selectNext(); void slotMonthSelect( int ); void slotDaySelect( QDate d ); signals: void datesSelected( const KCal::DateList & ); protected: void emitSelected(); private: KOViewManager * mViewManager; KCal::DateList mSelectedDates; }; #endif diff --git a/korganizer/interfaces/korganizer/baseview.h b/korganizer/interfaces/korganizer/baseview.h index 09f8ba3..2ac9de1 100644 --- a/korganizer/interfaces/korganizer/baseview.h +++ b/korganizer/interfaces/korganizer/baseview.h @@ -1,192 +1,193 @@ /* This file is part of the KOrganizer interfaces. Copyright (c) 1999 Cornelius Schumacher <schumacher@kde.org> Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KORG_BASEVIEW_H #define KORG_BASEVIEW_H // $Id$ // KOBaseView is the abstract base class of all calendar views. #include <qwidget.h> #include <qptrlist.h> #include <qvaluelist.h> #include <klocale.h> #include <kdebug.h> #include <kmessagebox.h> #include <libkcal/event.h> #include <libkcal/calendar.h> using namespace KCal; class CalPrinter; namespace KOrg { class CalPrinterBase { public: enum PrintType { Day, Week, Month, Todolist }; }; /** This class provides an interface for all views being displayed within the main calendar view. It has functions to update the view, to specify date range and other display parameter and to return selected objects. An important class, which inherits KOBaseView is KOEventView, which provides the interface for all views of event data like the agenda or the month view. @short Base class for calendar views @author Preston Brown, Cornelius Schumacher @see KOTodoView, KOEventView, KOListView, KOAgendaView, KOMonthView */ class BaseView : public QWidget { Q_OBJECT public: /** Constructs a view. @param cal Pointer to the calendar object from which events will be retrieved for display. @param parent parent widget. @param name name of this widget. */ BaseView(Calendar *cal, QWidget *parent = 0, const char *name = 0) : QWidget(parent, name), mCalendar(cal) {} /** Destructor. Views will do view-specific cleanups here. */ virtual ~BaseView() {} /** Return calendar object of this view. */ Calendar *calendar() { return mCalendar; } /** @return a list of selected events. Most views can probably only select a single event at a time, but some may be able to select more than one. */ virtual QPtrList<Incidence> selectedIncidences() = 0; /** @return a list of the dates of selected events. Most views can probably only select a single event at a time, but some may be able to select more than one. */ virtual DateList selectedDates() = 0; /** Generate a print preview of this event view. @param calPrinter Calendar printer object used for printing @param fd from date @param td to date */ /* The date parameters should be determined by the view itself and not given as parameters. At the moment I just move the code from the topwidget to the individual views. */ virtual void printPreview(CalPrinter *, const QDate &, const QDate &) { KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" "that view yet.\n")); } /** Print this view. @param calPrinter Calendar printer object used for printing */ virtual void print(CalPrinter *) { KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" "that view yet.\n")); } /** Return number of currently shown dates. A return value of 0 means no idea. */ virtual int currentDateCount() = 0; /** Return if this view is a view for displaying events. */ virtual bool isEventView() { return false; } + virtual bool isMonthView() { return false; } public slots: /** Show incidences for the given date range. The date range actually shown may be different from the requested range, depending on the particular requirements of the view. @param start Start of date range. @param end End of date range. */ virtual void showDates( const QDate &start, const QDate &end ) = 0; /** Show given events. Depending on the actual view it might not be possible to show all given events. @param eventList a list of events to show. */ virtual void showEvents(QPtrList<Event> eventList) = 0; /** Updates the current display to reflect changes that may have happened in the calendar since the last display refresh. */ virtual void updateView() = 0; /** Write all unsaved data back to calendar store. */ virtual void flushView() {} /** Updates the current display to reflect the changes to one particular event. */ virtual void changeEventDisplay(Event *, int) = 0; /** Re-reads the KOrganizer configuration and picks up relevant changes which are applicable to the view. */ virtual void updateConfig() {} /** Clear selection. The incidenceSelected signal is not emitted. */ virtual void clearSelection() {} signals: void incidenceSelected( Incidence * ); protected: Calendar *mCalendar; }; } #endif diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d976246..e94952f 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -1,252 +1,253 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _KOMONTHVIEW_H #define _KOMONTHVIEW_H #include <qlabel.h> #include <qframe.h> #include <qdatetime.h> #include <qlistbox.h> #include <qpoint.h> #include <qlayout.h> #include <qintdict.h> #include <qpushbutton.h> #include <qvaluelist.h> #include <qptrvector.h> #include <libkcal/calendar.h> #include <libkcal/event.h> #include "koeventview.h" class KOWeekButton : public QPushButton { Q_OBJECT public: KOWeekButton( QWidget *parent=0, const char *name=0 ) : QPushButton( parent, name) { connect( this, SIGNAL( clicked() ), SLOT( bottonClicked() )); mNumber = -1; } void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} signals: void selectWeekNum ( int ); private: int mNumber; private slots : void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } }; class KNoScrollListBox: public QListBox { Q_OBJECT public: KNoScrollListBox(QWidget *parent=0, const char *name=0); ~KNoScrollListBox() {} QString getWhatsThisText(QPoint p) ; signals: void shiftDown(); void shiftUp(); void rightClick(); protected slots: void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void mousePressEvent(QMouseEvent *); }; class MonthViewItem: public QListBoxItem { public: MonthViewItem( Incidence *, QDate qd, const QString & title ); void setRecur(bool on) { mRecur = on; } void setAlarm(bool on) { mAlarm = on; } void setReply(bool on) { mReply = on; } void setMoreInfo(bool on) { mInfo = on; } void setPalette(const QPalette &p) { mPalette = p; } QPalette palette() const { return mPalette; } Incidence *incidence() const { return mIncidence; } QDate incidenceDate() { return mDate; } protected: virtual void paint(QPainter *); virtual int height(const QListBox *) const; virtual int width(const QListBox *) const; private: bool mRecur; bool mAlarm; bool mReply; bool mInfo; QPalette mPalette; QDate mDate; Incidence *mIncidence; }; class KOMonthView; class MonthViewCell : public QWidget { Q_OBJECT public: MonthViewCell( KOMonthView * ); void setDate( const QDate & ); QDate date() const; void setPrimary( bool ); bool isPrimary() const; void setHoliday( bool ); void setHoliday( const QString & ); void updateCell(); void updateConfig(); void enableScrollBars( bool ); Incidence *selectedIncidence(); QDate selectedIncidenceDate(); void deselect(); void select(); signals: void defaultAction( Incidence * ); void newEventSignal( QDateTime ); protected: void resizeEvent( QResizeEvent * ); protected slots: void defaultAction( QListBoxItem * ); void contextMenu( QListBoxItem * ); void selection( QListBoxItem * ); void cellClicked( QListBoxItem * ); void newEvent(); private: KOMonthView *mMonthView; QDate mDate; bool mPrimary; bool mHoliday; QString mHolidayString; //QLabel *mLabel; QPushButton *mLabel; QListBox *mItemList; QSize mLabelSize; QSize mLabelBigSize; QPalette mHolidayPalette; QPalette mStandardPalette; QPalette mPrimaryPalette; QPalette mNonPrimaryPalette; void setMyPalette(); QPalette getPalette (); void keyPressEvent ( QKeyEvent * ) ; }; class KOMonthView: public KOEventView { Q_OBJECT public: KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); ~KOMonthView(); /** Returns maximum number of days supported by the komonthview */ virtual int maxDatesHint(); /** Returns number of currently shown dates. */ virtual int currentDateCount(); /** returns the currently selected events */ virtual QPtrList<Incidence> selectedIncidences(); /** returns dates of the currently selected events */ virtual DateList selectedDates(); virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); + bool isMonthView() { return true; } MonthViewCell * selectedCell(); public slots: virtual void updateView(); virtual void updateConfig(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void changeEventDisplay(Event *, int); void clearSelection(); void showContextMenu( Incidence * ); void setSelectedCell( MonthViewCell * ); protected slots: void processSelectionChange(); signals: void selectWeekNum ( int ); protected: void resizeEvent(QResizeEvent *); void viewChanged(); void updateDayLabels(); private: int mDaysPerWeek; int mNumWeeks; int mNumCells; bool mWeekStartsMonday; bool mShowSatSunComp; void computeLayout(); QPtrVector<MonthViewCell> mCells; QPtrVector<QLabel> mDayLabels; QPtrVector<KOWeekButton> mWeekLabels; bool mShortDayLabels; int mWidthLongDayLabel; QDate mStartDate; MonthViewCell *mSelectedCell; KOEventPopupMenu *mContextMenu; void keyPressEvent ( QKeyEvent * ) ; }; #endif |