-rw-r--r-- | korganizer/koeditorgeneral.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index e601eef..92e5a0f 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -33,195 +33,196 @@ | |||
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 | ||
62 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | 62 | KOEditorGeneral::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 | ||
68 | KOEditorGeneral::~KOEditorGeneral() | 68 | KOEditorGeneral::~KOEditorGeneral() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 72 | void 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, 50); | 86 | mSummaryEdit = new KOLocationBox(TRUE,parent, 50); |
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,30); | 108 | mLocationEdit = new KOLocationBox(TRUE,parent,30); |
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 | int str = 3; | 128 | int str = 3; |
129 | if ( QApplication::desktop()->width() < 320 ) { | 129 | if ( QApplication::desktop()->width() < 640 ) { |
130 | --str; | ||
131 | --str; | 130 | --str; |
131 | if ( QApplication::desktop()->width() < 320 ) | ||
132 | --str; | ||
132 | } | 133 | } |
133 | headerLayout->setColStretch( 1, str); | 134 | headerLayout->setColStretch( 1, str); |
134 | headerLayout->setColStretch( 2, 1); | 135 | headerLayout->setColStretch( 2, 1); |
135 | } | 136 | } |
136 | 137 | ||
137 | } | 138 | } |
138 | void KOEditorGeneral::setFocusOn( int i ) | 139 | void KOEditorGeneral::setFocusOn( int i ) |
139 | { | 140 | { |
140 | mNextFocus = i; | 141 | mNextFocus = i; |
141 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); | 142 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
142 | } | 143 | } |
143 | void KOEditorGeneral::slotSetFocusOn() | 144 | void KOEditorGeneral::slotSetFocusOn() |
144 | { | 145 | { |
145 | mNextFocus; | 146 | mNextFocus; |
146 | if ( mNextFocus == 1 ) { | 147 | if ( mNextFocus == 1 ) { |
147 | mDescriptionEdit->setFocus(); | 148 | mDescriptionEdit->setFocus(); |
148 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 149 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
149 | } | 150 | } |
150 | if ( mNextFocus == 2 ) { | 151 | if ( mNextFocus == 2 ) { |
151 | mSummaryEdit->setFocus(); | 152 | mSummaryEdit->setFocus(); |
152 | } | 153 | } |
153 | } | 154 | } |
154 | void KOEditorGeneral::editCategories() | 155 | void KOEditorGeneral::editCategories() |
155 | { | 156 | { |
156 | // qDebug("KOEditorGeneral::editCategories() "); | 157 | // qDebug("KOEditorGeneral::editCategories() "); |
157 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 158 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
158 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 159 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
159 | //KOGlobals::fitDialogToScreen( csd ); | 160 | //KOGlobals::fitDialogToScreen( csd ); |
160 | csd->setColorEnabled(); | 161 | csd->setColorEnabled(); |
161 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 162 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
162 | csd->exec(); | 163 | csd->exec(); |
163 | delete csd; | 164 | delete csd; |
164 | } | 165 | } |
165 | 166 | ||
166 | void KOEditorGeneral::showCatPopup() | 167 | void KOEditorGeneral::showCatPopup() |
167 | { | 168 | { |
168 | mCatPopup->clear(); | 169 | mCatPopup->clear(); |
169 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); | 170 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); |
170 | int index = 0; | 171 | int index = 0; |
171 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 172 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
172 | it != KOPrefs::instance()->mCustomCategories.end (); | 173 | it != KOPrefs::instance()->mCustomCategories.end (); |
173 | ++it) { | 174 | ++it) { |
174 | mCatPopup->insertItem (*it, index ); | 175 | mCatPopup->insertItem (*it, index ); |
175 | //mCategory[index] = *it; | 176 | //mCategory[index] = *it; |
176 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); | 177 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); |
177 | ++index; | 178 | ++index; |
178 | } | 179 | } |
179 | } | 180 | } |
180 | void KOEditorGeneral::selectedCatPopup( int index ) | 181 | void KOEditorGeneral::selectedCatPopup( int index ) |
181 | { | 182 | { |
182 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); | 183 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); |
183 | QString colcat = categories.first(); | 184 | QString colcat = categories.first(); |
184 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 185 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
185 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | 186 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); |
186 | else | 187 | else |
187 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); | 188 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); |
188 | categories.sort (); | 189 | categories.sort (); |
189 | if ( !colcat.isEmpty() ) { | 190 | if ( !colcat.isEmpty() ) { |
190 | if ( categories.find ( colcat ) != categories.end () ) { | 191 | if ( categories.find ( colcat ) != categories.end () ) { |
191 | categories.remove( colcat ); | 192 | categories.remove( colcat ); |
192 | categories.prepend( colcat ); | 193 | categories.prepend( colcat ); |
193 | } | 194 | } |
194 | } | 195 | } |
195 | setCategories( categories.join(",") ); | 196 | setCategories( categories.join(",") ); |
196 | } | 197 | } |
197 | 198 | ||
198 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 199 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
199 | { | 200 | { |
200 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 201 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
201 | mCatPopup = new QPopupMenu ( parent ); | 202 | mCatPopup = new QPopupMenu ( parent ); |
202 | mCatPopup->setCheckable (true); | 203 | mCatPopup->setCheckable (true); |
203 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); | 204 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); |
204 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); | 205 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); |
205 | mCategoriesButton = new QPushButton(parent); | 206 | mCategoriesButton = new QPushButton(parent); |
206 | mCategoriesButton->setText(i18n("Categories...")); | 207 | mCategoriesButton->setText(i18n("Categories...")); |
207 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 208 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
208 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 209 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
209 | categoriesLayout->addWidget(mCategoriesButton); | 210 | categoriesLayout->addWidget(mCategoriesButton); |
210 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); | 211 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); |
211 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); | 212 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
212 | mCategoriesLabel->setPopup( mCatPopup ); | 213 | mCategoriesLabel->setPopup( mCatPopup ); |
213 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 214 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
214 | categoriesLayout->addWidget(mCategoriesLabel,1); | 215 | categoriesLayout->addWidget(mCategoriesLabel,1); |
215 | } | 216 | } |
216 | 217 | ||
217 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 218 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) |
218 | { | 219 | { |
219 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 220 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); |
220 | 221 | ||
221 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 222 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
222 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 223 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
223 | secrecyLayout->addWidget(mCancelBox); | 224 | secrecyLayout->addWidget(mCancelBox); |
224 | secrecyLayout->addWidget(secrecyLabel); | 225 | secrecyLayout->addWidget(secrecyLabel); |
225 | 226 | ||
226 | mSecrecyCombo = new QComboBox(parent); | 227 | mSecrecyCombo = new QComboBox(parent); |
227 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 228 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |