Commit 2133cab3 authored by Volker Krause's avatar Volker Krause
Browse files

SVN_SILENT prepare for merge

svn path=/trunk/KDE/kdepim/runtime/; revision=1146852
parent cc66deb9
add_subdirectory( qt )
add_subdirectory( kde )
add_subdirectory( akonadi )
/*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Stephen Kelly <stephen@kdab.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
import Qt 4.7
import org.kde 4.5
import org.kde.akonadi 4.5
BreadcrumbNavigationView {
topDelegate : CollectionDelegate {
fullClickArea : true
height : itemHeight
onIndexSelected : {
breadcrumbTopLevel._transitionSelect = -1;
breadcrumbTopLevel.state = "before_select_breadcrumb";
}
}
breadcrumbDelegate : CollectionDelegate {
fullClickArea : true
height : itemHeight
onIndexSelected : {
breadcrumbTopLevel._transitionSelect = row;
breadcrumbTopLevel.state = "before_select_breadcrumb";
}
}
selectedItemDelegate : CollectionDelegate {
height : itemHeight
selectedDelegate : true
}
childItemsDelegate : CollectionDelegate {
id : childDelegateWrapper
height : itemHeight
fullClickArea : true
showChildIndicator : true
onIndexSelected : {
breadcrumbTopLevel._transitionSelect = row;
breadcrumbTopLevel.state = "before_select_child";
}
}
}
if (QT_QTDECLARATIVE_FOUND)
install(FILES
qmldir
collectionview.qml
AkonadiBreadcrumbNavigationView.qml
CollectionDelegate.qml
FavoriteSelector.qml
backgroundtile.png
border_dot.png
currentindicator.png
flapbackground.png
fuzz.png
selected_bottom.png
selected_top.png
sliderbackground.png
transparentplus.png
DESTINATION ${PLUGIN_INSTALL_DIR}/imports/org/kde/akonadi
)
add_subdirectory( tests )
endif (QT_QTDECLARATIVE_FOUND)
/*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Stephen Kelly <stephen@kdab.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
import Qt 4.7
import org.kde 4.5
import org.kde.akonadi 4.5
Item {
id: wrapper
// clip: true
property bool fullClickArea : false
property bool showChildIndicator : false
property bool selectedDelegate : false
signal indexSelected(int row)
width : breadcrumbsView.width
Image {
id : fuzz
source : "fuzz.png"
anchors.horizontalCenter : parent.horizontalCenter
y : parent.height / 2
opacity : (selectedDelegate && hasChildren) ? 1 : 0
}
Image {
anchors.right : parent.right
anchors.rightMargin : 5
anchors.verticalCenter : parent.verticalCenter
opacity : (selectedDelegate && hasChildren) ? 1 : 0
source: "currentindicator.png"
}
Image {
id : lastItemImage
opacity : (selectedDelegate && !hasChildren) ? 1 : 0;
source : "selected_bottom.png"
anchors.horizontalCenter : parent.horizontalCenter
y : parent.height / 2
}
MouseArea {
anchors.fill: parent
onClicked: {
if ( fullClickArea )
indexSelected(model.index);
}
}
Row {
id: topLayout
x: 10; y: 10;
height: collectionIcon.height;
width: parent.width
spacing: 10
Image {
id: collectionIcon
pixmap: KDE.iconToPixmap( model.decoration, height );
width: 48; height: 48
}
Column {
height: collectionIcon.height
width: wrapper.width - collectionIcon.width - 20
spacing: 5
Text {
anchors.fill: parent
text : model.display
//### requires a newer QML version
//wrapMode: "WrapAnywhere" // Needs the anchors.fill to work properly
font.bold: true
}
}
Text {
anchors.bottom : parent.bottom
anchors.right : parent.right
anchors.rightMargin : 15 + parent.spacing
text : model.unreadCount > 0 ? model.unreadCount : ""
color : "blue"
}
}
Image {
width : height
anchors.right : parent.right
anchors.rightMargin : 5
anchors.top : parent.top
anchors.topMargin : 5
opacity : ( showChildIndicator && application.childCollectionHasChildren( model.index ) ) ? 1 : 0
source: "transparentplus.png"
}
}
/*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Stephen Kelly <stephen@kdab.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
import Qt 4.7
import org.qt 4.7 // Qt widget wrappers
import org.kde.pim.mobileui 4.5 as KPIM
Item {
id : _topContext
property alias favoriteName : nameInput.text
signal canceled()
signal finished()
QmlColumnView {
id : columnView
model : favoriteSelectionModel
anchors.top : parent.top
anchors.left : parent.left
anchors.right : parent.right
anchors.topMargin : 30
height : parent.height * .85
}
Row {
anchors.top : columnView.bottom
anchors.bottom : parent.bottom
// anchors.right : parent.right
width: parent.width
KPIM.Button {
anchors.left : parent.parent.left
y : 10
height : parent.height
width : 50
buttonText : "Cancel"
onClicked : { canceled(); }
}
Text {
anchors.right : doneButton.left
height : 30
y : 13
width : 50
text : "Name"
}
Rectangle {
id: nameRect
anchors.right : doneButton.left
height : 20
y : 10
width : 200
radius : 5
TextInput {
id : nameInput
anchors.fill : parent
}
}
KPIM.Button {
id: doneButton
anchors.right : parent.right
y : 10
height : parent.height
width : 50
buttonText : "Done"
onClicked : { finished(); }
}
}
}
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
import Qt 4.7
import org.kde 4.5
/** Akonadi Collection List View
@param model: The collection model to display, ETM-based, filtered to only contain a flat collection list.
@param currentIndex: Index of the currently selected row.
*/
Item {
id: collectionListViewTopLevel
property alias model: collectionListView.model
property alias currentIndex: collectionListView.currentIndex
signal collectionSelected
SystemPalette { id: palette; colorGroup: "Active" }
Component {
id: collectionViewDelegate
Item {
id: wrapper
width: collectionListView.width
height : 68
Rectangle {
id: background
opacity: 0.25
x: 1; y: 2; width: parent.width - 2; height: parent.height - 4
border.color: palette.mid
radius: 5
}
MouseArea {
anchors.fill: parent
onClicked: {
wrapper.ListView.view.currentIndex = model.index;
collectionListViewTopLevel.collectionSelected()
}
}
Row {
id: topLayout
x: 10; y: 10;
height: collectionIcon.height;
width: parent.width
spacing: 10
Image {
id: collectionIcon
pixmap: KDE.iconToPixmap( model.decoration, height );
width: 48; height: 48
}
Column {
height: collectionIcon.height
width: background.width - collectionIcon.width - 20
spacing: 5
Text {
text : model.display
font.bold: true
}
}
}
}
}
Component {
id: highlight
Rectangle {
color: palette.highlight
radius: 5
}
}
ListView
{
id: collectionListView
anchors.fill: parent
delegate : collectionViewDelegate
highlight: highlight
highlightFollowsCurrentItem: true
focus: true
clip: true
}
}
CollectionView 4.5 collectionview.qml
CollectionDelegate 4.5 CollectionDelegate.qml
AkonadiBreadcrumbNavigationView 4.5 AkonadiBreadcrumbNavigationView.qml
FavoriteSelector 4.5 FavoriteSelector.qml
set(akonadi_qml_test_srcs
qmltest.cpp
)
kde4_add_executable(akonadi_qml_test ${akonadi_qml_test_srcs} )
target_link_libraries(akonadi_qml_test
${QT_QTDECLARATIVE_LIBRARY}
${KDEPIMLIBS_AKONADI_LIBS}
)
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
import Qt 4.7
import org.kde 4.5
import org.kde.akonadi 4.5
Rectangle {
color: white
height: 480
width: 800
CollectionView {
id: listView
anchors.fill: parent
model: collectionModel
}
Binding {
target: application
property: "collectionRow"
value: listView.currentIndex
}
}
/*
* This file is part of Akonadi
*
* Copyright 2010 Stephen Kelly <steveire@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301  USA
*/
#include <akonadi/changerecorder.h>
#include <akonadi/entitytreeview.h>
#include <Akonadi/ItemFetchScope>
#include <akonadi/entitymimetypefiltermodel.h>
#include <kdebug.h>
#include <kselectionproxymodel.h>
#include <KStandardDirs>
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
// #include <kdescendantsproxymodel.h>
#include <QBoxLayout>
#include <QSplitter>
#include <QListView>
#include <QTreeView>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeComponent>
#include <QtDeclarative/QDeclarativeView>
class QmlTestWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY( int collectionRow READ selectedCollectionRow WRITE collectionRowSelected )
public:
QmlTestWidget( QWidget *parent = 0 );
public:
int selectedCollectionRow() const { return 0; }
void collectionRowSelected( int row );
};
QmlTestWidget::QmlTestWidget(QWidget* parent)
: QWidget(parent)
{
QHBoxLayout *mainLayout = new QHBoxLayout( this );
Akonadi::ChangeRecorder *changeRecorder = new Akonadi::ChangeRecorder();
changeRecorder->setCollectionMonitored( Akonadi::Collection::root() );
Akonadi::EntityTreeModel *etm = new Akonadi::EntityTreeModel( changeRecorder );
Akonadi::EntityMimeTypeFilterModel *collectionFilter = new Akonadi::EntityMimeTypeFilterModel();
collectionFilter->setHeaderGroup( Akonadi::EntityTreeModel::CollectionTreeHeaders );
collectionFilter->setSourceModel( etm );
collectionFilter->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() );
#if 0
KDescendantsProxyModel *flatProxy = new KDescendantsProxyModel( this );
flatProxy->setSourceModel( collectionFilter );
flatProxy->setAncestorSeparator( QLatin1String(" / ") );
flatProxy->setDisplayAncestorData( true );
#endif
QDeclarativeView *view = new QDeclarativeView( this );
mainLayout->addWidget( view );
view->engine()->rootContext()->setContextProperty( "collectionModel", QVariant::fromValue( static_cast<QObject*>( collectionFilter ) ) );
view->engine()->rootContext()->setContextProperty( "application", QVariant::fromValue( static_cast<QObject*>( this ) ) );
view->setSource( QUrl( QLatin1String("collectionviewtest.qml") ) ); // TODO make this a command line argument so this test can be used for other qml components as well
}
void QmlTestWidget::collectionRowSelected(int row)
{
kDebug() << row;
}
int main( int argc, char **argv )
{
const QByteArray& ba = QByteArray( "akonadi_qml" );
const KLocalizedString name = ki18n( "Akonadi QML Test" );
KAboutData aboutData( ba, ba, name, ba, name );
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app;
QmlTestWidget testWidget;
testWidget.show();
return app.exec();
}
#include "qmltest.moc"
/*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Stephen Kelly <stephen@kdab.com>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
import Qt 4.7
Item {