summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp1
-rw-r--r--korganizer/koeditorgeneral.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index e545ca8..c9e307f 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,133 +1,134 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#include <qapplication.h>
38#define AGENDA_ICON_SIZE 7 39#define AGENDA_ICON_SIZE 7
39#endif 40#endif
40#include <libkcal/icaldrag.h> 41#include <libkcal/icaldrag.h>
41#include <libkcal/vcaldrag.h> 42#include <libkcal/vcaldrag.h>
42#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 44extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 45extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 46extern int globalFlagBlockAgendaItemUpdate;
46 47
47#include "koprefs.h" 48#include "koprefs.h"
48 49
49#include "koagendaitem.h" 50#include "koagendaitem.h"
50//#include "koagendaitem.moc" 51//#include "koagendaitem.moc"
51 52
52 53
53//-------------------------------------------------------------------------- 54//--------------------------------------------------------------------------
54 55
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 57
57//-------------------------------------------------------------------------- 58//--------------------------------------------------------------------------
58 59
59class KOAgendaItemWhatsThis :public QWhatsThis 60class KOAgendaItemWhatsThis :public QWhatsThis
60{ 61{
61public: 62public:
62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
63 64
64protected: 65protected:
65 virtual QString text( const QPoint& ) 66 virtual QString text( const QPoint& )
66 { 67 {
67 return _view->getWhatsThisText() ; 68 return _view->getWhatsThisText() ;
68 } 69 }
69private: 70private:
70 KOAgendaItem * _view; 71 KOAgendaItem * _view;
71}; 72};
72 73
73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
74 const char *name,WFlags) : 75 const char *name,WFlags) :
75 QWidget(parent, name), mIncidence(incidence), mDate(qd) 76 QWidget(parent, name), mIncidence(incidence), mDate(qd)
76{ 77{
77#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
78 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
79#endif 80#endif
80 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
81 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
82 setWFlags ( wflags); 83 setWFlags ( wflags);
83 mAllDay = allday; 84 mAllDay = allday;
84 init ( incidence, qd ); 85 init ( incidence, qd );
85 //setMouseTracking(true); 86 //setMouseTracking(true);
86 //setAcceptDrops(true); 87 //setAcceptDrops(true);
87 xPaintCoord = -1; 88 xPaintCoord = -1;
88 yPaintCoord = -1; 89 yPaintCoord = -1;
89} 90}
90QString KOAgendaItem::getWhatsThisText() 91QString KOAgendaItem::getWhatsThisText()
91{ 92{
92 if ( mIncidence ) 93 if ( mIncidence )
93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
94 KOPrefs::instance()->mWTshowDetails, 95 KOPrefs::instance()->mWTshowDetails,
95 KOPrefs::instance()->mWTshowCreated, 96 KOPrefs::instance()->mWTshowCreated,
96 KOPrefs::instance()->mWTshowChanged); 97 KOPrefs::instance()->mWTshowChanged);
97 return "KOAgendaItem::getWhatsThisText()::internal error"; 98 return "KOAgendaItem::getWhatsThisText()::internal error";
98} 99}
99void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100void KOAgendaItem::init ( Incidence *incidence, QDate qd )
100{ 101{
101 mIncidence = incidence; 102 mIncidence = incidence;
102 mDate = qd; 103 mDate = qd;
103 mFirstMultiItem = 0; 104 mFirstMultiItem = 0;
104 mNextMultiItem = 0; 105 mNextMultiItem = 0;
105 mLastMultiItem = 0; 106 mLastMultiItem = 0;
106 computeText(); 107 computeText();
107 108
108 if ( (incidence->type() == "Todo") && 109 if ( (incidence->type() == "Todo") &&
109 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
113 else 114 else
114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
115 } 116 }
116 else { 117 else {
117 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
118 QString cat = categories.first(); 119 QString cat = categories.first();
119 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
122 else 123 else
123 mBackgroundColor =KOPrefs::instance()->mEventColor; 124 mBackgroundColor =KOPrefs::instance()->mEventColor;
124 } else { 125 } else {
125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
129 } 130 }
130 } 131 }
131 132
132 } 133 }
133 mColorGroup = QColorGroup( mBackgroundColor.light(), 134 mColorGroup = QColorGroup( mBackgroundColor.light(),
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index f54660f..9df76e7 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,127 +1,128 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qtimer.h>
32#include <qfile.h> 33#include <qfile.h>
33 34
34 35
35#include <kglobal.h> 36#include <kglobal.h>
36#include <kdebug.h> 37#include <kdebug.h>
37#include <klocale.h> 38#include <klocale.h>
38#include <kiconloader.h> 39#include <kiconloader.h>
39#include <kmessagebox.h> 40#include <kmessagebox.h>
40#include <kfiledialog.h> 41#include <kfiledialog.h>
41#include <kstandarddirs.h> 42#include <kstandarddirs.h>
42 43
43#include <libkcal/todo.h> 44#include <libkcal/todo.h>
44#include <libkcal/event.h> 45#include <libkcal/event.h>
45#include <libkdepim/categoryselectdialog.h> 46#include <libkdepim/categoryselectdialog.h>
46#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
47 48
48#include "koprefs.h" 49#include "koprefs.h"
49#include "koglobals.h" 50#include "koglobals.h"
50 51
51#include "koeditorgeneral.h" 52#include "koeditorgeneral.h"
52#include "kolocationbox.h" 53#include "kolocationbox.h"
53#ifndef DESKTOP_VERSION 54#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 55#include <qpe/qpeapplication.h>
55#else 56#else
56#include <qapplication.h> 57#include <qapplication.h>
57#endif 58#endif
58 59
59KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 60KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
60 QObject( parent, name) 61 QObject( parent, name)
61{ 62{
62 mNextFocus = 0; 63 mNextFocus = 0;
63} 64}
64 65
65KOEditorGeneral::~KOEditorGeneral() 66KOEditorGeneral::~KOEditorGeneral()
66{ 67{
67} 68}
68 69
69void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 70void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
70{ 71{
71 QGridLayout *headerLayout = new QGridLayout(topLayout); 72 QGridLayout *headerLayout = new QGridLayout(topLayout);
72 73
73#if 0 74#if 0
74 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 75 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
75 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 76 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
76#endif 77#endif
77 78
78 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 79 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
79 headerLayout->addWidget(summaryLabel,1,0); 80 headerLayout->addWidget(summaryLabel,1,0);
80 81
81 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 82 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
82 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 83 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
83 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 84 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
84 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 85 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
85 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 86 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
86 if ( QApplication::desktop()->width() > 320 ) 87 if ( QApplication::desktop()->width() > 320 )
87 mSummaryEdit->setMaximumHeight( hei +6 ); 88 mSummaryEdit->setMaximumHeight( hei +6 );
88 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 89 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
89 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 90 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
90 // mSummaryEdit = new QLineEdit(parent); 91 // mSummaryEdit = new QLineEdit(parent);
91 headerLayout->addWidget(mSummaryEdit,1,1); 92 headerLayout->addWidget(mSummaryEdit,1,1);
92 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 93 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
93 94
94 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 95 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
95 headerLayout->addWidget(locationLabel,2,0); 96 headerLayout->addWidget(locationLabel,2,0);
96 97
97 mLocationEdit = new KOLocationBox(TRUE,parent,10); 98 mLocationEdit = new KOLocationBox(TRUE,parent,10);
98 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 99 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
99 if ( QApplication::desktop()->width() > 320 ) 100 if ( QApplication::desktop()->width() > 320 )
100 mLocationEdit->setMaximumHeight( hei + 6); 101 mLocationEdit->setMaximumHeight( hei + 6);
101 102
102 // mLocationEdit = new QLineEdit(parent); 103 // mLocationEdit = new QLineEdit(parent);
103 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 104 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
104 headerLayout->addWidget(mLocationEdit,2,1); 105 headerLayout->addWidget(mLocationEdit,2,1);
105 headerLayout->setColStretch( 1, 10); 106 headerLayout->setColStretch( 1, 10);
106} 107}
107void KOEditorGeneral::setFocusOn( int i ) 108void KOEditorGeneral::setFocusOn( int i )
108{ 109{
109 mNextFocus = i; 110 mNextFocus = i;
110 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 111 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
111} 112}
112void KOEditorGeneral::slotSetFocusOn() 113void KOEditorGeneral::slotSetFocusOn()
113{ 114{
114 mNextFocus; 115 mNextFocus;
115 if ( mNextFocus == 1 ) { 116 if ( mNextFocus == 1 ) {
116 mDescriptionEdit->setFocus(); 117 mDescriptionEdit->setFocus();
117 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 118 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
118 } 119 }
119 if ( mNextFocus == 2 ) { 120 if ( mNextFocus == 2 ) {
120 mSummaryEdit->setFocus(); 121 mSummaryEdit->setFocus();
121 } 122 }
122} 123}
123void KOEditorGeneral::editCategories() 124void KOEditorGeneral::editCategories()
124{ 125{
125 // qDebug("KOEditorGeneral::editCategories() "); 126 // qDebug("KOEditorGeneral::editCategories() ");
126 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 127 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
127 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 128 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));