[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/akregator/src
From: Olivier Trichet <nive () nivalis ! org>
Date: 2009-07-01 12:26:14
Message-ID: 1246451174.789588.1174.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 990009 by otrichet:
Ensure that at least one column is always visible
BUG: 184960
M +19 -1 articlelistview.cpp
M +9 -1 subscriptionlistview.cpp
--- trunk/KDE/kdepim/akregator/src/articlelistview.cpp #990008:990009
@@ -179,14 +179,27 @@
menu->setAttribute( Qt::WA_DeleteOnClose );
const int colCount = model()->columnCount();
+ int visibleColumns = 0; // number of column currently shown
+ QAction *visibleColumnsAction = 0;
for ( int i = 0; i < colCount; ++i )
{
QAction* act = menu->addAction( model()->headerData( i, Qt::Horizontal ).toString() );
act->setCheckable( true );
act->setData( i );
- act->setChecked( !header()->isSectionHidden( i ) );
+ bool sectionVisible = !header()->isSectionHidden( i );
+ act->setChecked( sectionVisible );
+ if ( sectionVisible ) {
+ ++visibleColumns;
+ visibleColumnsAction = act;
+ }
}
+ // Avoid that the last shown column is also hidden
+ if ( visibleColumns == 1 ) {
+ visibleColumnsAction->setEnabled( false );
+ }
+
+
QPointer<QObject> that( this );
QAction * const action = menu->exec( header()->mapToGlobal( pos ) );
if ( that && action ) {
@@ -418,6 +431,11 @@
{
header()->resizeSection( header()->count() - 1, 1 );
header()->restoreState( groupMode ? m_groupHeaderState : m_feedHeaderState );
+
+ // Ensure at least one column is visible
+ if ( header()->hiddenSectionCount() == header()->count() ) {
+ header()->showSection( ArticleModel::ItemTitleColumn );
+ }
}
}
--- trunk/KDE/kdepim/akregator/src/subscriptionlistview.cpp #990008:990009
@@ -154,8 +154,11 @@
QTreeView::setModel( m );
- if ( m )
+ if ( m ) {
header()->restoreState( m_headerState );
+ // Always shows title column
+ header()->showSection( SubscriptionListModel::TitleColumn );
+ }
QStack<QModelIndex> stack;
stack.push( rootIndex() );
@@ -187,6 +190,9 @@
for (int i = 0; i < model()->columnCount(); i++)
{
+ if ( SubscriptionListModel::TitleColumn == i ) {
+ continue;
+ }
QString col = model()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString();
QAction* act = menu->addAction( col );
act->setCheckable( true );
@@ -220,6 +226,8 @@
const KConfigGroup conf( Settings::self()->config(), "General" );
m_headerState = QByteArray::fromBase64( conf.readEntry( "SubscriptionListHeaders" ).toAscii() );
header()->restoreState( m_headerState ); // needed, even with Qt 4.5
+ // Always shows the title column
+ header()->showSection( SubscriptionListModel::TitleColumn );
}
void Akregator::SubscriptionListView::slotPrevFeed()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic