[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/mobile/lib
From: Tobias Koenig <tokoe () kde ! org>
Date: 2010-12-08 10:44:30
Message-ID: 20101208104430.C09D1AC8A5 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1204593 by tokoe:
Second step of refactoring:
- Add FavoritesEditor which encapsulates mobile specific handling
- Add ActionButtom.qml, a generic QAction bound button
- Make ReorderList/Container generic and reusable
A ActionButton.qml [License: LGPL (v2+)]
M +2 -0 CMakeLists.txt
M +15 -6 FavoriteManager.qml
M +1 -9 ItemEditButton.qml
M +17 -4 ReorderList.qml
M +7 -24 ReorderListContainer.qml
A favoriteseditor.cpp [License: LGPL (v2+)]
A favoriteseditor.h [License: LGPL (v2+)]
M +6 -5 kdeclarativemainview.cpp
M +1 -1 kdeclarativemainview_p.cpp
M +2 -2 kdeclarativemainview_p.h
M +1 -0 qmldir
--- trunk/KDE/kdepim/mobile/lib/CMakeLists.txt #1204592:1204593
@@ -15,6 +15,7 @@
declarativewidgetbase.cpp
declarativeakonadiitem.cpp
exporthandlerbase.cpp
+ favoriteseditor.cpp
favoritescontroller.cpp
favoriteslistmodel.cpp
guistatemanager.cpp
@@ -77,6 +78,7 @@
install(FILES
qmldir
Action.qml
+ ActionButton.qml
ActiveActionMenuItemDelegate.qml
BulkActionScreen.qml
BulkActionList.qml
--- trunk/KDE/kdepim/mobile/lib/FavoriteManager.qml #1204592:1204593
@@ -29,11 +29,20 @@
name : "favorites_list"
text : KDE.i18n( "Favorites" )
- onVisibleChanged :
- {
- if (!visible)
- height = -actionItemSpacing
- else
- height = actionItemHeight
+ ActionButton {
+ icon : "images/moveup.png"
+ actionName : "favoriteseditor_moveup"
}
+
+ ActionButton {
+ icon : "images/movedown.png"
+ actionName : "favoriteseditor_movedown"
}
+
+ ActionButton {
+ icon : KDE.locate( "data", "mobileui/delete-button.png" )
+ actionName : "favoriteseditor_remove"
+ }
+
+ onCurrentIndexChanged : { favoritesEditor.setRowSelected( index ) }
+}
--- trunk/KDE/kdepim/mobile/lib/ItemEditButton.qml #1204592:1204593
@@ -20,14 +20,6 @@
import Qt 4.7 as QML
import org.kde.pim.mobileui 4.5 as KPIM
-KPIM.Button {
- property variant action
- property string actionName
-
- id: itemEditButton
- width: 70
- height: 70
+KPIM.ActionButton {
icon: KDE.locate( "data", "mobileui/edit-button.png" );
- action: application.getAction( actionName, "" )
- enabled: action.enabled
}
--- trunk/KDE/kdepim/mobile/lib/ReorderList.qml #1204592:1204593
@@ -26,8 +26,6 @@
QML.Item {
id : reorderList_top
width : parent.width
- //property alias listElementContent : _listElementContent.data
- //property alias listContent : _listContent.data
property string category
@@ -42,10 +40,21 @@
property alias actionItemWidth : _listContent.actionItemWidth
property alias model : _listContent.model
+ property alias showChildren : _listContent.visible
- property alias showChildren : _listContent.visible
+ default property alias content : _listContent.content
+
signal triggered(string triggeredName)
+ signal currentIndexChanged( int index )
+ onVisibleChanged :
+ {
+ if (!visible)
+ height = -actionItemSpacing
+ else
+ height = actionItemHeight
+ }
+
KPIM.Button {
id : nameItem
height : parent.height
@@ -67,7 +76,11 @@
visible : false
onTriggered : {
- actionList_top.triggered(triggeredName)
+ reorderList_top.triggered( triggeredName )
}
+
+ onCurrentIndexChanged : {
+ reorderList_top.currentIndexChanged( index )
}
}
+}
--- trunk/KDE/kdepim/mobile/lib/ReorderListContainer.qml #1204592:1204593
@@ -35,7 +35,10 @@
property alias model : myList.model
property alias delegate : myList.delegate
+ default property alias content : actionColumn.children
+
signal triggered(string triggeredName)
+ signal currentIndexChanged( int index )
KPIM.DecoratedListView {
id : myList
@@ -49,7 +52,11 @@
height: _root.actionItemHeight
width: ListView.view.width;
}
+
+ onCurrentIndexChanged : {
+ _topLevel.currentIndexChanged( currentIndex )
}
+ }
Column {
id : actionColumn
@@ -57,29 +64,5 @@
anchors.bottom : parent.bottom
anchors.right : parent.right
width : 100
- Image { source : "images/moveup.png"
- MouseArea {
- anchors.fill : parent
- onClicked : {
- favoritesList.moveUp(myList.currentIndex);
}
}
- }
- Image { source : "images/movedown.png"
- MouseArea {
- anchors.fill : parent
- onClicked : {
- favoritesList.moveDown(myList.currentIndex);
- }
- }
- }
- Image { source : KDE.locate( "data", "mobileui/delete-button.png" );
- MouseArea {
- anchors.fill : parent
- onClicked : {
- favoritesList.removeItem(myList.currentIndex);
- }
- }
- }
- }
-}
--- trunk/KDE/kdepim/mobile/lib/kdeclarativemainview.cpp #1204592:1204593
@@ -219,10 +219,11 @@
connect( d->mGuiStateManager, SIGNAL( guiStateChanged( int, int ) ), d, SLOT( \
guiStateChanged( int, int ) ) );
// A list of available favorites
- d->mFavoritesController = new FavoritesController( KGlobal::config(), this );
- d->mFavoritesController->setCollectionSelectionModel( d->mBnf->selectionModel() );
+ d->mFavoritesEditor = new FavoritesEditor( actionCollection(), KGlobal::config(), \
this ); + d->mFavoritesEditor->setCollectionSelectionModel( \
d->mBnf->selectionModel() );
- context->setContextProperty( "favoritesList", d->mFavoritesController->model() );
+ context->setContextProperty( "favoritesEditor", d->mFavoritesEditor );
+ context->setContextProperty( "favoritesList", d->mFavoritesEditor->model() );
// A list of agent instances
Akonadi::AgentInstanceModel *agentInstanceModel = new Akonadi::AgentInstanceModel( \
this ); @@ -542,12 +543,12 @@
if ( !ok || name.isEmpty() )
return;
- d->mFavoritesController->saveFavorite( name );
+ d->mFavoritesEditor->saveFavorite( name );
}
void KDeclarativeMainView::loadFavorite( const QString &name )
{
- d->mFavoritesController->loadFavorite( name );
+ d->mFavoritesEditor->loadFavorite( name );
}
void KDeclarativeMainView::multipleSelectionFinished()
--- trunk/KDE/kdepim/mobile/lib/kdeclarativemainview_p.cpp #1204592:1204593
@@ -35,7 +35,7 @@
, mAgentStatusMonitor( 0 )
, mGuiStateManager( 0 )
, mStateMachine( 0 )
- , mFavoritesController( 0 )
+ , mFavoritesEditor( 0 )
{ }
void KDeclarativeMainViewPrivate::restoreState()
--- trunk/KDE/kdepim/mobile/lib/kdeclarativemainview_p.h #1204592:1204593
@@ -22,7 +22,7 @@
#include "kdeclarativemainview.h"
#include "akonadibreadcrumbnavigationfactory.h"
-#include "favoritescontroller.h"
+#include "favoriteseditor.h"
#include "searchmanager.h"
#include "statemachinebuilder.h"
@@ -67,7 +67,7 @@
GuiStateManager *mGuiStateManager;
NotifyingStateMachine *mStateMachine;
SearchManager *mSearchManager;
- FavoritesController *mFavoritesController;
+ FavoritesEditor *mFavoritesEditor;
public: /// Methods
KDeclarativeMainViewPrivate( KDeclarativeMainView* );
--- trunk/KDE/kdepim/mobile/lib/qmldir #1204592:1204593
@@ -39,6 +39,7 @@
ClockDialog 4.5 ClockDialog.qml
SearchDialog 4.5 SearchDialog.qml
SearchResultScreen 4.5 SearchResultScreen.qml
+ActionButton 4.5 ActionButton.qml
ItemEditButton 4.5 ItemEditButton.qml
DecoratedFlickable 4.5 DecoratedFlickable.qml
DecoratedListView 4.5 DecoratedListView.qml
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic