[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/kphotoalbum
From:       Miika Turkia <miika.turkia () gmail ! com>
Date:       2010-08-28 5:14:27
Message-ID: 20100828051427.3F10BAC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1169003 by mturkia:

* Added option to sort category items aphabetically on annotation
dialog (tree view alphabetical, flat alphabetical and most recently
used are the currently supported options). Thanks to Reimar Imhof for
the patch.


 M  +4 -2      AnnotationDialog/Dialog.cpp  
 M  +56 -20    AnnotationDialog/ListSelect.cpp  
 M  +6 -3      AnnotationDialog/ListSelect.h  
 M  +4 -0      ChangeLog  
 M  +1 -1      Settings/SettingsData.h  


--- trunk/extragear/graphics/kphotoalbum/AnnotationDialog/Dialog.cpp \
#1169002:1169003 @@ -823,10 +823,12 @@
     _actions = new KActionCollection( this );
 
     KAction* action = 0;
-    action = _actions->addAction( \
QString::fromLatin1("annotationdialog-sort-alpha"), _optionList.at(0), \
                SLOT( slotSortAlpha() ) );
-    action->setText( i18n("Sort Alphabetically") );
+    action = _actions->addAction( \
QString::fromLatin1("annotationdialog-sort-alphatree"), _optionList.at(0), \
SLOT( slotSortAlphaTree() ) ); +    action->setText( i18n("Sort \
Alphabetically (Tree)") );  action->setShortcut(Qt::CTRL+Qt::Key_F4);
 
+    action = _actions->addAction( \
QString::fromLatin1("annotationdialog-sort-alphaflat"), _optionList.at(0), \
SLOT( slotSortAlphaFlat() ) ); +    action->setText( i18n("Sort \
Alphabetically (Flat)") );  
     action = _actions->addAction( \
QString::fromLatin1("annotationdialog-sort-MRU"), _optionList.at(0), SLOT( \
slotSortDate() ) );  action->setText( i18n("Sort Most Recently Used") );
--- trunk/extragear/graphics/kphotoalbum/AnnotationDialog/ListSelect.cpp \
#1169002:1169003 @@ -84,12 +84,18 @@
     QButtonGroup* grp = new QButtonGroup( this );
     grp->setExclusive( true );
 
-    _alphaSort = new QToolButton;
-    _alphaSort->setIcon( SmallIcon( QString::fromLatin1( "draw-text" ) ) \
                );
-    _alphaSort->setCheckable( true );
-    _alphaSort->setToolTip( i18n("Sort Alphabetically") );
-    grp->addButton( _alphaSort );
+    _alphaTreeSort = new QToolButton;
+    _alphaTreeSort->setIcon( SmallIcon( QString::fromLatin1( \
"view-list-tree" ) ) ); +    _alphaTreeSort->setCheckable( true );
+    _alphaTreeSort->setToolTip( i18n("Sort Alphabetically (Tree)") );
+    grp->addButton( _alphaTreeSort );
 
+    _alphaFlatSort = new QToolButton;
+    _alphaFlatSort->setIcon( SmallIcon( QString::fromLatin1( "draw-text" ) \
) ); +    _alphaFlatSort->setCheckable( true );
+    _alphaFlatSort->setToolTip( i18n("Sort Alphabetically (Flat)") );
+    grp->addButton( _alphaFlatSort );
+
     _dateSort = new QToolButton;
     _dateSort->setIcon( SmallIcon( QString::fromLatin1( \
"x-office-calendar" ) ) );  _dateSort->setCheckable( true );
@@ -101,13 +107,16 @@
     _showSelectedOnly->setCheckable( true );
     _showSelectedOnly->setToolTip( i18n("Show only selected Ctrl+S") );
 
-    _alphaSort->setChecked( Settings::ViewSortType() == \
Settings::SortAlpha ); +    _alphaTreeSort->setChecked( \
Settings::ViewSortType() == Settings::SortAlphaTree ); +    \
_alphaFlatSort->setChecked( Settings::ViewSortType() == \
                Settings::SortAlphaFlat );
     _dateSort->setChecked( Settings::ViewSortType() == \
                Settings::SortLastUse );
     connect( _dateSort, SIGNAL( clicked() ), this, SLOT( slotSortDate() ) \
                );
-    connect( _alphaSort, SIGNAL( clicked() ), this, SLOT( slotSortAlpha() \
) ); +    connect( _alphaTreeSort, SIGNAL( clicked() ), this, SLOT( \
slotSortAlphaTree() ) ); +    connect( _alphaFlatSort, SIGNAL( clicked() ), \
                this, SLOT( slotSortAlphaFlat() ) );
     connect( _showSelectedOnly, SIGNAL( clicked() ), \
&ShowSelectionOnlyManager::instance(), SLOT( toggle() ) );  
-    lay2->addWidget( _alphaSort );
+    lay2->addWidget( _alphaTreeSort );
+    lay2->addWidget( _alphaFlatSort );
     lay2->addWidget( _dateSort );
     lay2->addWidget( _showSelectedOnly );
 
@@ -200,7 +209,8 @@
     _lineEdit->setText( text );
     setMode( _mode );	// generate the ***NONE*** entry if in search mode
 
-    _alphaSort->setChecked( tp == Settings::SortAlpha );
+    _alphaTreeSort->setChecked( tp == Settings::SortAlphaTree );
+    _alphaFlatSort->setChecked( tp == Settings::SortAlphaFlat );
     _dateSort->setChecked( tp == Settings::SortLastUse );
 }
 
@@ -331,9 +341,11 @@
     menu->addAction( action );
 
     QAction* usageAction = menu->addAction( i18n("Usage") );
-    QAction* alphaAction = menu->addAction( i18n("Alphabetical") );
+    QAction* alphaFlatAction = menu->addAction( i18n("Alphabetical \
(Flat)") ); +    QAction* alphaTreeAction = menu->addAction( \
                i18n("Alphabetical (Tree)") );
     usageAction->setChecked( \
Settings::SettingsData::instance()->viewSortType() == \
                Settings::SortLastUse);
-    alphaAction->setChecked( \
Settings::SettingsData::instance()->viewSortType() == Settings::SortAlpha); \
+    alphaFlatAction->setChecked( \
Settings::SettingsData::instance()->viewSortType() == \
Settings::SortAlphaFlat); +    alphaTreeAction->setChecked( \
Settings::SettingsData::instance()->viewSortType() == \
Settings::SortAlphaTree);  
     if ( !item ) {
         deleteAction->setEnabled( false );
@@ -387,9 +399,12 @@
     else if ( which == usageAction ) {
         Settings::SettingsData::instance()->setViewSortType( \
Settings::SortLastUse );  }
-    else if ( which == alphaAction ) {
-        Settings::SettingsData::instance()->setViewSortType( \
Settings::SortAlpha ); +    else if ( which == alphaTreeAction ) {
+        Settings::SettingsData::instance()->setViewSortType( \
Settings::SortAlphaTree );  }
+    else if ( which == alphaFlatAction ) {
+        Settings::SettingsData::instance()->setViewSortType( \
Settings::SortAlphaFlat ); +    }
     else if ( which == newCategoryAction ) {
         QString superCategory = KInputDialog::getText( i18n("New Super \
Category"), i18n("New Super Category Name:") );  if ( \
superCategory.isEmpty() ) @@ -453,8 +468,10 @@
 {
     _listView->clear();
 
-    if ( Settings::SettingsData::instance()->viewSortType() == \
                Settings::SortAlpha )
-        populateAlphabetically();
+    if ( Settings::SettingsData::instance()->viewSortType() == \
Settings::SortAlphaTree ) +        populateAlphaTree();
+    else if ( Settings::SettingsData::instance()->viewSortType() == \
Settings::SortAlphaFlat ) +        populateAlphaFlat();
     else
         populateMRU();
 }
@@ -478,11 +495,16 @@
     Settings::SettingsData::instance()->setViewSortType( \
Settings::SortLastUse );  }
 
-void AnnotationDialog::ListSelect::slotSortAlpha()
+void AnnotationDialog::ListSelect::slotSortAlphaTree()
 {
-    Settings::SettingsData::instance()->setViewSortType( \
Settings::SortAlpha ); +    \
Settings::SettingsData::instance()->setViewSortType( \
Settings::SortAlphaTree );  }
 
+void AnnotationDialog::ListSelect::slotSortAlphaFlat()
+{
+    Settings::SettingsData::instance()->setViewSortType( \
Settings::SortAlphaFlat ); +}
+
 void AnnotationDialog::ListSelect::rePopulate()
 {
     const int x = _listView->contentsX();
@@ -505,7 +527,7 @@
     ShowSelectionOnlyManager::instance().unlimitFromSelection();
 }
 
-void AnnotationDialog::ListSelect::populateAlphabetically()
+void AnnotationDialog::ListSelect::populateAlphaTree()
 {
     DB::CategoryItemPtr item = _category->itemsCategories();
 
@@ -513,6 +535,18 @@
     _listView->setSorting( 0 );
 }
 
+void AnnotationDialog::ListSelect::populateAlphaFlat()
+{
+    QStringList items = _category->itemsInclCategories();
+
+    for( QStringList::ConstIterator itemIt = items.constBegin(); itemIt != \
items.constEnd(); ++itemIt ) { +        CheckDropItem* item = new \
CheckDropItem( _listView, *itemIt, *itemIt ); +        configureItem( item \
); +    }
+
+    _listView->setSorting( 1 );
+}
+
 void AnnotationDialog::ListSelect::populateMRU()
 {
     QStringList items = _category->itemsInclCategories();
@@ -531,7 +565,9 @@
 {
     Settings::SettingsData* data = Settings::SettingsData::instance();
     if ( data->viewSortType() == Settings::SortLastUse )
-        data->setViewSortType( Settings::SortAlpha );
+        data->setViewSortType( Settings::SortAlphaTree );
+    else if ( data->viewSortType() == Settings::SortAlphaTree )
+        data->setViewSortType( Settings::SortAlphaFlat );
     else
         data->setViewSortType( Settings::SortLastUse );
 }
@@ -554,7 +590,7 @@
 
 void AnnotationDialog::ListSelect::configureItem( \
CategoryListView::CheckDropItem* item )  {
-    bool isDNDAllowed = Settings::SettingsData::instance()->viewSortType() \
== Settings::SortAlpha; +    bool isDNDAllowed = \
Settings::SettingsData::instance()->viewSortType() == \
                Settings::SortAlphaTree;
     item->setDNDEnabled( isDNDAllowed && ! _category->isSpecialCategory() \
);  item->setTristate( _mode == InputMultiImageConfigMode );
 }
--- trunk/extragear/graphics/kphotoalbum/AnnotationDialog/ListSelect.h \
#1169002:1169003 @@ -67,7 +67,8 @@
 public slots:
     void slotReturn();
     void slotSortDate();
-    void slotSortAlpha();
+    void slotSortAlphaTree();
+    void slotSortAlphaFlat();
     void toggleSortType();
     void rePopulate();
 
@@ -81,7 +82,8 @@
 protected:
     virtual bool eventFilter( QObject* object, QEvent* event );
     void addItems( DB::CategoryItem* item, Q3ListViewItem* parent );
-    void populateAlphabetically();
+    void populateAlphaTree();
+    void populateAlphaFlat();
     void populateMRU();
     void configureItem( CategoryListView::CheckDropItem* item );
     bool isInputMode() const;
@@ -96,7 +98,8 @@
     QRadioButton* _or;
     QRadioButton* _and;
     UsageMode _mode;
-    QToolButton* _alphaSort;
+    QToolButton* _alphaTreeSort;
+    QToolButton* _alphaFlatSort;
     QToolButton* _dateSort;
     QToolButton* _showSelectedOnly;
 };
--- trunk/extragear/graphics/kphotoalbum/ChangeLog #1169002:1169003
@@ -3,6 +3,10 @@
 	* With the new Thumbnail-View KPA crashes when creating a stack from 2
 	selected images (either via Ctrl-3 or the context menu). Thanks to
 	Andreas Neustifter for reporting and patch.
+	* Added option to sort category items aphabetically on annotation
+	dialog (tree view alphabetical, flat alphabetical and most recently
+	used are the currently supported options). Thanks to Reimar Imhof for
+	the patch.
 
 2010-08-19  Jesper K. Pedersen  <blackie@kdab.com>
 
--- trunk/extragear/graphics/kphotoalbum/Settings/SettingsData.h \
#1169002:1169003 @@ -52,7 +52,7 @@
     using Utilities::StringSet;
 
     enum Position { Bottom, Top, Left, Right, TopLeft, TopRight, \
                BottomLeft, BottomRight };
-    enum ViewSortType { SortLastUse, SortAlpha };
+    enum ViewSortType { SortLastUse, SortAlphaTree, SortAlphaFlat };
     enum TimeStampTrust { Always, Ask, Never};
     enum StandardViewSize { FullSize, NaturalSize, NaturalSizeIfFits };
     enum ThumbnailAspectRatio { Aspect_1_1, Aspect_4_3, Aspect_3_2, \
Aspect_16_9, Aspect_3_4, Aspect_2_3, Aspect_9_16 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic