-rw-r--r-- | kaddressbook/kabcore.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 4 |
2 files changed, 19 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index af12f2b..4e2523e 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -612,7 +612,7 @@ void KABCore::saveSettings() KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); KABPrefs::instance()->writeConfig(); - qDebug("KA: KABCore::saveSettings() "); + //qDebug("KA: KABCore::saveSettings() "); } KABC::AddressBook *KABCore::addressBook() const @@ -844,36 +844,44 @@ void KABCore::beamMySelf() void KABCore::updateMainWindow() { mMainWindow->showMaximized(); - mMainWindow->update(); + //mMainWindow->repaint(); } void KABCore::resizeEvent(QResizeEvent* e ) { if ( !mMiniSplitter ) return; - //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); - if ( e->oldSize().width() != e->size().width() ) + static int desktop_width = 0; + //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() ); + if ( desktop_width != QApplication::desktop()->width() ) if ( QApplication::desktop()->width() >= 480 ) { if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 + //qDebug("640 "); if ( mMiniSplitter->orientation() == Qt::Vertical ) { + //qDebug("switch V->H "); mMiniSplitter->setOrientation( Qt::Horizontal); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } if ( QApplication::desktop()->width() <= 640 ) { + bool shot = mMainWindow->isVisible(); mMainWindow->showMinimized(); //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); mViewManager->getFilterAction()->setComboWidth( 150 ); if ( mIncSearchWidget ) mIncSearchWidget->setSize(); - QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); + if ( shot ) + QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); } } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 + //qDebug("480 "); if ( mMiniSplitter->orientation() == Qt::Horizontal ) { + //qDebug("switch H->V "); mMiniSplitter->setOrientation( Qt::Vertical ); mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); } if ( QApplication::desktop()->width() <= 640 ) { //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); + bool shot = mMainWindow->isVisible(); mMainWindow->showMinimized(); if ( KABPrefs::instance()->mHideSearchOnSwitch ) { if ( mIncSearchWidget ) { @@ -882,10 +890,12 @@ void KABCore::resizeEvent(QResizeEvent* e ) } else { mViewManager->getFilterAction()->setComboWidth( 0 ); } - QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); + if ( shot ) + QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); } } } + desktop_width = QApplication::desktop()->width(); QWidget::resizeEvent( e ); } diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 02fc40a..272f2eb 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -334,10 +334,12 @@ void KAddressBookTableView::refresh(QString uid) // Sometimes the background pixmap gets messed up when we add lots // of items. mListView->repaint(); - + if ( !currentItem ) + currentItem = (ContactListViewItem *)mListView->firstChild(); if ( currentItem ) { mListView->setCurrentItem( currentItem ); mListView->ensureItemVisible( currentItem ); + mListView->setSelected( currentItem, true ); } } else { // Only need to update on entry. Iterate through and try to find it |