summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 753630b..407a5d5 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -32,193 +32,194 @@
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qregexp.h> 34#include <qregexp.h>
35 35
36 36
37#include <kglobal.h> 37#include <kglobal.h>
38#include <kdialog.h> 38#include <kdialog.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43#include <kfiledialog.h> 43#include <kfiledialog.h>
44#include <kstandarddirs.h> 44#include <kstandarddirs.h>
45 45
46#include <libkcal/todo.h> 46#include <libkcal/todo.h>
47#include <libkcal/event.h> 47#include <libkcal/event.h>
48#include <libkdepim/categoryselectdialog.h> 48#include <libkdepim/categoryselectdialog.h>
49#include <libkdepim/kdateedit.h> 49#include <libkdepim/kdateedit.h>
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52#include "koglobals.h" 52#include "koglobals.h"
53 53
54#include "koeditorgeneral.h" 54#include "koeditorgeneral.h"
55#include "kolocationbox.h" 55#include "kolocationbox.h"
56#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
58#else 58#else
59#include <qapplication.h> 59#include <qapplication.h>
60#endif 60#endif
61 61
62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
63 QObject( parent, name) 63 QObject( parent, name)
64{ 64{
65 mNextFocus = 0; 65 mNextFocus = 0;
66} 66}
67 67
68KOEditorGeneral::~KOEditorGeneral() 68KOEditorGeneral::~KOEditorGeneral()
69{ 69{
70} 70}
71 71
72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
73{ 73{
74 QGridLayout *headerLayout = new QGridLayout(topLayout); 74 QGridLayout *headerLayout = new QGridLayout(topLayout);
75 75
76#if 0 76#if 0
77 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 77 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
79#endif 79#endif
80 // 1 on pda 80 // 1 on pda
81 // 11 on desktop 81 // 11 on desktop
82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); 82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
84 headerLayout->addWidget(summaryLabel,0,0); 84 headerLayout->addWidget(summaryLabel,0,0);
85 85
86 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 86 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
91 if ( QApplication::desktop()->width() > 320 ) 91 if ( QApplication::desktop()->width() > 320 )
92 mSummaryEdit->setMaximumHeight( hei +6 ); 92 mSummaryEdit->setMaximumHeight( hei +6 );
93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
95 // mSummaryEdit = new QLineEdit(parent); 95 // mSummaryEdit = new QLineEdit(parent);
96 if ( QApplication::desktop()->height() < 320 ) 96 if ( QApplication::desktop()->height() < 320 )
97 headerLayout->addWidget(mSummaryEdit,0,1); 97 headerLayout->addWidget(mSummaryEdit,0,1);
98 else 98 else
99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); 99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2);
100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
101 101
102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
103 if ( QApplication::desktop()->height() < 320 ) 103 if ( QApplication::desktop()->height() < 320 )
104 headerLayout->addWidget(locationLabel,0,2); 104 headerLayout->addWidget(locationLabel,0,2);
105 else 105 else
106 headerLayout->addWidget(locationLabel,1,0); 106 headerLayout->addWidget(locationLabel,1,0);
107 107
108 mLocationEdit = new KOLocationBox(TRUE,parent,10); 108 mLocationEdit = new KOLocationBox(TRUE,parent,10);
109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) 110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
111 mLocationEdit->setMaximumHeight( hei + 6); 111 mLocationEdit->setMaximumHeight( hei + 6);
112 112
113 // mLocationEdit = new QLineEdit(parent); 113 // mLocationEdit = new QLineEdit(parent);
114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
115 115
116 mCalendarBox = new QComboBox ( parent ); 116 mCalendarBox = new QComboBox ( parent );
117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
118 if ( QApplication::desktop()->height() < 320 ) { 118 if ( QApplication::desktop()->height() < 320 ) {
119 headerLayout->addWidget(mLocationEdit,0,3); 119 headerLayout->addWidget(mLocationEdit,0,3);
120 headerLayout->addWidget(mCalendarBox,0,4); 120 headerLayout->addWidget(mCalendarBox,0,4);
121 headerLayout->setColStretch( 1, 10); 121 headerLayout->setColStretch( 1, 10);
122 headerLayout->setColStretch( 3, 10); 122 headerLayout->setColStretch( 3, 10);
123 mCalendarBox->setMaximumWidth( 64 ); 123 mCalendarBox->setMaximumWidth( 64 );
124 } 124 }
125 else { 125 else {
126 headerLayout->addWidget(mLocationEdit,1,1); 126 headerLayout->addWidget(mLocationEdit,1,1);
127 headerLayout->addWidget(mCalendarBox,1,2); 127 headerLayout->addWidget(mCalendarBox,1,2);
128 headerLayout->setColStretch( 1, 10); 128 headerLayout->setColStretch( 1, 3);
129 headerLayout->setColStretch( 2, 1);
129 } 130 }
130 131
131} 132}
132void KOEditorGeneral::setFocusOn( int i ) 133void KOEditorGeneral::setFocusOn( int i )
133{ 134{
134 mNextFocus = i; 135 mNextFocus = i;
135 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 136 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
136} 137}
137void KOEditorGeneral::slotSetFocusOn() 138void KOEditorGeneral::slotSetFocusOn()
138{ 139{
139 mNextFocus; 140 mNextFocus;
140 if ( mNextFocus == 1 ) { 141 if ( mNextFocus == 1 ) {
141 mDescriptionEdit->setFocus(); 142 mDescriptionEdit->setFocus();
142 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 143 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
143 } 144 }
144 if ( mNextFocus == 2 ) { 145 if ( mNextFocus == 2 ) {
145 mSummaryEdit->setFocus(); 146 mSummaryEdit->setFocus();
146 } 147 }
147} 148}
148void KOEditorGeneral::editCategories() 149void KOEditorGeneral::editCategories()
149{ 150{
150 // qDebug("KOEditorGeneral::editCategories() "); 151 // qDebug("KOEditorGeneral::editCategories() ");
151 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 152 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
152 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 153 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
153 //KOGlobals::fitDialogToScreen( csd ); 154 //KOGlobals::fitDialogToScreen( csd );
154 csd->setColorEnabled(); 155 csd->setColorEnabled();
155 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 156 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
156 csd->exec(); 157 csd->exec();
157 delete csd; 158 delete csd;
158} 159}
159 160
160void KOEditorGeneral::showCatPopup() 161void KOEditorGeneral::showCatPopup()
161{ 162{
162 mCatPopup->clear(); 163 mCatPopup->clear();
163 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); 164 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
164 int index = 0; 165 int index = 0;
165 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 166 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
166 it != KOPrefs::instance()->mCustomCategories.end (); 167 it != KOPrefs::instance()->mCustomCategories.end ();
167 ++it) { 168 ++it) {
168 mCatPopup->insertItem (*it, index ); 169 mCatPopup->insertItem (*it, index );
169 //mCategory[index] = *it; 170 //mCategory[index] = *it;
170 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); 171 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
171 ++index; 172 ++index;
172 } 173 }
173} 174}
174void KOEditorGeneral::selectedCatPopup( int index ) 175void KOEditorGeneral::selectedCatPopup( int index )
175{ 176{
176 QStringList categories = QStringList::split (",", mCategoriesLabel->text()); 177 QStringList categories = QStringList::split (",", mCategoriesLabel->text());
177 QString colcat = categories.first(); 178 QString colcat = categories.first();
178 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) 179 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
179 categories.remove (KOPrefs::instance()->mCustomCategories[index]); 180 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
180 else 181 else
181 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); 182 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
182 categories.sort (); 183 categories.sort ();
183 if ( !colcat.isEmpty() ) { 184 if ( !colcat.isEmpty() ) {
184 if ( categories.find ( colcat ) != categories.end () ) { 185 if ( categories.find ( colcat ) != categories.end () ) {
185 categories.remove( colcat ); 186 categories.remove( colcat );
186 categories.prepend( colcat ); 187 categories.prepend( colcat );
187 } 188 }
188 } 189 }
189 setCategories( categories.join(",") ); 190 setCategories( categories.join(",") );
190} 191}
191 192
192void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 193void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
193{ 194{
194 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 195 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
195 mCatPopup = new QPopupMenu ( parent ); 196 mCatPopup = new QPopupMenu ( parent );
196 mCatPopup->setCheckable (true); 197 mCatPopup->setCheckable (true);
197 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); 198 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
198 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); 199 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
199 mCategoriesButton = new QPushButton(parent); 200 mCategoriesButton = new QPushButton(parent);
200 mCategoriesButton->setText(i18n("Categories...")); 201 mCategoriesButton->setText(i18n("Categories..."));
201 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 202 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
202 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 203 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
203 categoriesLayout->addWidget(mCategoriesButton); 204 categoriesLayout->addWidget(mCategoriesButton);
204 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); 205 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
205 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 206 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
206 mCategoriesLabel->setPopup( mCatPopup ); 207 mCategoriesLabel->setPopup( mCatPopup );
207 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 208 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
208 categoriesLayout->addWidget(mCategoriesLabel,1); 209 categoriesLayout->addWidget(mCategoriesLabel,1);
209} 210}
210 211
211void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 212void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
212{ 213{
213 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 214 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
214 215
215 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 216 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
216 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 217 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
217 secrecyLayout->addWidget(mCancelBox); 218 secrecyLayout->addWidget(mCancelBox);
218 secrecyLayout->addWidget(secrecyLabel); 219 secrecyLayout->addWidget(secrecyLabel);
219 220
220 mSecrecyCombo = new QComboBox(parent); 221 mSecrecyCombo = new QComboBox(parent);
221 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 222 mSecrecyCombo->insertStringList(Incidence::secrecyList());
222 secrecyLayout->addWidget(mSecrecyCombo); 223 secrecyLayout->addWidget(mSecrecyCombo);
223} 224}
224 225