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 | |
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 | |||
@@ -88,96 +88,100 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
88 | vb->setStretchFactor ( mTitle, 8 ); | 88 | vb->setStretchFactor ( mTitle, 8 ); |
89 | int limit = 3; | 89 | int limit = 3; |
90 | if ( QApplication::desktop()->width() < 640 ) | 90 | if ( QApplication::desktop()->width() < 640 ) |
91 | limit = 6; | 91 | limit = 6; |
92 | vb->setStretchFactor ( mCalendarBox, limit ); | 92 | vb->setStretchFactor ( mCalendarBox, limit ); |
93 | //mTitleLabel->setMargin(0); | 93 | //mTitleLabel->setMargin(0); |
94 | //mTitleLabel->setAlignment(AlignCenter); | 94 | //mTitleLabel->setAlignment(AlignCenter); |
95 | QPushButton * loadTemplate = new QPushButton( vb ); | 95 | QPushButton * loadTemplate = new QPushButton( vb ); |
96 | QPushButton * saveTemplate = new QPushButton( vb ); | 96 | QPushButton * saveTemplate = new QPushButton( vb ); |
97 | if ( QApplication::desktop()->width() < 321 ) | 97 | if ( QApplication::desktop()->width() < 321 ) |
98 | iconp = SmallIcon("fileexport16"); | 98 | iconp = SmallIcon("fileexport16"); |
99 | else | 99 | else |
100 | iconp = SmallIcon("fileexport"); | 100 | iconp = SmallIcon("fileexport"); |
101 | saveTemplate->setPixmap (iconp ) ; | 101 | saveTemplate->setPixmap (iconp ) ; |
102 | int size = saveTemplate->sizeHint().height(); | 102 | int size = saveTemplate->sizeHint().height(); |
103 | if ( QApplication::desktop()->width() < 321 ) | 103 | if ( QApplication::desktop()->width() < 321 ) |
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 ); |
168 | } | 172 | } |
169 | QSize JournalEntry::sizeHint() const | 173 | QSize JournalEntry::sizeHint() const |
170 | { | 174 | { |
171 | return QSize ( 240, heiHint ); | 175 | return QSize ( 240, heiHint ); |
172 | } | 176 | } |
173 | void JournalEntry::slotSaveTemplate() | 177 | void JournalEntry::slotSaveTemplate() |
174 | { | 178 | { |
175 | QString fileName =locateLocal( "templates", "journals" ); | 179 | QString fileName =locateLocal( "templates", "journals" ); |
176 | QDir t_dir; | 180 | QDir t_dir; |
177 | if ( !t_dir.exists(fileName) ) | 181 | if ( !t_dir.exists(fileName) ) |
178 | t_dir.mkdir ( fileName ); | 182 | t_dir.mkdir ( fileName ); |
179 | fileName += "/journal"; | 183 | fileName += "/journal"; |
180 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 184 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
181 | if ( fileName.length() == 0 ) | 185 | if ( fileName.length() == 0 ) |
182 | return; | 186 | return; |
183 | 187 | ||
@@ -266,102 +270,110 @@ void JournalEntry::toggleShowJournal() | |||
266 | } | 270 | } |
267 | void JournalEntry::setVisibleOn() | 271 | void JournalEntry::setVisibleOn() |
268 | { | 272 | { |
269 | visibleMode = true; | 273 | visibleMode = true; |
270 | } | 274 | } |
271 | void JournalEntry::setShowOnly() | 275 | void JournalEntry::setShowOnly() |
272 | { | 276 | { |
273 | showOnlyMode = true; | 277 | showOnlyMode = true; |
274 | if ( mTitle->currentText().isEmpty() ) | 278 | if ( mTitle->currentText().isEmpty() ) |
275 | mTitle->setFocus(); | 279 | mTitle->setFocus(); |
276 | else | 280 | else |
277 | mEditor->setFocus(); | 281 | mEditor->setFocus(); |
278 | } | 282 | } |
279 | void JournalEntry::setJournal(Journal *journal, bool saveJournal ) | 283 | void JournalEntry::setJournal(Journal *journal, bool saveJournal ) |
280 | { | 284 | { |
281 | if ( saveJournal ) | 285 | if ( 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 | } |
352 | if ( mJournal->description() != mEditor->text() ) { | 364 | if ( mJournal->description() != mEditor->text() ) { |
353 | mJournal->setDescription(mEditor->text()); | 365 | mJournal->setDescription(mEditor->text()); |
354 | } | 366 | } |
355 | if ( mJournal->summary() != mTitle->currentText() ) { | 367 | if ( mJournal->summary() != mTitle->currentText() ) { |
356 | mJournal->setSummary(mTitle->currentText()); | 368 | mJournal->setSummary(mTitle->currentText()); |
357 | mTitle->save(KOLocationBox::SUMMARYJOURNAL); | 369 | mTitle->save(KOLocationBox::SUMMARYJOURNAL); |
358 | } | 370 | } |
359 | int id = KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() ); | 371 | int id = KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() ); |
360 | if ( mJournal->calID() != id ) { | 372 | if ( mJournal->calID() != id ) { |
361 | mJournal->setCalID( id ); | 373 | mJournal->setCalID( id ); |
362 | } | 374 | } |
363 | } | 375 | } |
364 | 376 | ||
365 | void JournalEntry::flushEntry() | 377 | void JournalEntry::flushEntry() |
366 | { | 378 | { |
367 | writeJournal(); | 379 | writeJournal(); |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4fc1194..b378330 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1248,97 +1248,98 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1248 | QListViewItem* cn; | 1248 | QListViewItem* cn; |
1249 | cn = currentItem(); | 1249 | cn = currentItem(); |
1250 | if ( cn ) { | 1250 | if ( cn ) { |
1251 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1251 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1252 | if ( ci ){ | 1252 | if ( ci ){ |
1253 | //emit showIncidence( ci->data()); | 1253 | //emit showIncidence( ci->data()); |
1254 | cn = cn->nextSibling(); | 1254 | cn = cn->nextSibling(); |
1255 | if ( cn ) { | 1255 | if ( cn ) { |
1256 | setCurrentItem ( cn ); | 1256 | setCurrentItem ( cn ); |
1257 | ensureItemVisible ( cn ); | 1257 | ensureItemVisible ( cn ); |
1258 | } | 1258 | } |
1259 | emit showIncidence( ci->data()); | 1259 | emit showIncidence( ci->data()); |
1260 | } | 1260 | } |
1261 | } | 1261 | } |
1262 | e->accept(); | 1262 | e->accept(); |
1263 | } | 1263 | } |
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 | { |
1329 | //qDebug("contentsMousePressEvent++++ "); | 1330 | //qDebug("contentsMousePressEvent++++ "); |
1330 | KListView::contentsMousePressEvent( e ); | 1331 | KListView::contentsMousePressEvent( e ); |
1331 | if ( e->button() == RightButton ) { | 1332 | if ( e->button() == RightButton ) { |
1332 | QListViewItem* ci = currentItem(); | 1333 | QListViewItem* ci = currentItem(); |
1333 | clearSelection () ; | 1334 | clearSelection () ; |
1334 | if ( ci ) | 1335 | if ( ci ) |
1335 | ci->setSelected( true ); | 1336 | ci->setSelected( true ); |
1336 | } | 1337 | } |
1337 | } | 1338 | } |
1338 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1339 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1339 | { | 1340 | { |
1340 | KListView::contentsMouseReleaseEvent(e); | 1341 | KListView::contentsMouseReleaseEvent(e); |
1341 | } | 1342 | } |
1342 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1343 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1343 | { | 1344 | { |
1344 | KListView::contentsMouseMoveEvent(e); | 1345 | KListView::contentsMouseMoveEvent(e); |