summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 5c94f62..2fbcd42 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,161 +1,162 @@
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 <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qregexp.h>
34 35
35 36
36#include <kglobal.h> 37#include <kglobal.h>
37#include <kdebug.h> 38#include <kdebug.h>
38#include <klocale.h> 39#include <klocale.h>
39#include <kiconloader.h> 40#include <kiconloader.h>
40#include <kmessagebox.h> 41#include <kmessagebox.h>
41#include <kfiledialog.h> 42#include <kfiledialog.h>
42#include <kstandarddirs.h> 43#include <kstandarddirs.h>
43 44
44#include <libkcal/todo.h> 45#include <libkcal/todo.h>
45#include <libkcal/event.h> 46#include <libkcal/event.h>
46#include <libkdepim/categoryselectdialog.h> 47#include <libkdepim/categoryselectdialog.h>
47#include <libkdepim/kdateedit.h> 48#include <libkdepim/kdateedit.h>
48 49
49#include "koprefs.h" 50#include "koprefs.h"
50#include "koglobals.h" 51#include "koglobals.h"
51 52
52#include "koeditorgeneral.h" 53#include "koeditorgeneral.h"
53#include "kolocationbox.h" 54#include "kolocationbox.h"
54#ifndef DESKTOP_VERSION 55#ifndef DESKTOP_VERSION
55#include <qpe/qpeapplication.h> 56#include <qpe/qpeapplication.h>
56#else 57#else
57#include <qapplication.h> 58#include <qapplication.h>
58#endif 59#endif
59 60
60KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 61KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
61 QObject( parent, name) 62 QObject( parent, name)
62{ 63{
63 mNextFocus = 0; 64 mNextFocus = 0;
64} 65}
65 66
66KOEditorGeneral::~KOEditorGeneral() 67KOEditorGeneral::~KOEditorGeneral()
67{ 68{
68} 69}
69 70
70void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 71void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
71{ 72{
72 QGridLayout *headerLayout = new QGridLayout(topLayout); 73 QGridLayout *headerLayout = new QGridLayout(topLayout);
73 74
74#if 0 75#if 0
75 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 76 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
76 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 77 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
77#endif 78#endif
78 79
79 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 80 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
80 headerLayout->addWidget(summaryLabel,1,0); 81 headerLayout->addWidget(summaryLabel,1,0);
81 82
82 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 83 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
83 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 84 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
84 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 85 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
85 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 86 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
86 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 87 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
87 if ( QApplication::desktop()->width() > 320 ) 88 if ( QApplication::desktop()->width() > 320 )
88 mSummaryEdit->setMaximumHeight( hei +6 ); 89 mSummaryEdit->setMaximumHeight( hei +6 );
89 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 90 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
90 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 91 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
91 // mSummaryEdit = new QLineEdit(parent); 92 // mSummaryEdit = new QLineEdit(parent);
92 headerLayout->addWidget(mSummaryEdit,1,1); 93 headerLayout->addWidget(mSummaryEdit,1,1);
93 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 94 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
94 95
95 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 96 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
96 if ( QApplication::desktop()->height() < 320 ) 97 if ( QApplication::desktop()->height() < 320 )
97 headerLayout->addWidget(locationLabel,1,2); 98 headerLayout->addWidget(locationLabel,1,2);
98 else 99 else
99 headerLayout->addWidget(locationLabel,2,0); 100 headerLayout->addWidget(locationLabel,2,0);
100 101
101 mLocationEdit = new KOLocationBox(TRUE,parent,10); 102 mLocationEdit = new KOLocationBox(TRUE,parent,10);
102 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 103 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
103 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) 104 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
104 mLocationEdit->setMaximumHeight( hei + 6); 105 mLocationEdit->setMaximumHeight( hei + 6);
105 106
106 // mLocationEdit = new QLineEdit(parent); 107 // mLocationEdit = new QLineEdit(parent);
107 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 108 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
108 if ( QApplication::desktop()->height() < 320 ) { 109 if ( QApplication::desktop()->height() < 320 ) {
109 headerLayout->addWidget(mLocationEdit,1,3); 110 headerLayout->addWidget(mLocationEdit,1,3);
110 headerLayout->setColStretch( 1, 10); 111 headerLayout->setColStretch( 1, 10);
111 headerLayout->setColStretch( 3, 10); 112 headerLayout->setColStretch( 3, 10);
112 } 113 }
113 else { 114 else {
114 headerLayout->addWidget(mLocationEdit,2,1); 115 headerLayout->addWidget(mLocationEdit,2,1);
115 headerLayout->setColStretch( 1, 10); 116 headerLayout->setColStretch( 1, 10);
116 } 117 }
117} 118}
118void KOEditorGeneral::setFocusOn( int i ) 119void KOEditorGeneral::setFocusOn( int i )
119{ 120{
120 mNextFocus = i; 121 mNextFocus = i;
121 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 122 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
122} 123}
123void KOEditorGeneral::slotSetFocusOn() 124void KOEditorGeneral::slotSetFocusOn()
124{ 125{
125 mNextFocus; 126 mNextFocus;
126 if ( mNextFocus == 1 ) { 127 if ( mNextFocus == 1 ) {
127 mDescriptionEdit->setFocus(); 128 mDescriptionEdit->setFocus();
128 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 129 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
129 } 130 }
130 if ( mNextFocus == 2 ) { 131 if ( mNextFocus == 2 ) {
131 mSummaryEdit->setFocus(); 132 mSummaryEdit->setFocus();
132 } 133 }
133} 134}
134void KOEditorGeneral::editCategories() 135void KOEditorGeneral::editCategories()
135{ 136{
136 // qDebug("KOEditorGeneral::editCategories() "); 137 // qDebug("KOEditorGeneral::editCategories() ");
137 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 138 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
138 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 139 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
139 //KOGlobals::fitDialogToScreen( csd ); 140 //KOGlobals::fitDialogToScreen( csd );
140 csd->setColorEnabled(); 141 csd->setColorEnabled();
141 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 142 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
142 csd->exec(); 143 csd->exec();
143 delete csd; 144 delete csd;
144} 145}
145 146
146void KOEditorGeneral::showCatPopup() 147void KOEditorGeneral::showCatPopup()
147{ 148{
148 mCatPopup->clear(); 149 mCatPopup->clear();
149 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); 150 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
150 int index = 0; 151 int index = 0;
151 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 152 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
152 it != KOPrefs::instance()->mCustomCategories.end (); 153 it != KOPrefs::instance()->mCustomCategories.end ();
153 ++it) { 154 ++it) {
154 mCatPopup->insertItem (*it, index ); 155 mCatPopup->insertItem (*it, index );
155 //mCategory[index] = *it; 156 //mCategory[index] = *it;
156 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); 157 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
157 ++index; 158 ++index;
158 } 159 }
159} 160}
160void KOEditorGeneral::selectedCatPopup( int index ) 161void KOEditorGeneral::selectedCatPopup( int index )
161{ 162{