author | zautrix <zautrix> | 2005-04-30 07:32:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-30 07:32:03 (UTC) |
commit | 7c31102a00920834ab8e3778f0f459b96b2fb309 (patch) (side-by-side diff) | |
tree | 9f238caaaab4ba150e4f14708d85162af0ea5092 | |
parent | bdaded2da25b0ccef80d6e638fa12f92a4f8744d (diff) | |
download | kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.zip kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.tar.gz kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.tar.bz2 |
fixes
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 6 | ||||
-rw-r--r-- | korganizer/koeditordetails.cpp | 28 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 10 | ||||
-rw-r--r-- | korganizer/koeventeditor.cpp | 4 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 2 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 4 | ||||
-rw-r--r-- | libkcal/todo.cpp | 6 | ||||
-rw-r--r-- | microkde/kdatetbl.cpp | 13 |
8 files changed, 62 insertions, 11 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 41b2a81..e3c4e0a 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,73 +1,79 @@ Info about the changes in new versions of KDE-Pim/Pi +********** VERSION 2.1.4 ************ + +Fixed two more bugs in the KA/Pi CSV import dialog: +Made it possible to read multi-line fields and import it to the "Note" field. +Fixed a problem in mapping custom fields, whatever a custem field is... + ********** VERSION 2.1.3 ************ Changed the menu structure of the alarm applet: Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". Fixed several problems in the KA/Pi CSV import dialog: Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. ********** VERSION 2.1.2 ************ Fixed a problem closing the alarm dialog on Zaurus with "OK" button. Fixed a problem when importing data from Outlook with mutiple categories set. Changed display of days in datenavigator: Birthdays are now blue, not dark green. When todo view is shown, no birtdays are shown and days with due todos are shown blue. When journal view is shown, only holidays are shown and days with journals are blue. Added Backup options to global config: You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. ********** VERSION 2.1.1 ************ Stable release 2.1.1! KO/Pi: Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. ********** VERSION 2.1.0 ************ Stable release 2.1.0! Summary of changes/fixes compared to version 2.0.6: Many bugs of version 2.0.6 fixed. Most of them were small bugs, but some of them were important. It is recommended to use version 2.1.0 and not version 2.0.6. Important changes: Added recurring todos to KO/Pi. Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. Datenavigator can now display many months. Very useful on the desktop. KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. Made alarm sound working on Linux desktop. Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. Many other usebility enhancements. Special thanks to Ben for his suggestions! You can find the complete changelog from version 1.7.7 to 2.1.0 in the source package or on http://www.pi-sync.net/html/changelog.html diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 802261c..bdfc637 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp @@ -1,286 +1,306 @@ /* This file is part of KOrganizer. Copyright (c) 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 thse 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 <qtooltip.h> #include <qfiledialog.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qapp.h> #include <klocale.h> #include <kglobal.h> #include <kiconloader.h> #include <kstandarddirs.h> #include <kmessagebox.h> #ifndef KORG_NOKABC #ifdef DESKTOP_VERSION #include <kabc/addresseedialog.h> #else //DESKTOP_VERSION #include <externalapphandler.h> #endif //DESKTOP_VERSION #endif #include <libkcal/incidence.h> #include "koprefs.h" #include "koeditordetails.h" template <> CustomListViewItem<class Attendee *>::~CustomListViewItem() { delete mData; } template <> void CustomListViewItem<class Attendee *>::updateItem() { setText(0,mData->name()); setText(1,mData->email()); setText(2,mData->roleStr()); setText(3,mData->statusStr()); if (mData->RSVP() && !mData->email().isEmpty()) setPixmap(4,SmallIcon("mailappt")); else setPixmap(4,SmallIcon("nomailappt")); } KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) : QWidget( parent, name), mDisableItemUpdate( false ) { QGridLayout *topLayout = new QGridLayout(this); topLayout->setSpacing(spacing); QString organizer = KOPrefs::instance()->email(); mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); mListView = new KListView(this,"mListView"); mListView->addColumn(i18n("Name"),180); mListView->addColumn(i18n("Email"),180); mListView->addColumn(i18n("Role"),60); mListView->addColumn(i18n("Status"),100); mListView->addColumn(i18n("RSVP"),35); if ( QApplication::desktop()->width() <= 320 ) { - //mListView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding) ); - mListView->setFixedHeight(80); + int hei = 80; + if ( QApplication::desktop()->height() <= 240 ) + hei = 60; + mListView->setFixedHeight(hei); } mListView->setAllColumnsShowFocus (true ); //mListView->setSingleClick( true ); connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(updateAttendeeInput())); connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); mRsvpButton = new QCheckBox(this); mRsvpButton->setText(i18n("Request response")); mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); QLabel *attendeeLabel = new QLabel(this); attendeeLabel->setText(i18n("Name:")); attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); mNameEdit = new QLineEdit(this); connect(mNameEdit,SIGNAL(textChanged(const QString &)), SLOT(updateAttendeeItem())); mUidEdit = new QLineEdit(0); mUidEdit->setText(""); QLabel *emailLabel = new QLabel(this); emailLabel->setText(i18n("Email:")); mEmailEdit = new QLineEdit(this); connect(mEmailEdit,SIGNAL(textChanged(const QString &)), SLOT(updateAttendeeItem())); QLabel *attendeeRoleLabel = new QLabel(this); attendeeRoleLabel->setText(i18n("Role:")); mRoleCombo = new QComboBox(false,this); mRoleCombo->insertStringList(Attendee::roleList()); connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); QLabel *statusLabel = new QLabel(this); statusLabel->setText( i18n("Status:") ); mStatusCombo = new QComboBox(false,this); mStatusCombo->insertStringList(Attendee::statusList()); connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); QWidget *buttonBox = new QWidget(this); QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); buttonLayout->addWidget(newButton); connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); buttonLayout->addWidget(mRemoveButton); connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); // buttonLayout->addWidget(mAddressBookButton); connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); - + if ( QApplication::desktop()->height() <= 240 ) { + mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); + mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); + topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); + topLayout->addMultiCellWidget(mListView,1,1,0,5); + topLayout->addWidget(attendeeLabel,3,0); + topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); + topLayout->addWidget(emailLabel,4,0); + topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); + topLayout->addWidget(attendeeRoleLabel,5,0); + topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); + topLayout->addWidget(statusLabel,5,3); + topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); + topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); + topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); + topLayout->addMultiCellWidget(buttonBox,3,4,5,5); + topLayout->setRowStretch(1,5); + topLayout->setColStretch(0,0); + } else { if (qApp->desktop()->width() < 640 ) { if ( qApp->desktop()->width() < 300 ) topLayout->setSpacing(1); ;//mListView->setFixedHeight(80); topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); topLayout->addMultiCellWidget(mListView,1,1,0,3); topLayout->addWidget(attendeeLabel,3,0); topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); topLayout->addWidget(emailLabel,4,0); topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); topLayout->addWidget(attendeeRoleLabel,5,0); topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); topLayout->addWidget(statusLabel,6,0); topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); topLayout->addMultiCellWidget(buttonBox,3,4,3,3); topLayout->setRowStretch(1,2); topLayout->setColStretch(0,0); topLayout->setColStretch(1,2); topLayout->setColStretch(2,1); topLayout->setColStretch(3,1); - } else { topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); topLayout->addMultiCellWidget(mListView,1,1,0,5); topLayout->addWidget(attendeeLabel,3,0); topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); topLayout->addWidget(emailLabel,4,0); topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); topLayout->addWidget(attendeeRoleLabel,5,0); topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); topLayout->addWidget(statusLabel,5,3); topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); topLayout->addMultiCellWidget(buttonBox,3,4,5,5); topLayout->setRowStretch(1,5); topLayout->setColStretch(0,0); } + } // #if 0 // topLayout->setColStretch(2,1); // topLayout->addWidget(statusLabel,3,3); // topLayout->addWidget(mStatusCombo,3,4); // #else // topLayout->addWidget(statusLabel,4,3); // // topLayout->addWidget(mStatusCombo,4,3); // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); // #endif // // topLayout->setRowStretch(5,1); // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); // topLayout->setRowStretch(1,5); // topLayout->setColStretch(0,0); #ifdef KORG_NOKABC mAddressBookButton->hide(); #endif updateAttendeeInput(); #ifndef DESKTOP_VERSION //US listen for arriving address resultsets connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); #endif } KOEditorDetails::~KOEditorDetails() { } void KOEditorDetails::removeAttendee() { AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); if (!aItem) return; Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), aItem->data()->uid()); mdelAttendees.append(delA); delete aItem; updateAttendeeInput(); } void KOEditorDetails::openAddressBook() { #ifndef KORG_NOKABC #ifdef DESKTOP_VERSION KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); uint i=0; for (i=0; i < list.count(); i++) { insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); } #else bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); // the result should now arrive through method insertAttendees #endif #if 0 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); if (!a.isEmpty()) { insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); } #endif #endif } void KOEditorDetails::addNewAttendee() { #if 0 // this is cool. If they didn't enter an email address, // try to look it up in the address book and fill it in for them. if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { KabAPI addrBook; QString name; std::list<AddressBook::Entry> entries; name = mNameEdit->text(); if (addrBook.init() == AddressBook::NoError) { if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { kdDebug() << "positive match" << endl; // take first email address if (!entries.front().emails.isEmpty() && entries.front().emails.first().length()>0) mEmailEdit->setText(entries.front().emails.first()); } } } #endif diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 0045b7f..bfe0aec 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -1,203 +1,213 @@ /* This file is part of KOrganizer. Copyright (c) 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. 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 <qwidget.h> #include <qtooltip.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qtimer.h> #include <qfile.h> #include <kglobal.h> #include <kdebug.h> #include <klocale.h> #include <kiconloader.h> #include <kmessagebox.h> #include <kfiledialog.h> #include <kstandarddirs.h> #include <libkcal/todo.h> #include <libkcal/event.h> #include <libkdepim/categoryselectdialog.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" #include "koglobals.h" #include "koeditorgeneral.h" #include "kolocationbox.h" #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : QObject( parent, name) { mNextFocus = 0; } KOEditorGeneral::~KOEditorGeneral() { } void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) { QGridLayout *headerLayout = new QGridLayout(topLayout); #if 0 mOwnerLabel = new QLabel(i18n("Owner:"),parent); headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); #endif QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); headerLayout->addWidget(summaryLabel,1,0); mSummaryEdit = new KOLocationBox(TRUE,parent, 10); mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; if ( QApplication::desktop()->width() > 320 ) mSummaryEdit->setMaximumHeight( hei +6 ); //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } // mSummaryEdit = new QLineEdit(parent); headerLayout->addWidget(mSummaryEdit,1,1); connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); QLabel *locationLabel = new QLabel(i18n("Location:"),parent); + if ( QApplication::desktop()->height() < 320 ) + headerLayout->addWidget(locationLabel,1,2); + else headerLayout->addWidget(locationLabel,2,0); mLocationEdit = new KOLocationBox(TRUE,parent,10); mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); if ( QApplication::desktop()->width() > 320 ) mLocationEdit->setMaximumHeight( hei + 6); // mLocationEdit = new QLineEdit(parent); connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); + if ( QApplication::desktop()->height() < 320 ) { + headerLayout->addWidget(mLocationEdit,1,3); + headerLayout->setColStretch( 1, 10); + headerLayout->setColStretch( 3, 10); + } + else { headerLayout->addWidget(mLocationEdit,2,1); headerLayout->setColStretch( 1, 10); } +} void KOEditorGeneral::setFocusOn( int i ) { mNextFocus = i; QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); } void KOEditorGeneral::slotSetFocusOn() { mNextFocus; if ( mNextFocus == 1 ) { mDescriptionEdit->setFocus(); mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); } if ( mNextFocus == 2 ) { mSummaryEdit->setFocus(); } } void KOEditorGeneral::editCategories() { // qDebug("KOEditorGeneral::editCategories() "); KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); //KOGlobals::fitDialogToScreen( csd ); csd->setColorEnabled(); csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); csd->exec(); delete csd; } void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) { QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); mCategoriesButton = new QPushButton(parent); mCategoriesButton->setText(i18n("Categories...")); connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); categoriesLayout->addWidget(mCategoriesButton); mCategoriesLabel = new QLabel(parent); mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); categoriesLayout->addWidget(mCategoriesLabel,1); } void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) { QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); secrecyLayout->addWidget(mCancelBox); secrecyLayout->addWidget(secrecyLabel); mSecrecyCombo = new QComboBox(parent); mSecrecyCombo->insertStringList(Incidence::secrecyList()); secrecyLayout->addWidget(mSecrecyCombo); } void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) { mDescriptionEdit = new KTextEdit(parent); mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); mDescriptionEdit->append(""); mDescriptionEdit->setReadOnly(false); mDescriptionEdit->setOverwriteMode(false); mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); topLayout->addWidget(mDescriptionEdit); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); #endif } void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); //mAlarmBell = new QLabel(parent); //mAlarmBell->setPixmap(SmallIcon("bell")); //alarmLayout->addWidget(mAlarmBell); if ( QApplication::desktop()->width() < 320 ) mAlarmButton = new QCheckBox(i18n("Rem."),parent); else mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); alarmLayout->addWidget(mAlarmButton); mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); alarmLayout->addWidget(mAlarmTimeEdit); mAlarmIncrCombo = new QComboBox(false, parent); if ( QApplication::desktop()->width() < 320 ) { mAlarmIncrCombo->insertItem(i18n("min")); mAlarmIncrCombo->insertItem(i18n("hou")); mAlarmIncrCombo->insertItem(i18n("day")); mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); } else { diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index e23e680..02d4a78 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp @@ -1,212 +1,214 @@ /* This file is part of KOrganizer. Copyright (c) 2001,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 <qtooltip.h> #include <qframe.h> #include <qpixmap.h> #include <qhbox.h> #include <qdir.h> #include <qlayout.h> #include <qwidgetstack.h> #include <qapplication.h> #include <kiconloader.h> #include <kstandarddirs.h> #include <kdebug.h> #include <klocale.h> #include <kfiledialog.h> #include <kmessagebox.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> #include <libkdepim/categoryselectdialog.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> #include "koprefs.h" #include "koeventeditor.h" extern int globalFlagBlockAgenda; KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) { mEvent = 0; init(); + if ( QApplication::desktop()->height() <= 240 ) + hideButtons(); } KOEventEditor::~KOEventEditor() { //emit dialogClose( mEvent ); } void KOEventEditor::init() { setupGeneral(); setupAttendeesTab(); setupRecurrence(); // Propagate date time settings to recurrence tab connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), mRecurrence,SLOT(setDateTimeStr(const QString &))); // Category dialog // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), // mGeneral,SLOT(setCategories(const QString &))); } void KOEventEditor::reload() { if ( mEvent ) readEvent( mEvent ); } void KOEventEditor::setSecrecy( int sec ) { mGeneral->setSecrecy( sec ); } void KOEventEditor::setCategories( QString s ) { mGeneral->setCategories(s); } void KOEventEditor::setupGeneral() { mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); if( KOPrefs::instance()->mCompactDialogs ) { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); topLayout->setSpacing(spacingHint()-1); topLayout->setMargin(marginHint()-1); mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); mGeneral->initAlarm(topFrame,topLayout); mGeneral->enableAlarm( false ); QBoxLayout *buttonLayout; - if ( QApplication::desktop()->width() < 500 ) + if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) buttonLayout = new QVBoxLayout( topLayout ); else buttonLayout = new QHBoxLayout( topLayout ); QHBox* buttonWidget = new QHBox (topFrame); QIconSet icon; if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else icon = SmallIcon("fileexport"); QPushButton * loadTemplate = new QPushButton( buttonWidget); QPushButton * saveTemplate = new QPushButton( buttonWidget); saveTemplate->setIconSet (icon ) ; int size = saveTemplate->sizeHint().height(); saveTemplate->setFixedSize( size, size ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileimport16"); else icon = SmallIcon("fileimport"); loadTemplate->setIconSet (icon ) ; loadTemplate->setFixedSize( size, size ); buttonLayout->addWidget( buttonWidget ); mGeneral->initCategories( topFrame, buttonLayout ); topLayout->addStretch( 1 ); QFrame *topFrame2 = addPage(i18n("Details")); QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); topLayout2->setSpacing(spacingHint()); mGeneral->initClass(topFrame2,topLayout2); mGeneral->initSecrecy( topFrame2, topLayout2 ); mGeneral->initDescription(topFrame2,topLayout2); connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); } else { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); topLayout->setSpacing(spacingHint()); mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); mGeneral->initAlarm(topFrame,alarmLineLayout); mGeneral->initClass(topFrame,alarmLineLayout); mGeneral->initDescription(topFrame,topLayout); QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); mGeneral->initCategories( topFrame, detailsLayout ); mGeneral->initSecrecy( topFrame, detailsLayout ); } mGeneral->finishSetup(); } void KOEventEditor::setupRecurrence() { QFrame *topFrame = addPage( i18n("Recurrence") ); QBoxLayout *topLayout = new QVBoxLayout( topFrame ); mRecurrence = new KOEditorRecurrence( topFrame ); topLayout->addWidget( mRecurrence ); } void KOEventEditor::editEvent(Event *event, bool showDescription) { // init(); mEvent = event; readEvent(mEvent); if ( showDescription ) { showPage( 1 ); mGeneral->setFocusOn( 1 ); } else { showPage( 0 ); mGeneral->setFocusOn( 2 ); } } void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) { // init(); mEvent = 0; setDefaults(from,to,allDay); } void KOEventEditor::loadDefaults() { int fmt = KOPrefs::instance()->mStartTime; QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); QDateTime to(QDate::currentDate(), QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 5513e8b..9073bca 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp @@ -1,157 +1,159 @@ /* This file is part of KOrganizer. Copyright (c) 1997, 1998 Preston Brown 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. 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 <qtooltip.h> #include <qframe.h> #include <qpixmap.h> #include <qlayout.h> #include <qhbox.h> #include <qdir.h> #include <qdatetime.h> #include <qapplication.h> #include <qtabwidget.h> #include <kiconloader.h> #include <klocale.h> #include <kfiledialog.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <libkdepim/categoryselectdialog.h> #include <libkcal/calendarlocal.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <libkcal/icalformat.h> #include <kresources/resourceselectdialog.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" #include "kolocationbox.h" #include "kotodoeditor.h" extern int globalFlagBlockAgenda; KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) { mTodo = 0; mRelatedTodo = 0; findButton(User1)->hide(); init(); + if ( QApplication::desktop()->height() <= 240 ) + hideButtons(); } KOTodoEditor::~KOTodoEditor() { emit dialogClose( mTodo ); } void KOTodoEditor::init() { setupGeneral(); setupAttendeesTab(); setupRecurrence(); connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); } void KOTodoEditor::setupRecurrence() { QFrame *topFrame = addPage( i18n("Recurrence") ); QBoxLayout *topLayout = new QVBoxLayout( topFrame ); mRecurrence = new KOEditorRecurrence( topFrame ); topLayout->addWidget( mRecurrence ); } void KOTodoEditor::setCategories( QString s ) { mGeneral->setCategories(s); } void KOTodoEditor::setSecrecy( int sec ) { mGeneral->setSecrecy( sec ); } void KOTodoEditor::reload() { if ( mTodo ) readTodo( mTodo ); } void KOTodoEditor::setupGeneral() { mGeneral = new KOEditorGeneralTodo(this); connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), // mGeneral,SLOT(setCategories(const QString &))); if (KOPrefs::instance()->mCompactDialogs) { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); if ( QApplication::desktop()->width() < 480 ) { topLayout->setMargin(marginHintSmall()); topLayout->setSpacing(spacingHintSmall()); } else { topLayout->setMargin(marginHint()); topLayout->setSpacing(spacingHint()); } mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); mGeneral->initAlarm(topFrame,topLayout); mGeneral->enableAlarm( false ); QBoxLayout *priorityLayout; if ( QApplication::desktop()->width() < 500 ) priorityLayout = new QVBoxLayout( topLayout ); else priorityLayout = new QHBoxLayout( topLayout ); QWidget* prioWidget = new QWidget (topFrame); priorityLayout->addWidget( prioWidget ); QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); QIconSet icon; if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileimport16"); else icon = SmallIcon("fileimport"); QPushButton * loadTemplate = new QPushButton( prioWidget); loadTemplate->setIconSet (icon ) ; int size = loadTemplate->sizeHint().height(); loadTemplate->setFixedSize( size, size ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else icon = SmallIcon("fileexport"); QPushButton * saveTemplate = new QPushButton( prioWidget); saveTemplate->setIconSet (icon ) ; saveTemplate->setFixedSize( size, size ); priorityLayout2->addWidget(loadTemplate); priorityLayout2->addWidget(saveTemplate); mGeneral->initPriority(prioWidget,priorityLayout2); mGeneral->initCategories( topFrame, priorityLayout ); topLayout->addStretch(1); diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 007d1f3..59bf1a2 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -21,193 +21,195 @@ with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlayout.h> #include <qcheckbox.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlistview.h> #include <qwhatsthis.h> #include <qlineedit.h> #include <qpushbutton.h> #include <klocale.h> #include <kmessagebox.h> #include <libkdepim/kdateedit.h> #include "koglobals.h" #include "koprefs.h" #include "klineedit.h" #include "calendarview.h" #include "koviewmanager.h" #include "searchdialog.h" SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) : QVBox( 0 ) { mCalendar = calendar; QFrame *topFrame = new QFrame( this ) ;//plainPage(); QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); // Search expression QHBoxLayout *subLayout = new QHBoxLayout(); layout->addLayout(subLayout); searchLabel = new QLabel(topFrame); searchLabel->setText(i18n("Search for:")); subLayout->addWidget(searchLabel); searchEdit = new KLineEdit(topFrame); subLayout->addWidget(searchEdit); QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); //OkButton->setDefault( true ); connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); subLayout->addWidget(OkButton); searchEdit->setText("*"); // Find all events by default searchEdit->setFocus(); connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); // Subjects to search // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), // topFrame); QHBox *incidenceGroup = new QHBox( topFrame ); layout->addWidget(incidenceGroup); mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); //mSearchEvent->setChecked(true); mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); QHBox *subjectGroup = new QHBox( topFrame ); layout->addWidget(subjectGroup); mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); mSummaryCheck->setChecked(true); mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); QHBox *attendeeGroup = new QHBox( topFrame ); layout->addWidget(attendeeGroup ); new QLabel( i18n("Attendee:"),attendeeGroup ); mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); // Date range // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), // topFrame); // layout->addWidget(rangeGroup); QWidget *rangeWidget = new QWidget(topFrame); QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); mStartDate = new KDateEdit(rangeWidget); rangeLayout->addWidget(mStartDate); rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); mEndDate = new KDateEdit(rangeWidget); mEndDate->setDate(QDate::currentDate().addDays(365)); rangeLayout->addWidget(mEndDate); QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); rangeLayout->addWidget( (QWidget*)wt ); layout->addWidget(rangeWidget); // Results list view listView = new KOListView(mCalendar,topFrame); layout->addWidget(listView); - + //layout->setStretchFactor( listView, 333 ); + //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); + //listView->setMaximumHeight( 50 ); listView->readSettings(KOGlobals::config(),"SearchListView Layout"); connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); setCaption( i18n("KO/Pi Find: ")); #ifdef DESKTOP_VERSION OkButton = new QPushButton( i18n("Close"), this ); connect(OkButton,SIGNAL(clicked()),SLOT(hide())); #endif } SearchDialog::~SearchDialog() { } void SearchDialog::raiseAndSelect() { static int currentState = 0; if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) currentState = 0; int newState = 0; if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { newState = VIEW_J_VIEW; } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { newState = VIEW_T_VIEW; } else { newState = VIEW_A_VIEW; } if ( newState != currentState ) { if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { if ( ! mSearchJournal->isChecked() ) { mSearchJournal->setChecked( true ); mSearchTodo->setChecked( false ); mSearchEvent->setChecked( false ); } } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { if ( ! mSearchTodo->isChecked() ) { mSearchTodo->setChecked( true ); mSearchJournal->setChecked( false ); mSearchEvent->setChecked( false ); } } else { if ( ! mSearchEvent->isChecked() ) { mSearchEvent->setChecked( true ); mSearchJournal->setChecked( false ); mSearchTodo->setChecked( false ); } } } currentState = newState; raise(); } void SearchDialog::setFocusToList() { listView->resetFocus(); } void SearchDialog::accept() { doSearch(); } void SearchDialog::updateList() { //listView->updateList(); if ( isVisible() ) { updateView(); //qDebug("SearchDialog::updated "); } else { listView->clear(); //qDebug("SearchDialog::cleared "); } } void SearchDialog::searchTextChanged( const QString &_text ) { #if 0 enableButton( KDialogBase::User1, !_text.isEmpty() ); #endif } void SearchDialog::doSearch() { QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); QString st = searchEdit->text(); if ( st.right(1) != "*") st += "*"; re.setPattern(st); if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index f7e38a7..d7431c7 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -19,193 +19,197 @@ */ #include <kglobal.h> #include <kglobalsettings.h> #include <klocale.h> #include <kdebug.h> #include <qregexp.h> #include <qfileinfo.h> #include "calendarlocal.h" #include "icalformat.h" #include "todo.h" using namespace KCal; Todo::Todo(): QObject(), Incidence() { // mStatus = TENTATIVE; mHasDueDate = false; setHasStartDate( false ); mCompleted = getEvenTime(QDateTime::currentDateTime()); mHasCompletedDate = false; mPercentComplete = 0; mRunning = false; mRunSaveTimer = 0; } Todo::Todo(const Todo &t) : QObject(),Incidence(t) { mDtDue = t.mDtDue; mHasDueDate = t.mHasDueDate; mCompleted = t.mCompleted; mHasCompletedDate = t.mHasCompletedDate; mPercentComplete = t.mPercentComplete; mRunning = false; mRunSaveTimer = 0; } Todo::~Todo() { setRunning( false ); //qDebug("Todo::~Todo() "); } void Todo::setRunningFalse( QString s ) { if ( ! mRunning ) return; mRunning = false; mRunSaveTimer->stop(); saveRunningInfoToFile( s ); } void Todo::setRunning( bool run ) { if ( run == mRunning ) return; //qDebug("Todo::setRunning %d ", run); if ( !mRunSaveTimer ) { mRunSaveTimer = new QTimer ( this ); connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); } mRunning = run; if ( mRunning ) { mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min mRunStart = QDateTime::currentDateTime(); } else { mRunSaveTimer->stop(); saveRunningInfoToFile(); } } void Todo::saveRunningInfoToFile( QString comment ) { //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { qDebug("Running time < 30 seconds. Skipped. "); return; } QString dir = KGlobalSettings::timeTrackerDir(); //qDebug("%s ", dir.latin1()); QString file = "%1%2%3-%4%5%6-"; file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); file.replace ( QRegExp (" "), "0" ); file += uid(); //qDebug("File %s ",file.latin1() ); CalendarLocal cal; cal.setLocalTime(); Todo * to = (Todo*) clone(); to->setFloats( false ); to->setDtStart( mRunStart ); to->setHasStartDate( true ); to->setDtDue( QDateTime::currentDateTime() ); to->setHasDueDate( true ); to->setUid( file ); if ( !comment.isEmpty() ) { - to->setDescription( comment ); + QString des = to->description(); + if ( des.isEmpty () ) + to->setDescription( "TT-Note: " + comment ); + else + to->setDescription( "TT-Note: " + comment +"\n" + des ); } cal.addIncidence( to ); ICalFormat format; file = dir +"/" +file +".ics"; format.save( &cal, file ); saveParents(); } void Todo::saveParents() { if (!relatedTo() ) return; Incidence * inc = relatedTo(); if ( inc->type() != "Todo" ) return; Todo* to = (Todo*)inc; bool saveTodo = false; QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; QFileInfo fi ( file ); if ( fi.exists() ) { if ( fi.lastModified () < to->lastModified ()) saveTodo = true; } else { saveTodo = true; } if ( saveTodo ) { CalendarLocal cal; cal.setLocalTime(); Todo * par = (Todo *) to->clone(); cal.addIncidence( par ); ICalFormat format; format.save( &cal, file ); } to->saveParents(); } int Todo::runTime() { if ( !mRunning ) return 0; return mRunStart.secsTo( QDateTime::currentDateTime() ); } bool Todo::hasRunningSub() { if ( mRunning ) return true; Incidence *aTodo; for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { if ( ((Todo*)aTodo)->hasRunningSub() ) return true; } return false; } Incidence *Todo::clone() { return new Todo(*this); } bool Todo::contains ( Todo* from ) { if ( !from->summary().isEmpty() ) if ( !summary().startsWith( from->summary() )) return false; if ( from->hasStartDate() ) { if ( !hasStartDate() ) return false; if ( from->dtStart() != dtStart()) return false; } if ( from->hasDueDate() ){ if ( !hasDueDate() ) return false; if ( from->dtDue() != dtDue()) return false; } if ( !from->location().isEmpty() ) if ( !location().startsWith( from->location() ) ) return false; if ( !from->description().isEmpty() ) if ( !description().startsWith( from->description() )) return false; if ( from->alarms().count() ) { Alarm *a = from->alarms().first(); if ( a->enabled() ){ if ( !alarms().count() ) return false; Alarm *b = alarms().first(); if( ! b->enabled() ) return false; if ( ! (a->offset() == b->offset() )) return false; } } QStringList cat = categories(); diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 2d97c8c..4271b55 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp @@ -693,247 +693,252 @@ KPopupFrame::keyPressEvent(QKeyEvent* e) void KPopupFrame::close(int r) { result=r; qApp->exit_loop(); } void KPopupFrame::setMainWidget(QWidget* m) { main=m; if(main!=0) { resize(main->width()+2*frameWidth(), main->height()+2*frameWidth()); } } void KPopupFrame::resizeEvent(QResizeEvent*) { if(main!=0) { main->setGeometry(frameWidth(), frameWidth(), width()-2*frameWidth(), height()-2*frameWidth()); } } void KPopupFrame::popup(const QPoint &pos) { // Make sure the whole popup is visible. QRect d = QApplication::desktop()->frameGeometry(); int x = pos.x(); int y = pos.y(); int w = width(); int h = height(); if (x+w > d.x()+d.width()) x = d.width() - w; if (y+h > d.y()+d.height()) y = d.height() - h; if (x < d.x()) x = 0; if (y < d.y()) y = 0; // Pop the thingy up. move(x, y); show(); } int KPopupFrame::exec(QPoint pos) { popup(pos); repaint(); qApp->enter_loop(); hide(); return result; } int KPopupFrame::exec(int x, int y) { return exec(QPoint(x, y)); } void KPopupFrame::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } void KDateTable::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } //#include "kdatetbl.moc" KDateInternalWeekPicker::KDateInternalWeekPicker (QWidget* parent, const char* name) : QGridView(parent, name), result(0) // invalid { QRect rect; QFont font; // ----- activeCol = -1; activeRow = -1; font=KGlobalSettings::generalFont(); int fontsize = 10; int add = 2; if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) add += 6; font.setPointSize(fontsize+add); setFont(font); setHScrollBarMode(AlwaysOff); setVScrollBarMode(AlwaysOff); setFrameStyle(QFrame::NoFrame); + if ( QApplication::desktop()->height() > 240 ) { setNumRows(13); setNumCols(4); + } else { + setNumRows(4); + setNumCols(13); + } // enable to find drawing failures: // setTableFlags(Tbl_clipCellPainting); #if 0 viewport()->setEraseColor(lightGray); // for consistency with the datepicker #endif // ----- find the preferred size // (this is slow, possibly, but unfortunatly it is needed here): QFontMetrics metrics(font); for(int i=1; i <= 52; ++i) { rect=metrics.boundingRect(QString::number( i )); if(max.width()<rect.width()) max.setWidth(rect.width()); if(max.height()<rect.height()) max.setHeight(rect.height()); } if ( QApplication::desktop()->width() > 640 ) { max.setWidth(max.width()+6); max.setHeight(max.height()+8); } } QSize KDateInternalWeekPicker::sizeHint() const { return QSize((max.width()+6)*numCols()+2*frameWidth(), (max.height()+6)*numRows()+2*frameWidth()); } int KDateInternalWeekPicker::getResult() const { return result; } void KDateInternalWeekPicker::setupPainter(QPainter *p) { p->setPen(black); } void KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) { - setCellWidth(width()/4); - setCellHeight(height()/13); + setCellWidth(width()/ numCols()); + setCellHeight(height()/ numRows()); } void KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) { int index; QString text; // ----- find the number of the cell: - index=4*row+col+1; + index=numCols()*row+col+1; text=QString::number( index ); painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); if ( activeCol == col && activeRow == row ) painter->drawRect( 0, 0, cellWidth(), cellHeight() ); } void KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) { if(!isEnabled() || e->button() != LeftButton) { KNotifyClient::beep(); return; } // ----- int row, col; QPoint mouseCoord; // ----- mouseCoord = e->pos(); row=rowAt(mouseCoord.y()); col=columnAt(mouseCoord.x()); if(row<0 || col<0) { // the user clicked on the frame of the table activeCol = -1; activeRow = -1; } else { activeCol = col; activeRow = row; updateCell( row, col /*, false */ ); } } void KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e) { if (e->state() & LeftButton) { int row, col; QPoint mouseCoord; // ----- mouseCoord = e->pos(); row=rowAt(mouseCoord.y()); col=columnAt(mouseCoord.x()); int tmpRow = -1, tmpCol = -1; if(row<0 || col<0) { // the user clicked on the frame of the table if ( activeCol > -1 ) { tmpRow = activeRow; tmpCol = activeCol; } activeCol = -1; activeRow = -1; } else { bool differentCell = (activeRow != row || activeCol != col); if ( activeCol > -1 && differentCell) { tmpRow = activeRow; tmpCol = activeCol; } if ( differentCell) { activeRow = row; activeCol = col; updateCell( row, col /*, false */ ); // mark the new active cell } } if ( tmpRow > -1 ) // repaint the former active cell updateCell( tmpRow, tmpCol /*, true */ ); } } void KDateInternalWeekPicker::contentsMouseReleaseEvent(QMouseEvent *e) { if(!isEnabled()) { return; } // ----- int row, col, pos; QPoint mouseCoord; // ----- mouseCoord = e->pos(); row=rowAt(mouseCoord.y()); col=columnAt(mouseCoord.x()); if(row<0 || col<0) { // the user clicked on the frame of the table emit(closeMe(0)); } - pos=4*row+col+1; + pos=numCols()*row+col+1; result=pos; emit(closeMe(1)); } |