From 2d34a0f7cc4a7302871c942a827bd4278cdde10b Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 10 Jun 2009 09:53:50 +0300 Subject: Implemented content filters for desktopservices example. Now only the relevant files are shown under images and music tabs, even the folder would contain other content types. --- demos/embedded/desktopservices/contenttab.cpp | 6 +++++- demos/embedded/desktopservices/contenttab.h | 1 + demos/embedded/desktopservices/desktopwidget.cpp | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/demos/embedded/desktopservices/contenttab.cpp b/demos/embedded/desktopservices/contenttab.cpp index 12e80f6..450a080 100644 --- a/demos/embedded/desktopservices/contenttab.cpp +++ b/demos/embedded/desktopservices/contenttab.cpp @@ -66,9 +66,13 @@ ContentTab::~ContentTab() // NEW PUBLIC METHODS void ContentTab::init(const QDesktopServices::StandardLocation &location, + const QString &filter, const QString &icon) { setContentDir(location); + QStringList filterList; + filterList = filter.split(";"); + m_ContentDir.setNameFilters(filterList); setIcon(icon); connect(this, SIGNAL(itemClicked(QListWidgetItem *)), @@ -90,7 +94,7 @@ void ContentTab::setIcon(const QString &icon) void ContentTab::populateListWidget() { - QFileInfoList fileList = m_ContentDir.entryInfoList(QStringList(), QDir::Files, QDir::Time); + QFileInfoList fileList = m_ContentDir.entryInfoList(QDir::Files, QDir::Time); foreach(QFileInfo item, fileList) { new QListWidgetItem(m_Icon, itemName(item), this); } diff --git a/demos/embedded/desktopservices/contenttab.h b/demos/embedded/desktopservices/contenttab.h index af1b7bb..a5a402e 100644 --- a/demos/embedded/desktopservices/contenttab.h +++ b/demos/embedded/desktopservices/contenttab.h @@ -74,6 +74,7 @@ public: // Constructors & Destructors public: // New Methods virtual void init(const QDesktopServices::StandardLocation &location, + const QString &filter, const QString &icon); protected: // New Methods diff --git a/demos/embedded/desktopservices/desktopwidget.cpp b/demos/embedded/desktopservices/desktopwidget.cpp index e8a654e..3abe591 100644 --- a/demos/embedded/desktopservices/desktopwidget.cpp +++ b/demos/embedded/desktopservices/desktopwidget.cpp @@ -59,18 +59,22 @@ DesktopWidget::DesktopWidget(QWidget *parent) : QWidget(parent) // Images ContentTab* imageTab = new ContentTab(tabWidget); - imageTab->init(QDesktopServices::PicturesLocation, ":/resources/photo.png"); + imageTab->init(QDesktopServices::PicturesLocation, + "*.png;*.jpg;*.jpeg;*.bmp;*.gif", + ":/resources/photo.png"); tabWidget->addTab(imageTab, tr("Images")); // Music ContentTab* musicTab = new ContentTab(tabWidget); - musicTab->init(QDesktopServices::MusicLocation, ":/resources/music.png"); + musicTab->init(QDesktopServices::MusicLocation, + "*.wav;*.mp3;*.mp4", + ":/resources/music.png"); tabWidget->addTab(musicTab, tr("Music")); // Links LinkTab* othersTab = new LinkTab(tabWidget);; // Given icon file will be overriden by LinkTab - othersTab->init(QDesktopServices::PicturesLocation, ""); + othersTab->init(QDesktopServices::PicturesLocation, "", ""); tabWidget->addTab(othersTab, tr("Links")); // Layout -- cgit v0.12 From de32770849417fbca964f52eb4d16e7913b28ea1 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 10 Jun 2009 11:54:36 +0300 Subject: Switched QDesktopServices mail-to URL handling to RSendAs in Symbian. Earlier used CSendUi required extensiva capabilities to work correctly, that's why "new email" option in desktop services example application did not work correctly with self signed capabilities. RSendAs requires lower capabilities since SendAs server (separate process) takes care of necessary actions to send the message. --- mkspecs/common/symbian/symbian.conf | 2 +- src/gui/util/qdesktopservices_s60.cpp | 54 +++++++++++++++-------------------- src/gui/util/util.pri | 5 ---- 3 files changed, 24 insertions(+), 37 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 5a61a23..6ae4c4a 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -62,7 +62,7 @@ QMAKE_LFLAGS_DLL = -shared QMAKE_LINK_OBJECT_MAX = 10 QMAKE_LINK_OBJECT_SCRIPT= object_script -QMAKE_DESKTOPSERVICES_LIBS = -lsendui -lplatformenv -lcommonui -letext -lapmime +QMAKE_DESKTOPSERVICES_LIBS = -lsendas2 -lplatformenv -lcommonui -letext -lapmime QMAKE_STATUSPANE_LIBS = -lavkon -leikcoctl QMAKE_LIBS = -llibc -llibm -leuser -llibdl diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index a30e2ed..d53c046 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -54,8 +54,8 @@ #include // CEikonEnv #include // RApaLsSession #include // TApaTaskList, TApaTask -#include // CSendUi -#include // CMessageData +#include // RSendAs +#include // RSendAsMessage #include // PathInfo #ifdef USE_DOCUMENTHANDLER #include // CDocumentHandler @@ -85,52 +85,44 @@ static void handleMailtoSchemeL(const QUrl &url) QStringList bccs = bcc.split(","); - CSendUi* sendUi = CSendUi::NewLC(); + RSendAs sendAs; + User::LeaveIfError(sendAs.Connect()); + CleanupClosePushL(sendAs); + + RSendAsMessage sendAsMessage; + sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP); + CleanupClosePushL(sendAsMessage); - // Construct symbian sendUI data holder - CMessageData* messageData = CMessageData::NewLC(); // Subject - TPtrC subj( qt_QString2TPtrC(subject) ); - messageData->SetSubjectL( &subj ); + sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject)); // Body - CParaFormatLayer* paraFormat = CParaFormatLayer::NewL(); - CleanupStack::PushL( paraFormat ); - CCharFormatLayer* charFormat = CCharFormatLayer::NewL(); - CleanupStack::PushL( charFormat ); - CRichText* bodyRichText = CRichText::NewL( paraFormat, charFormat ); - CleanupStack::PushL( bodyRichText ); - - TPtrC bodyPtr( qt_QString2TPtrC(body) ); - if( bodyPtr.Length() ) - { - bodyRichText->InsertL( 0, bodyPtr ); - } - else - { - bodyRichText->InsertL( 0, KNullDesC ); - } - - messageData->SetBodyTextL( bodyRichText ); + sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body)); // To foreach(QString item, recipients) - messageData->AppendToAddressL(qt_QString2TPtrC(item)); + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); foreach(QString item, tos) - messageData->AppendToAddressL(qt_QString2TPtrC(item)); + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); // Cc foreach(QString item, ccs) - messageData->AppendCcAddressL(qt_QString2TPtrC(item)); + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc ); // Bcc foreach(QString item, bccs) - messageData->AppendBccAddressL(qt_QString2TPtrC(item)); + sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc ); + + // send the message + sendAsMessage.LaunchEditorAndCloseL(); + + // sendAsMessage (already closed) + CleanupStack::Pop(); - sendUi->CreateAndSendMessageL( KUidMsgTypeSMTP, messageData ); - CleanupStack::PopAndDestroy( 5 ); // bodyRichText, charFormat, paraFormat, messageData, sendUi + // sendAs + CleanupStack::PopAndDestroy(); } static bool handleMailtoScheme(const QUrl &url) diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index 69c53ae..e628229 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -35,11 +35,6 @@ embedded { util/qsystemtrayicon_qws.cpp } -symbian { - # QDesktopServices uses CSendUi which is located on app layer - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -} - !embedded:!x11:mac { OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm } -- cgit v0.12 From 00f2dd2175f80736442a3eb8443499c02062b3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 10 Jun 2009 12:22:36 +0300 Subject: S60Style: Fix scrollbar error, when scrollbar PM minimum length is less than its width on horizontal scrollbar (and height on vertical scrollbar). --- src/gui/styles/qs60style.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 180937f..6ee63e6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2342,6 +2342,11 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple sliderlen = (qint64(scrollbarOption->pageStep) * maxlen) / (range + scrollbarOption->pageStep); int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbarOption, widget); + if (isHorizontal && slidermin < scrollBarRect.height()) + slidermin = scrollBarRect.height(); + else if (!isHorizontal && slidermin < scrollBarRect.width()) + slidermin = scrollBarRect.width(); + if (sliderlen < slidermin || range > (INT_MAX>>1)) sliderlen = slidermin; if (sliderlen > maxlen) -- cgit v0.12