[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/pim/mailody/src
From: Tom Albers <toma () kde ! org>
Date: 2009-11-16 18:09:31
Message-ID: 1258394971.031222.30906.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1050129 by toma:
Add support to Mailody for selecting Images from Image resources as attachments.
CCMAIL: lure@kubuntu.org
M +1 -0 CMakeLists.txt
M +44 -1 composer.cpp
M +1 -0 composer.h
A imagemodel.cpp [License: UNKNOWN]
A imagemodel.h [License: UNKNOWN]
--- trunk/extragear/pim/mailody/src/CMakeLists.txt #1050128:1050129
@@ -54,6 +54,7 @@
ip2geohostip.cpp
ip2geoipinfodb.cpp
contacttreemodel.cpp
+ imagemodel.cpp
)
--- trunk/extragear/pim/mailody/src/composer.cpp #1050128:1050129
@@ -23,6 +23,7 @@
#include "contacttreemodel.h"
#include "contacttooltipproxymodel.h"
#include "global.h"
+#include "imagemodel.h"
#include "sendmessage.h"
#include "recentmodel.h"
#include "recentmanager.h"
@@ -34,6 +35,7 @@
#include <QLabel>
#include <QMenu>
#include <QSplitter>
+#include <QToolBox>
#include <QToolButton>
// KDEPIM
@@ -45,6 +47,8 @@
#include <akonadi/changerecorder.h>
#include <akonadi/contact/contacteditordialog.h>
#include <akonadi/contact/contactgroupexpandjob.h>
+#include <akonadi/entitytreemodel.h>
+#include <akonadi/entitytreeview.h>
#include <akonadi/itemcreatejob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/itemdeletejob.h>
@@ -131,8 +135,40 @@
SIGNAL( doubleClicked( const QModelIndex& ) ),
SLOT( slotAddFile( const QModelIndex& ) ) );
+ // images.
+ QSplitter *splitter = new QSplitter( Qt::Vertical, this );
+
+ Session *session = new Session( QByteArray( "ImageViewAplication-" ) + \
QByteArray::number( qrand() ), this ); +
+ ChangeRecorder *changeRecorder = new ChangeRecorder( this );
+ changeRecorder->setItemFetchScope( scope );
+ changeRecorder->setCollectionMonitored( Collection::root() );
+ changeRecorder->setMimeTypeMonitored( "application/x-vnd.kde.image", true );
+
+ EntityTreeModel *model = new EntityTreeModel( session, changeRecorder, this );
+ model->setItemPopulationStrategy( EntityTreeModel::NoItemPopulation );
+
+ EntityTreeView *lv = new EntityTreeView( splitter );
+ lv->setModel( model );
+
+ ImageModel* im = new ImageModel( this );
+ im->setFetchScope( scope );
+
+ QListView* lv2 = new QListView( splitter );
+ lv2->setViewMode( QListView::IconMode );
+ lv2->setModel( im );
+ connect( lv2, SIGNAL( clicked( const QModelIndex& ) ),
+ SLOT( slotImageClicked( const QModelIndex& ) ) );
+
+ connect( lv, SIGNAL( currentChanged( const Akonadi::Collection& ) ),
+ im, SLOT( setCollection( const Akonadi::Collection& ) ) );
+
+ QToolBox* toolbox = new QToolBox( this );
+ toolbox->addItem( splitter, i18n("Images") );
+ toolbox->addItem( m_filebrowser, i18n("Files") );
+
QDockWidget* attachDock = new QDockWidget( i18n( "At&tach File" ), this );
- attachDock->setWidget( m_filebrowser );
+ attachDock->setWidget( toolbox );
attachDock->setObjectName( "attachDock" );
attachDock->setFeatures( QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetClosable );
@@ -643,6 +679,13 @@
addAttachment( file.url() );
}
+void Composer::slotImageClicked( const QModelIndex& index )
+{
+ const ImageModel* model = static_cast<const ImageModel*>( index.model() );
+ QString filename = model->itemForIndex( index ).remoteId();
+ slotAddFile( filename );
+}
+
void Composer::slotAddFile( const KUrl& file )
{
setDirty( true );
--- trunk/extragear/pim/mailody/src/composer.h #1050128:1050129
@@ -204,6 +204,7 @@
void slotStatusBarClicked( int item );
void slotAddFile( const QModelIndex & index );
+ void slotImageClicked( const QModelIndex& index );
void slotAddFile( const KUrl& );
void slotHTMLMode( bool );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic