author | zautrix <zautrix> | 2005-11-12 22:23:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-12 22:23:02 (UTC) |
commit | 9e47202fd38512cc523c09cf8878f4c5d836e777 (patch) (unidiff) | |
tree | fa35760dc12d7176e3c2e63c22c6482601f7e59d /korganizer | |
parent | f1b53f2c08c2ce384f663ae6f0a818104db8c53e (diff) | |
download | kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.zip kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.tar.gz kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.tar.bz2 |
fix
-rw-r--r-- | korganizer/journalentry.cpp | 16 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 3 |
2 files changed, 16 insertions, 3 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 7f6f221..5269af7 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -104,64 +104,68 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
104 | iconp = SmallIcon("fileimport16"); | 104 | iconp = SmallIcon("fileimport16"); |
105 | else | 105 | else |
106 | iconp = SmallIcon("fileimport"); | 106 | iconp = SmallIcon("fileimport"); |
107 | loadTemplate->setPixmap (iconp ) ; | 107 | loadTemplate->setPixmap (iconp ) ; |
108 | loadTemplate->setFixedSize( size, size ); | 108 | loadTemplate->setFixedSize( size, size ); |
109 | saveTemplate->setFixedSize( size, size ); | 109 | saveTemplate->setFixedSize( size, size ); |
110 | int widwid = size; | 110 | int widwid = size; |
111 | if ( QApplication::desktop()->width() < 320 ) | 111 | if ( QApplication::desktop()->width() < 320 ) |
112 | widwid = size/2+1; | 112 | widwid = size/2+1; |
113 | toggleJournal->setFixedSize( widwid , size ); | 113 | toggleJournal->setFixedSize( widwid , size ); |
114 | mTitle->setFixedHeight( size+4); | 114 | mTitle->setFixedHeight( size+4); |
115 | mCalendarBox->setFixedHeight( size+4); | 115 | mCalendarBox->setFixedHeight( size+4); |
116 | mEditor = new KTextEdit(this); | 116 | mEditor = new KTextEdit(this); |
117 | #ifndef DESKTOP_VERSION | 117 | #ifndef DESKTOP_VERSION |
118 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 118 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
119 | #endif | 119 | #endif |
120 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); | 120 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); |
121 | mDeskWid = QApplication::desktop()->width(); | 121 | mDeskWid = QApplication::desktop()->width(); |
122 | int maxwid = mDeskWid - mMaxWidDiff; | 122 | int maxwid = mDeskWid - mMaxWidDiff; |
123 | if ( QApplication::desktop()->width() < 640 ) { | 123 | if ( QApplication::desktop()->width() < 640 ) { |
124 | mTitle->setMaximumWidth( maxwid/2 +20 ); | 124 | mTitle->setMaximumWidth( maxwid/2 +20 ); |
125 | mCalendarBox->setMaximumWidth( maxwid/2 -20); | 125 | mCalendarBox->setMaximumWidth( maxwid/2 -20); |
126 | } else { | 126 | } else { |
127 | mTitle->setMaximumWidth( (maxwid/4)*3); | 127 | mTitle->setMaximumWidth( (maxwid/4)*3); |
128 | mCalendarBox->setMaximumWidth( maxwid/2 ); | 128 | mCalendarBox->setMaximumWidth( maxwid/2 ); |
129 | } | 129 | } |
130 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | 130 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); |
131 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 131 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
132 | QBoxLayout *topLayout = new QVBoxLayout(this); | 132 | QBoxLayout *topLayout = new QVBoxLayout(this); |
133 | topLayout->addWidget(vb); | 133 | topLayout->addWidget(vb); |
134 | topLayout->addWidget(mEditor); | 134 | topLayout->addWidget(mEditor); |
135 | mEditor->installEventFilter(this); | 135 | mEditor->installEventFilter(this); |
136 | installEventFilter(this); | ||
137 | mTitle->installEventFilter(this); | ||
138 | setFocusPolicy (QWidget::NoFocus); | ||
139 | |||
136 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 140 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
137 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 141 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
138 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 142 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
139 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 143 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
140 | mTitle->lineEdit ()->setText(""); | 144 | mTitle->lineEdit ()->setText(""); |
141 | } | 145 | } |
142 | 146 | ||
143 | JournalEntry::~JournalEntry() | 147 | JournalEntry::~JournalEntry() |
144 | { | 148 | { |
145 | //qDebug("JournalEntry::~JournalEntry() "); | 149 | //qDebug("JournalEntry::~JournalEntry() "); |
146 | } | 150 | } |
147 | void JournalEntry::resizeEvent(QResizeEvent* e ) | 151 | void JournalEntry::resizeEvent(QResizeEvent* e ) |
148 | { | 152 | { |
149 | #ifndef DESKTOP_VERSION | 153 | #ifndef DESKTOP_VERSION |
150 | 154 | ||
151 | if ( mDeskWid != QApplication::desktop()->width() ) { | 155 | if ( mDeskWid != QApplication::desktop()->width() ) { |
152 | mDeskWid == QApplication::desktop()->width(); | 156 | mDeskWid == QApplication::desktop()->width(); |
153 | int maxwid = mDeskWid - mMaxWidDiff; | 157 | int maxwid = mDeskWid - mMaxWidDiff; |
154 | if ( QApplication::desktop()->width() < 640 ) { | 158 | if ( QApplication::desktop()->width() < 640 ) { |
155 | mTitle->setMaximumWidth( maxwid/2 +20 ); | 159 | mTitle->setMaximumWidth( maxwid/2 +20 ); |
156 | mCalendarBox->setMaximumWidth( maxwid/2 -20); | 160 | mCalendarBox->setMaximumWidth( maxwid/2 -20); |
157 | } | 161 | } |
158 | else { | 162 | else { |
159 | mTitle->setMaximumWidth( (maxwid/4)*3); | 163 | mTitle->setMaximumWidth( (maxwid/4)*3); |
160 | mCalendarBox->setMaximumWidth( maxwid/2 ); | 164 | mCalendarBox->setMaximumWidth( maxwid/2 ); |
161 | } | 165 | } |
162 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | 166 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); |
163 | } | 167 | } |
164 | //setMaximumWidth( QApplication::desktop()->width() ); | 168 | //setMaximumWidth( QApplication::desktop()->width() ); |
165 | //qDebug("MAXXX %d ", QApplication::desktop()->width()); | 169 | //qDebug("MAXXX %d ", QApplication::desktop()->width()); |
166 | #endif | 170 | #endif |
167 | QFrame::resizeEvent( e ); | 171 | QFrame::resizeEvent( e ); |
@@ -282,70 +286,78 @@ void JournalEntry::setJournal(Journal *journal, bool saveJournal ) | |||
282 | writeJournal(); | 286 | writeJournal(); |
283 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 287 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
284 | 288 | ||
285 | mJournal = journal; | 289 | mJournal = journal; |
286 | if ( journal->isReadOnly() ) | 290 | if ( journal->isReadOnly() ) |
287 | mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); | 291 | mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); |
288 | else | 292 | else |
289 | mTitle->lineEdit ()->setText(mJournal->summary()); | 293 | mTitle->lineEdit ()->setText(mJournal->summary()); |
290 | mEditor->setText(mJournal->description()); | 294 | mEditor->setText(mJournal->description()); |
291 | mTitle->setEnabled (!journal->isReadOnly() ); | 295 | mTitle->setEnabled (!journal->isReadOnly() ); |
292 | mEditor->setReadOnly ( journal->isReadOnly() ); | 296 | mEditor->setReadOnly ( journal->isReadOnly() ); |
293 | mCalendarBox->setEnabled (!journal->isReadOnly() ); | 297 | mCalendarBox->setEnabled (!journal->isReadOnly() ); |
294 | fillCalendar( mJournal->calID() ); | 298 | fillCalendar( mJournal->calID() ); |
295 | } | 299 | } |
296 | 300 | ||
297 | Journal *JournalEntry::journal() const | 301 | Journal *JournalEntry::journal() const |
298 | { | 302 | { |
299 | return mJournal; | 303 | return mJournal; |
300 | } | 304 | } |
301 | 305 | ||
302 | 306 | ||
303 | void JournalEntry::clear() | 307 | void JournalEntry::clear() |
304 | { | 308 | { |
305 | mJournal = 0; | 309 | mJournal = 0; |
306 | mEditor->setText(""); | 310 | mEditor->setText(""); |
307 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 311 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
308 | mTitle->lineEdit ()->setText(""); | 312 | mTitle->lineEdit ()->setText(""); |
309 | } | 313 | } |
310 | 314 | ||
311 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 315 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
312 | { | 316 | { |
313 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 317 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
314 | 318 | if ( isVisible() ) { | |
319 | mEditor->setFocusPolicy (QWidget::StrongFocus); | ||
320 | mTitle->setFocusPolicy (QWidget::StrongFocus); | ||
321 | } else { | ||
322 | mEditor->setFocusPolicy (QWidget::NoFocus); | ||
323 | mTitle->setFocusPolicy (QWidget::NoFocus); | ||
324 | } | ||
315 | if ( e->type() == QEvent::FocusOut ) { | 325 | if ( e->type() == QEvent::FocusOut ) { |
316 | writeJournal(); | 326 | writeJournal(); |
317 | } | 327 | } |
318 | if ( e->type() == QEvent::KeyPress ) { | 328 | if ( e->type() == QEvent::KeyPress ) { |
319 | QKeyEvent * k = (QKeyEvent *) e; | 329 | QKeyEvent * k = (QKeyEvent *) e; |
330 | if ( !isVisible() ) | ||
331 | return true; | ||
320 | if ( k->state() == Qt::ControlButton ) { | 332 | if ( k->state() == Qt::ControlButton ) { |
321 | k->ignore(); | 333 | k->ignore(); |
322 | //return true; | 334 | //return true; |
323 | } | 335 | } |
324 | } | 336 | } |
325 | 337 | ||
326 | return QFrame::eventFilter( o, e ); // standard event processing | 338 | return QFrame::eventFilter( o, e ); // standard event processing |
327 | } | 339 | } |
328 | 340 | ||
329 | void JournalEntry::writeJournal() | 341 | void JournalEntry::writeJournal() |
330 | { | 342 | { |
331 | if ( !visibleMode ) return; | 343 | if ( !visibleMode ) return; |
332 | if ( !mTitle->isEnabled() ) return; | 344 | if ( !mTitle->isEnabled() ) return; |
333 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { | 345 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { |
334 | if ( mJournal ) { | 346 | if ( mJournal ) { |
335 | Journal* j = mJournal; | 347 | Journal* j = mJournal; |
336 | mJournal = 0; | 348 | mJournal = 0; |
337 | bool conf = KOPrefs::instance()->mConfirm; | 349 | bool conf = KOPrefs::instance()->mConfirm; |
338 | KOPrefs::instance()->mConfirm = false; | 350 | KOPrefs::instance()->mConfirm = false; |
339 | emit deleteJournal(j); | 351 | emit deleteJournal(j); |
340 | KOPrefs::instance()->mConfirm = conf; | 352 | KOPrefs::instance()->mConfirm = conf; |
341 | } | 353 | } |
342 | return; | 354 | return; |
343 | } | 355 | } |
344 | 356 | ||
345 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 357 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
346 | 358 | ||
347 | if (!mJournal) { | 359 | if (!mJournal) { |
348 | mJournal = new Journal; | 360 | mJournal = new Journal; |
349 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 361 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
350 | mCalendar->addJournal(mJournal); | 362 | mCalendar->addJournal(mJournal); |
351 | } | 363 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4fc1194..b378330 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1264,65 +1264,66 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1264 | break; | 1264 | break; |
1265 | case Qt::Key_Return: | 1265 | case Qt::Key_Return: |
1266 | case Qt::Key_Enter: | 1266 | case Qt::Key_Enter: |
1267 | { | 1267 | { |
1268 | QListViewItem* cn; | 1268 | QListViewItem* cn; |
1269 | cn = currentItem(); | 1269 | cn = currentItem(); |
1270 | if ( cn ) { | 1270 | if ( cn ) { |
1271 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1271 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1272 | if ( ci ){ | 1272 | if ( ci ){ |
1273 | if ( e->state() == ShiftButton ) | 1273 | if ( e->state() == ShiftButton ) |
1274 | ci->setSelected( false ); | 1274 | ci->setSelected( false ); |
1275 | else | 1275 | else |
1276 | ci->setSelected( true ); | 1276 | ci->setSelected( true ); |
1277 | cn = cn->nextSibling(); | 1277 | cn = cn->nextSibling(); |
1278 | if ( cn ) { | 1278 | if ( cn ) { |
1279 | setCurrentItem ( cn ); | 1279 | setCurrentItem ( cn ); |
1280 | ensureItemVisible ( cn ); | 1280 | ensureItemVisible ( cn ); |
1281 | } else { | 1281 | } else { |
1282 | emit currentChanged( ci ); | 1282 | emit currentChanged( ci ); |
1283 | } | 1283 | } |
1284 | } | 1284 | } |
1285 | } | 1285 | } |
1286 | e->accept(); | 1286 | e->accept(); |
1287 | } | 1287 | } |
1288 | break; | 1288 | break; |
1289 | default: | 1289 | default: |
1290 | e->ignore(); | 1290 | e->ignore(); |
1291 | } | 1291 | } |
1292 | } | 1292 | } |
1293 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1293 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1294 | : KListView( lv, "kolistlistview", false ) | 1294 | : KListView( lv, "kolistlistview", false ) |
1295 | { | 1295 | { |
1296 | mYMousePos = 0; | 1296 | mYMousePos = 0; |
1297 | setAllColumnsShowFocus( true ); | ||
1297 | mPopupTimer = new QTimer(this); | 1298 | mPopupTimer = new QTimer(this); |
1298 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1299 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1299 | #ifndef DESKTOP_VERSION | 1300 | #ifndef DESKTOP_VERSION |
1300 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1301 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1301 | #endif | 1302 | #endif |
1302 | setSelectionMode( QListView::Multi ); | 1303 | setSelectionMode( QListView::Multi ); |
1303 | setMultiSelection( true); | 1304 | setMultiSelection( true); |
1304 | } | 1305 | } |
1305 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) | 1306 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) |
1306 | { | 1307 | { |
1307 | QListViewItem *qitem = firstChild (); | 1308 | QListViewItem *qitem = firstChild (); |
1308 | while ( qitem ) { | 1309 | while ( qitem ) { |
1309 | if ( qitem->isSelected() && item != qitem ) | 1310 | if ( qitem->isSelected() && item != qitem ) |
1310 | return true; | 1311 | return true; |
1311 | qitem = qitem->nextSibling(); | 1312 | qitem = qitem->nextSibling(); |
1312 | } | 1313 | } |
1313 | return false; | 1314 | return false; |
1314 | } | 1315 | } |
1315 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1316 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1316 | { | 1317 | { |
1317 | if (!e) return; | 1318 | if (!e) return; |
1318 | QPoint vp = contentsToViewport(e->pos()); | 1319 | QPoint vp = contentsToViewport(e->pos()); |
1319 | QListViewItem *item = itemAt(vp); | 1320 | QListViewItem *item = itemAt(vp); |
1320 | if (!item) { | 1321 | if (!item) { |
1321 | emit newEvent(); | 1322 | emit newEvent(); |
1322 | return; | 1323 | return; |
1323 | } | 1324 | } |
1324 | KListView::contentsMouseDoubleClickEvent(e); | 1325 | KListView::contentsMouseDoubleClickEvent(e); |
1325 | } | 1326 | } |
1326 | #if 0 | 1327 | #if 0 |
1327 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1328 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1328 | { | 1329 | { |