-rw-r--r-- | korganizer/koeditorgeneral.cpp | 13 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.h | 3 | ||||
-rw-r--r-- | korganizer/koeventeditor.cpp | 1 |
3 files changed, 11 insertions, 6 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index abc80d4..f54660f 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -38,103 +38,108 @@ | |||
38 | #include <kiconloader.h> | 38 | #include <kiconloader.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | #include <kfiledialog.h> | 40 | #include <kfiledialog.h> |
41 | #include <kstandarddirs.h> | 41 | #include <kstandarddirs.h> |
42 | 42 | ||
43 | #include <libkcal/todo.h> | 43 | #include <libkcal/todo.h> |
44 | #include <libkcal/event.h> | 44 | #include <libkcal/event.h> |
45 | #include <libkdepim/categoryselectdialog.h> | 45 | #include <libkdepim/categoryselectdialog.h> |
46 | #include <libkdepim/kdateedit.h> | 46 | #include <libkdepim/kdateedit.h> |
47 | 47 | ||
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "koglobals.h" | 49 | #include "koglobals.h" |
50 | 50 | ||
51 | #include "koeditorgeneral.h" | 51 | #include "koeditorgeneral.h" |
52 | #include "kolocationbox.h" | 52 | #include "kolocationbox.h" |
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #else | 55 | #else |
56 | #include <qapplication.h> | 56 | #include <qapplication.h> |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | 59 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : |
60 | QObject( parent, name) | 60 | QObject( parent, name) |
61 | { | 61 | { |
62 | mNextFocus = 0; | ||
62 | } | 63 | } |
63 | 64 | ||
64 | KOEditorGeneral::~KOEditorGeneral() | 65 | KOEditorGeneral::~KOEditorGeneral() |
65 | { | 66 | { |
66 | } | 67 | } |
67 | 68 | ||
68 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 69 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) |
69 | { | 70 | { |
70 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 71 | QGridLayout *headerLayout = new QGridLayout(topLayout); |
71 | 72 | ||
72 | #if 0 | 73 | #if 0 |
73 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 74 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
74 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 75 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
75 | #endif | 76 | #endif |
76 | 77 | ||
77 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); | 78 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); |
78 | headerLayout->addWidget(summaryLabel,1,0); | 79 | headerLayout->addWidget(summaryLabel,1,0); |
79 | 80 | ||
80 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); | 81 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); |
81 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 82 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
82 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); | 83 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); |
83 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); | 84 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); |
84 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; | 85 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; |
85 | if ( QApplication::desktop()->width() > 320 ) | 86 | if ( QApplication::desktop()->width() > 320 ) |
86 | mSummaryEdit->setMaximumHeight( hei +6 ); | 87 | mSummaryEdit->setMaximumHeight( hei +6 ); |
87 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); | 88 | //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); |
88 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } | 89 | // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } |
89 | // mSummaryEdit = new QLineEdit(parent); | 90 | // mSummaryEdit = new QLineEdit(parent); |
90 | headerLayout->addWidget(mSummaryEdit,1,1); | 91 | headerLayout->addWidget(mSummaryEdit,1,1); |
91 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 92 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
92 | 93 | ||
93 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); | 94 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); |
94 | headerLayout->addWidget(locationLabel,2,0); | 95 | headerLayout->addWidget(locationLabel,2,0); |
95 | 96 | ||
96 | mLocationEdit = new KOLocationBox(TRUE,parent,10); | 97 | mLocationEdit = new KOLocationBox(TRUE,parent,10); |
97 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 98 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
98 | if ( QApplication::desktop()->width() > 320 ) | 99 | if ( QApplication::desktop()->width() > 320 ) |
99 | mLocationEdit->setMaximumHeight( hei + 6); | 100 | mLocationEdit->setMaximumHeight( hei + 6); |
100 | 101 | ||
101 | // mLocationEdit = new QLineEdit(parent); | 102 | // mLocationEdit = new QLineEdit(parent); |
102 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 103 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
103 | headerLayout->addWidget(mLocationEdit,2,1); | 104 | headerLayout->addWidget(mLocationEdit,2,1); |
104 | headerLayout->setColStretch( 1, 10); | 105 | headerLayout->setColStretch( 1, 10); |
105 | } | 106 | } |
106 | void KOEditorGeneral::setFocusOn( int i ) | 107 | void KOEditorGeneral::setFocusOn( int i ) |
107 | { | 108 | { |
108 | qApp->processEvents(); | 109 | mNextFocus = i; |
109 | if ( i == 1 ) { | 110 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
111 | } | ||
112 | void KOEditorGeneral::slotSetFocusOn() | ||
113 | { | ||
114 | mNextFocus; | ||
115 | if ( mNextFocus == 1 ) { | ||
110 | mDescriptionEdit->setFocus(); | 116 | mDescriptionEdit->setFocus(); |
111 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 117 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
112 | } | 118 | } |
113 | if ( i == 2 ) { | 119 | if ( mNextFocus == 2 ) { |
114 | mSummaryEdit->setFocus(); | 120 | mSummaryEdit->setFocus(); |
115 | } | 121 | } |
116 | |||
117 | } | 122 | } |
118 | void KOEditorGeneral::editCategories() | 123 | void KOEditorGeneral::editCategories() |
119 | { | 124 | { |
120 | // qDebug("KOEditorGeneral::editCategories() "); | 125 | // qDebug("KOEditorGeneral::editCategories() "); |
121 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 126 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
122 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 127 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
123 | //KOGlobals::fitDialogToScreen( csd ); | 128 | //KOGlobals::fitDialogToScreen( csd ); |
124 | csd->setColorEnabled(); | 129 | csd->setColorEnabled(); |
125 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 130 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
126 | csd->exec(); | 131 | csd->exec(); |
127 | delete csd; | 132 | delete csd; |
128 | } | 133 | } |
129 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 134 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
130 | { | 135 | { |
131 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 136 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
132 | 137 | ||
133 | mCategoriesButton = new QPushButton(parent); | 138 | mCategoriesButton = new QPushButton(parent); |
134 | mCategoriesButton->setText(i18n("Categories...")); | 139 | mCategoriesButton->setText(i18n("Categories...")); |
135 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 140 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
136 | categoriesLayout->addWidget(mCategoriesButton); | 141 | categoriesLayout->addWidget(mCategoriesButton); |
137 | 142 | ||
138 | mCategoriesLabel = new QLabel(parent); | 143 | mCategoriesLabel = new QLabel(parent); |
139 | mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 144 | mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
140 | categoriesLayout->addWidget(mCategoriesLabel,1); | 145 | categoriesLayout->addWidget(mCategoriesLabel,1); |
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index f4728c7..2069e9c 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h | |||
@@ -60,54 +60,55 @@ class KOEditorGeneral : public QObject | |||
60 | void initAlarm(QWidget *,QBoxLayout *); | 60 | void initAlarm(QWidget *,QBoxLayout *); |
61 | 61 | ||
62 | /** Set widgets to default values */ | 62 | /** Set widgets to default values */ |
63 | void setDefaults(bool allDay); | 63 | void setDefaults(bool allDay); |
64 | /** Read event object and setup widgets accordingly */ | 64 | /** Read event object and setup widgets accordingly */ |
65 | void readIncidence(Incidence *); | 65 | void readIncidence(Incidence *); |
66 | /** Write event settings to event object */ | 66 | /** Write event settings to event object */ |
67 | void writeIncidence(Incidence *); | 67 | void writeIncidence(Incidence *); |
68 | 68 | ||
69 | /** Check if the input is valid. */ | 69 | /** Check if the input is valid. */ |
70 | bool validateInput() { return true; } | 70 | bool validateInput() { return true; } |
71 | 71 | ||
72 | void enableAlarm( bool enable ); | 72 | void enableAlarm( bool enable ); |
73 | void setSecrecy( int num ); | 73 | void setSecrecy( int num ); |
74 | public slots: | 74 | public slots: |
75 | void setCategories(const QString &); | 75 | void setCategories(const QString &); |
76 | void editCategories(); | 76 | void editCategories(); |
77 | 77 | ||
78 | protected slots: | 78 | protected slots: |
79 | void enableAlarmEdit( bool enable ); | 79 | void enableAlarmEdit( bool enable ); |
80 | void disableAlarmEdit( bool disable ); | 80 | void disableAlarmEdit( bool disable ); |
81 | void alarmDisable( bool disable ); | 81 | void alarmDisable( bool disable ); |
82 | void pickAlarmSound(); | 82 | void pickAlarmSound(); |
83 | void pickAlarmProgram(); | 83 | void pickAlarmProgram(); |
84 | 84 | void slotSetFocusOn(); | |
85 | signals: | 85 | signals: |
86 | void openCategoryDialog(); | 86 | void openCategoryDialog(); |
87 | void allAccepted(); | 87 | void allAccepted(); |
88 | 88 | ||
89 | protected: | 89 | protected: |
90 | int mNextFocus; | ||
90 | //QLineEdit *mSummaryEdit; | 91 | //QLineEdit *mSummaryEdit; |
91 | //QLineEdit *mLocationEdit; | 92 | //QLineEdit *mLocationEdit; |
92 | KOLocationBox *mSummaryEdit; | 93 | KOLocationBox *mSummaryEdit; |
93 | KOLocationBox *mLocationEdit; | 94 | KOLocationBox *mLocationEdit; |
94 | QLabel *mAlarmBell; | 95 | QLabel *mAlarmBell; |
95 | QCheckBox *mAlarmButton; | 96 | QCheckBox *mAlarmButton; |
96 | QSpinBox *mAlarmTimeEdit; | 97 | QSpinBox *mAlarmTimeEdit; |
97 | QPushButton *mAlarmSoundButton; | 98 | QPushButton *mAlarmSoundButton; |
98 | QPushButton *mAlarmProgramButton; | 99 | QPushButton *mAlarmProgramButton; |
99 | QComboBox *mAlarmIncrCombo; | 100 | QComboBox *mAlarmIncrCombo; |
100 | KTextEdit *mDescriptionEdit; | 101 | KTextEdit *mDescriptionEdit; |
101 | QLabel *mOwnerLabel; | 102 | QLabel *mOwnerLabel; |
102 | QComboBox *mSecrecyCombo; | 103 | QComboBox *mSecrecyCombo; |
103 | QCheckBox *mCancelBox; | 104 | QCheckBox *mCancelBox; |
104 | QPushButton *mCategoriesButton; | 105 | QPushButton *mCategoriesButton; |
105 | QLabel *mCategoriesLabel; | 106 | QLabel *mCategoriesLabel; |
106 | 107 | ||
107 | private: | 108 | private: |
108 | QString getFittingPath( const QString ) ; | 109 | QString getFittingPath( const QString ) ; |
109 | QString mAlarmSound; | 110 | QString mAlarmSound; |
110 | QString mAlarmProgram; | 111 | QString mAlarmProgram; |
111 | QString mAlarmMessage; | 112 | QString mAlarmMessage; |
112 | }; | 113 | }; |
113 | 114 | ||
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index 337db9b..e23e680 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp | |||
@@ -165,49 +165,48 @@ void KOEventEditor::setupGeneral() | |||
165 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); | 165 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); |
166 | mGeneral->initCategories( topFrame, detailsLayout ); | 166 | mGeneral->initCategories( topFrame, detailsLayout ); |
167 | mGeneral->initSecrecy( topFrame, detailsLayout ); | 167 | mGeneral->initSecrecy( topFrame, detailsLayout ); |
168 | } | 168 | } |
169 | 169 | ||
170 | mGeneral->finishSetup(); | 170 | mGeneral->finishSetup(); |
171 | 171 | ||
172 | } | 172 | } |
173 | 173 | ||
174 | void KOEventEditor::setupRecurrence() | 174 | void KOEventEditor::setupRecurrence() |
175 | { | 175 | { |
176 | QFrame *topFrame = addPage( i18n("Recurrence") ); | 176 | QFrame *topFrame = addPage( i18n("Recurrence") ); |
177 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 177 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); |
178 | 178 | ||
179 | mRecurrence = new KOEditorRecurrence( topFrame ); | 179 | mRecurrence = new KOEditorRecurrence( topFrame ); |
180 | topLayout->addWidget( mRecurrence ); | 180 | topLayout->addWidget( mRecurrence ); |
181 | } | 181 | } |
182 | 182 | ||
183 | void KOEventEditor::editEvent(Event *event, bool showDescription) | 183 | void KOEventEditor::editEvent(Event *event, bool showDescription) |
184 | { | 184 | { |
185 | // init(); | 185 | // init(); |
186 | 186 | ||
187 | mEvent = event; | 187 | mEvent = event; |
188 | readEvent(mEvent); | 188 | readEvent(mEvent); |
189 | qApp->processEvents(); | ||
190 | if ( showDescription ) { | 189 | if ( showDescription ) { |
191 | showPage( 1 ); | 190 | showPage( 1 ); |
192 | mGeneral->setFocusOn( 1 ); | 191 | mGeneral->setFocusOn( 1 ); |
193 | } else { | 192 | } else { |
194 | showPage( 0 ); | 193 | showPage( 0 ); |
195 | mGeneral->setFocusOn( 2 ); | 194 | mGeneral->setFocusOn( 2 ); |
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) | 198 | void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) |
200 | { | 199 | { |
201 | // init(); | 200 | // init(); |
202 | 201 | ||
203 | mEvent = 0; | 202 | mEvent = 0; |
204 | setDefaults(from,to,allDay); | 203 | setDefaults(from,to,allDay); |
205 | } | 204 | } |
206 | 205 | ||
207 | void KOEventEditor::loadDefaults() | 206 | void KOEventEditor::loadDefaults() |
208 | { | 207 | { |
209 | int fmt = KOPrefs::instance()->mStartTime; | 208 | int fmt = KOPrefs::instance()->mStartTime; |
210 | 209 | ||
211 | QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); | 210 | QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); |
212 | QDateTime to(QDate::currentDate(), | 211 | QDateTime to(QDate::currentDate(), |
213 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); | 212 | QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); |