-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 | |||
@@ -613,5 +613,5 @@ void KABCore::saveSettings() | |||
613 | 613 | ||
614 | KABPrefs::instance()->writeConfig(); | 614 | KABPrefs::instance()->writeConfig(); |
615 | qDebug("KA: KABCore::saveSettings() "); | 615 | //qDebug("KA: KABCore::saveSettings() "); |
616 | } | 616 | } |
617 | 617 | ||
@@ -845,5 +845,5 @@ void KABCore::updateMainWindow() | |||
845 | { | 845 | { |
846 | mMainWindow->showMaximized(); | 846 | mMainWindow->showMaximized(); |
847 | mMainWindow->update(); | 847 | //mMainWindow->repaint(); |
848 | } | 848 | } |
849 | void KABCore::resizeEvent(QResizeEvent* e ) | 849 | void KABCore::resizeEvent(QResizeEvent* e ) |
@@ -851,13 +851,17 @@ void KABCore::resizeEvent(QResizeEvent* e ) | |||
851 | if ( !mMiniSplitter ) | 851 | if ( !mMiniSplitter ) |
852 | return; | 852 | return; |
853 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | 853 | static int desktop_width = 0; |
854 | if ( e->oldSize().width() != e->size().width() ) | 854 | //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() ); |
855 | if ( desktop_width != QApplication::desktop()->width() ) | ||
855 | if ( QApplication::desktop()->width() >= 480 ) { | 856 | if ( QApplication::desktop()->width() >= 480 ) { |
856 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 857 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
858 | //qDebug("640 "); | ||
857 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 859 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
860 | //qDebug("switch V->H "); | ||
858 | mMiniSplitter->setOrientation( Qt::Horizontal); | 861 | mMiniSplitter->setOrientation( Qt::Horizontal); |
859 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 862 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
860 | } | 863 | } |
861 | if ( QApplication::desktop()->width() <= 640 ) { | 864 | if ( QApplication::desktop()->width() <= 640 ) { |
865 | bool shot = mMainWindow->isVisible(); | ||
862 | mMainWindow->showMinimized(); | 866 | mMainWindow->showMinimized(); |
863 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 867 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
@@ -865,9 +869,12 @@ void KABCore::resizeEvent(QResizeEvent* e ) | |||
865 | if ( mIncSearchWidget ) | 869 | if ( mIncSearchWidget ) |
866 | mIncSearchWidget->setSize(); | 870 | mIncSearchWidget->setSize(); |
867 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 871 | if ( shot ) |
872 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
868 | } | 873 | } |
869 | 874 | ||
870 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 875 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
876 | //qDebug("480 "); | ||
871 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 877 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
878 | //qDebug("switch H->V "); | ||
872 | mMiniSplitter->setOrientation( Qt::Vertical ); | 879 | mMiniSplitter->setOrientation( Qt::Vertical ); |
873 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 880 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
@@ -875,4 +882,5 @@ void KABCore::resizeEvent(QResizeEvent* e ) | |||
875 | if ( QApplication::desktop()->width() <= 640 ) { | 882 | if ( QApplication::desktop()->width() <= 640 ) { |
876 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 883 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
884 | bool shot = mMainWindow->isVisible(); | ||
877 | mMainWindow->showMinimized(); | 885 | mMainWindow->showMinimized(); |
878 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | 886 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { |
@@ -883,8 +891,10 @@ void KABCore::resizeEvent(QResizeEvent* e ) | |||
883 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 891 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
884 | } | 892 | } |
885 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 893 | if ( shot ) |
894 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
886 | } | 895 | } |
887 | } | 896 | } |
888 | } | 897 | } |
898 | desktop_width = QApplication::desktop()->width(); | ||
889 | QWidget::resizeEvent( e ); | 899 | QWidget::resizeEvent( e ); |
890 | 900 | ||
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 | |||
@@ -335,8 +335,10 @@ void KAddressBookTableView::refresh(QString uid) | |||
335 | // of items. | 335 | // of items. |
336 | mListView->repaint(); | 336 | mListView->repaint(); |
337 | 337 | if ( !currentItem ) | |
338 | currentItem = (ContactListViewItem *)mListView->firstChild(); | ||
338 | if ( currentItem ) { | 339 | if ( currentItem ) { |
339 | mListView->setCurrentItem( currentItem ); | 340 | mListView->setCurrentItem( currentItem ); |
340 | mListView->ensureItemVisible( currentItem ); | 341 | mListView->ensureItemVisible( currentItem ); |
342 | mListView->setSelected( currentItem, true ); | ||
341 | } | 343 | } |
342 | } else { | 344 | } else { |