# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282113468 -10800 # Node ID f8e7eccf5f96ff33f84715c41bf64f940f552b15 # Parent db1bf15cefffa0f638fdbfbc520a014efb7662a8 Revision: 201031 Kit: 201033 diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/calendarwidgetplugin.pro --- a/calendarwidgetplugin/calendarwidgetplugin.pro Tue Jul 06 11:55:49 2010 +0300 +++ b/calendarwidgetplugin/calendarwidgetplugin.pro Wed Aug 18 09:37:48 2010 +0300 @@ -48,6 +48,7 @@ LIBS += -lagendainterface LIBS += -lxqservice + LIBS += -lxqserviceutil LIBS += -lxqsettingsmanager LIBS += -lbafl diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/inc/calendarwidget.h --- a/calendarwidgetplugin/inc/calendarwidget.h Tue Jul 06 11:55:49 2010 +0300 +++ b/calendarwidgetplugin/inc/calendarwidget.h Wed Aug 18 09:37:48 2010 +0300 @@ -211,9 +211,13 @@ private: // data Q_DISABLE_COPY(CalendarWidget) QTranslator* mCommonTranslator; + bool mWidgetLoaded; //For documentation purpose ContentLayoutHandler* mContent; + //to get the widget shape + HbLabel* mWidgetBackground; + HbLabel* mIconLabel; }; #endif // CALENDARWIDGET_H diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/inc/contentlayouthandler.h --- a/calendarwidgetplugin/inc/contentlayouthandler.h Tue Jul 06 11:55:49 2010 +0300 +++ b/calendarwidgetplugin/inc/contentlayouthandler.h Wed Aug 18 09:37:48 2010 +0300 @@ -64,7 +64,6 @@ { Q_OBJECT Q_PROPERTY(int testID READ testId WRITE setTestId) - Q_PROPERTY(int testResult READ testResult WRITE setTestResult) public: /*! @@ -94,18 +93,6 @@ Used to set which test it needs to run. */ void setTestId(int testID); - /*! - \fn int ContentLayoutHandler::testResult() - - Used to check whether the calendar has been launched correctly or not. - */ - int testResult(); - /*! - \fn void ContentLayoutHandler::setTestResult(int testResult) - - Used to set the test property. - */ - void setTestResult(int testResult); signals: /*! @@ -135,6 +122,11 @@ Emitted when the date has changed. */ void dateChanged(); + + //test signals + void calendarChanged(); + void timerExpired(); + void themeChanged(); public slots: /*! @@ -176,21 +168,6 @@ */ void onThemeChange(); /*! - \fn void ContentLayoutHandler::handleOk(const QVariant& var) - - Connected to XQSettingsManager valueChanged signal. Called if the calendar has been launched correctly. - @param var operation returning value - */ - void handleOk(const QVariant& var); - /*! - \fn void ContentLayoutHandler::handleError(int err, const QString& str) - - Connected to XQSettingsManager valueChanged signal. Called if the calendar has not been launched correctly. - @param err Error code - @param str Explanation of the error - */ - void handleError(int err, const QString& str); - /*! \fn void ContentLayoutHandler::highlightOn(QPointF& point) Highlights the layout, if the point is inside the correct area. diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/inc/dateiconlayouthandler.h --- a/calendarwidgetplugin/inc/dateiconlayouthandler.h Tue Jul 06 11:55:49 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Calendar widget's date icon layout handler -* -*/ - -#ifndef DATEICONLAYOUTHANDLER_H -#define DATEICONLAYOUTHANDLER_H - -// System includes -#include - -// Forward declarations -class HbLabel; -class HbFrameDrawer; -class HbWidget; -class QTimer; -class QPointF; -class XQServiceRequest; -class DateTimeObserver; -class TestDateIconLayoutHandler; -class HbDocumentLoader; - -// Class declaration -class DateIconLayoutHandler: public QObject -{ - Q_OBJECT - Q_PROPERTY(int testID READ testId WRITE setTestId) - Q_PROPERTY(int testResult READ testResult WRITE setTestResult) - -public: - DateIconLayoutHandler(); - ~DateIconLayoutHandler(); - - //Test property functions - int testId(); - void setTestId(int testID); - int testResult(); - void setTestResult(int testResult); - -signals: - void dateChanged(); - void requestComplete(); - void requestError(); - -public slots: - void initializeLayout(const HbDocumentLoader &layoutLoader, QObject *owner); - void updateLayout(); - void onTap(QPointF &point); //TODO: change this with onGesture at some point - void onThemeChange(); - void handleOk(const QVariant& var); - void handleError(int err, const QString& str); - -private: - void setCalendarIconContent(); - void launchCalendarMonthView(); - void setLabelsColor(); - -private: // data - Q_DISABLE_COPY(DateIconLayoutHandler) - - HbWidget* mWidget; - - // Labels (not owned) - HbLabel* mNumberLabel; - HbLabel* mMonthLabel; - - // Background drawer (not owned) - HbFrameDrawer* mFrameDrawer; - - // Owned - DateTimeObserver* mDateObserver; - - // Test variables - int mTestID; - int mTestResult; - - friend class TestDateIconLayoutHandler; -}; - -#endif // DATEICONLAYOUTHANDLER_H diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/inc/mainlayouthandler.h --- a/calendarwidgetplugin/inc/mainlayouthandler.h Tue Jul 06 11:55:49 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Calendar widget's date icon layout handler -* -*/ - -#ifndef MAINLAYOUTHANDLER_H_ -#define MAINLAYOUTHANDLER_H_ - -// System includes -#include -#include - -class HbDocumentLoader; -class HbLabel; -class HbWidget; -class HbFrameItem; - -class MainLayoutHandler : public QObject, public QGraphicsLinearLayout -{ - Q_OBJECT - -public: - MainLayoutHandler(); - ~MainLayoutHandler(); - -public slots: - void initializeLayout(const HbDocumentLoader &layoutLoader, QObject *owner); - void updateLayout(); - void onThemeChange(); - -private: - HbWidget* mWidget; - - //separator - HbLabel* mSeparatorLabel; - - //to paint icon and widget background - HbFrameItem* mIconLayoutItem; - HbFrameItem* mBackgroundLayoutItem; - HbFrameItem* mSeparatorLayoutItem; - -}; - -#endif // MAINLAYOUTHANDLER_H_ diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/src/calendarwidget.cpp --- a/calendarwidgetplugin/src/calendarwidget.cpp Tue Jul 06 11:55:49 2010 +0300 +++ b/calendarwidgetplugin/src/calendarwidget.cpp Wed Aug 18 09:37:48 2010 +0300 @@ -49,6 +49,11 @@ #define CALWIDGET_HIGHLIGHT_ACTIVE +namespace { + const char *WIDGET_BACKGROUND = "widgetBackground"; + const char *ICON_LABEL = "iconLabel"; +} + // ======== MEMBER FUNCTIONS ======== /* @@ -62,6 +67,7 @@ grabGesture(Qt::PanGesture); grabGesture(Qt::PinchGesture); grabGesture(Qt::SwipeGesture); + mWidgetLoaded = false; } /* @@ -77,7 +83,6 @@ */ QRectF CalendarWidget::boundingRect() const { - LOGS("CalendarWidget::boundingRect"); return childrenBoundingRect(); } @@ -86,10 +91,21 @@ */ QPainterPath CalendarWidget::shape() const { - LOGS("CalendarWidget::shape"); - QPainterPath path; - path.addRect(boundingRect()); + if( !mWidgetLoaded ) { + path.addRect(boundingRect()); + } + else { + QRectF layoutRect( QPointF( mWidgetBackground->rect().topLeft().x() + mWidgetBackground->pos().x(), mWidgetBackground->rect().topLeft().y() + mWidgetBackground->pos().y() ), + QPointF( mWidgetBackground->rect().bottomRight().x() + mWidgetBackground->pos().x(), mWidgetBackground->rect().bottomRight().y() + mWidgetBackground->pos().y() )); + path.addRoundRect( layoutRect, 15 ); + //the icon path is adjusted because the icon is slightly smaller than the container + path.moveTo( QPointF( mIconLabel->pos().x() + 3, mWidgetBackground->pos().y() ) ); + path.lineTo( QPointF( mIconLabel->pos().x() + 3, mIconLabel->pos().y() + 8 ) ); + path.lineTo( QPointF( mIconLabel->rect().topRight().x() + mIconLabel->pos().x() - 3, mIconLabel->pos().y() + 8 ) ); + path.lineTo( QPointF( mIconLabel->rect().bottomRight().x() + mIconLabel->pos().x() - 3, mWidgetBackground->pos().y() ) ); + } + return path; } @@ -102,11 +118,15 @@ // Use document loader to load the contents HbDocumentLoader loader; - bool loaded = true; + mWidgetLoaded = true; bool ok = false; loader.load(DOCML, &ok); if (ok) { + //load the containers that are necessary to get the shape + mWidgetBackground = qobject_cast( loader.findWidget( WIDGET_BACKGROUND ) ); + mIconLabel = qobject_cast( loader.findWidget( ICON_LABEL ) ); + QObject* contentLayoutHandler = new ContentLayoutHandler(); connectLayoutHandler(this, contentLayoutHandler, loader); @@ -136,14 +156,14 @@ setLayout(dynamic_cast(contentLayoutHandler)); } else { - loaded = false; + mWidgetLoaded = false; } } else { - loaded = false; + mWidgetLoaded = false; } - return loaded; + return mWidgetLoaded; } /* @@ -299,7 +319,7 @@ // emit mousePressed(pos); } else if (event->type() == QEvent::GraphicsSceneMouseRelease) { -// emit mouseReleased(); + emit mouseReleased(); } return false; } @@ -311,18 +331,17 @@ { LOGS("CalendarWidget::gestureEvent"); if (QTapGesture *tap = (QTapGesture*)event->gesture(Qt::TapGesture)) { - //QPointF pos = mapFromScene(event->mapToGraphicsScene(tap->position())); - QPointF pos = tap->position(); + QPointF posFromScene = mapFromScene(event->mapToGraphicsScene(tap->position())); switch(tap->state()) { case Qt::GestureStarted: - emit mousePressed(pos); + emit mousePressed(posFromScene); LOGS("CalendarWidget::gestureEvent => gestureStarted"); break; case Qt::GestureUpdated: LOGS("CalendarWidget::gestureEvent => gestureUpdated"); break; case Qt::GestureFinished: - emit tapGesture(pos); + emit tapGesture(posFromScene); emit mouseReleased(); LOGS("CalendarWidget::gestureEvent => gestureFinished"); break; @@ -344,8 +363,8 @@ } } - if (QSwipeGesture *pan = (QSwipeGesture*)event->gesture(Qt::SwipeGesture)) { - switch (pan->state()) { + if (QSwipeGesture *swipe = (QSwipeGesture*)event->gesture(Qt::SwipeGesture)) { + switch (swipe->state()) { case Qt::GestureFinished: emit mouseReleased(); break; @@ -354,8 +373,8 @@ } } - if (QPinchGesture *pan = (QPinchGesture*)event->gesture(Qt::PinchGesture)) { - switch (pan->state()) { + if (QPinchGesture *pinch = (QPinchGesture*)event->gesture(Qt::PinchGesture)) { + switch (pinch->state()) { case Qt::GestureFinished: emit mouseReleased(); break; diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/src/contentlayoutgesture.cpp --- a/calendarwidgetplugin/src/contentlayoutgesture.cpp Tue Jul 06 11:55:49 2010 +0300 +++ b/calendarwidgetplugin/src/contentlayoutgesture.cpp Wed Aug 18 09:37:48 2010 +0300 @@ -131,8 +131,12 @@ */ void ContentLayoutGesture::onTap(QPointF& point) { - LOGS("ContentLayoutGesture::launchApplication"); - if (mLayout->sceneBoundingRect().contains(point)) { + LOGS("ContentLayoutGesture::onTap"); + //traslate the container rect to right position according to the scene + QRectF layoutRect( QPointF( mLayout->rect().topLeft().x() + mLayout->pos().x(), mLayout->rect().topLeft().y() + mLayout->pos().y() ), + QPointF( mLayout->rect().bottomRight().x() + mLayout->pos().x(), mLayout->rect().bottomRight().y() + mLayout->pos().y() )); + + if ( layoutRect.contains(point) ) { if (mTapAction == "launchApplication") { launchApplication(mTapParameters, mTapParametersType); mTestID = 1; @@ -157,6 +161,10 @@ if (request == NULL) { return; } + + XQRequestInfo options; + options.setForeground(true); + request->setInfo(options); // Connect result handling signal connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&))); diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/src/contentlayouthandler.cpp --- a/calendarwidgetplugin/src/contentlayouthandler.cpp Tue Jul 06 11:55:49 2010 +0300 +++ b/calendarwidgetplugin/src/contentlayouthandler.cpp Wed Aug 18 09:37:48 2010 +0300 @@ -139,6 +139,7 @@ KCalPubSubCategory.iUid, key); mCalendarKeyManager->stopMonitoring(calendarKey); delete mCalendarKeyManager; + delete mDateObserver; } /* @@ -266,6 +267,9 @@ setTimerForNextUpdate(); //From DateIconLayoutHandler setCalendarIconContent(); + + //test signal + emit calendarChanged(); } /* @@ -290,6 +294,9 @@ } setLabelsColor(); + //test results + mTestID = 1; + emit themeChanged(); } /* @@ -407,6 +414,8 @@ LOGS("ContentLayoutHandler::eventTimerExpired"); decorateContent(); setTimerForNextUpdate(); + //test signal + emit timerExpired(); } /* @@ -933,30 +942,17 @@ } } -void ContentLayoutHandler::handleOk(const QVariant& var) -{ - Q_UNUSED(var); - - LOGS("ContentLayoutHandler::handleOk"); - mTestResult = 0; - emit requestComplete(); -} - -void ContentLayoutHandler::handleError(int err, const QString& str) -{ - Q_UNUSED(str); - - LOGS("ContentLayoutHandler::handleError"); - mTestResult = err; - emit requestError(); -} - void ContentLayoutHandler::highlightOn(QPointF &point) { + LOGS("ContentLayoutHandler::highlightOn"); // --- Content layout --- if (mContainer) { - if (mContainer->sceneBoundingRect().contains(point)) { + //traslate the container rect to right position according to the scene + QRectF layoutRect( QPointF( mContainer->rect().topLeft().x() + mContainer->pos().x(), mContainer->rect().topLeft().y() + mContainer->pos().y() ), + QPointF( mContainer->rect().bottomRight().x() + mContainer->pos().x(), mContainer->rect().bottomRight().y() + mContainer->pos().y() )); + + if ( layoutRect.contains(point) ) { LOGS("[[[Highlight signal in Content area]]]"); if (!mContentHighlightActive) { HbFrameDrawer* highlightDrawer = new HbFrameDrawer(HIGHLIGHT_IMAGE_NAME, @@ -975,7 +971,11 @@ // TODO Don't highlight if already highlighted if (mIconContainer) { - if (mIconContainer->sceneBoundingRect().contains(point)) { + //traslate the container rect to right position according to the scene + QRectF layoutRect( QPointF( mIconContainer->rect().topLeft().x() + mIconContainer->pos().x(), mIconContainer->rect().topLeft().y() + mIconContainer->pos().y() ), + QPointF( mIconContainer->rect().bottomRight().x() + mIconContainer->pos().x(), mIconContainer->rect().bottomRight().y() + mIconContainer->pos().y() )); + + if ( layoutRect.contains(point) ) { LOGS("[[[Highlight signal in dateicon area]]]"); if (!mDateHighlightActive) { HbFrameDrawer* highlightDrawer = new HbFrameDrawer(HIGHLIGHT_IMAGE_NAME, @@ -996,8 +996,8 @@ void ContentLayoutHandler::highlightOff() { + LOGS("ContentLayoutHandler::highlightOff"); // --- Content layout --- - if (mContentHighlightActive) { QGraphicsItem* background1 = mContainer->backgroundItem(); if (background1) { @@ -1040,22 +1040,6 @@ } /* - * ContentLayoutHandler::testResult() - */ -int ContentLayoutHandler::testResult() -{ - return mTestResult; -} - -/* - * ContentLayoutHandler::setTestResult - */ -void ContentLayoutHandler::setTestResult(int testResult) -{ - mTestResult = testResult; -} - -/* * ContentLayoutHandler::setTimerForNextUpdate() */ void ContentLayoutHandler::setTimerForNextUpdate() diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/src/dateiconlayouthandler.cpp --- a/calendarwidgetplugin/src/dateiconlayouthandler.cpp Tue Jul 06 11:55:49 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,263 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Calendar widget's date icon layout handler -* -*/ - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "dateiconlayouthandler.h" -#include "calendarwidgetdebug.h" -#include "datetimeobserver.h" - -// Local constants -namespace -{ - const HbFrameDrawer::FrameType BACKGROUND_FRAME_TYPE = HbFrameDrawer::OnePiece; - const char *DAY_CONTAINER = "dayContainer"; - const char *DATE_ICON_DAYNUMBER = "dayNumber"; - const char *DATE_ICON_MONTHLABEL = "month"; - const char *NUMBER_LABEL_COLOR = "qtc_hs_cal"; - const char *MONTH_LABEL_COLOR = "qtc_hs_list_item_title_normal"; - const char *DATE_BACKGROUND = "qtg_large_calendar_dynamic"; -} // namespace - -// ======== MEMBER FUNCTIONS ======== - -/* - * DateIconLayoutHandler::DateIconLayoutHandler() - */ -DateIconLayoutHandler::DateIconLayoutHandler() - : mWidget(0), - mNumberLabel(0), - mMonthLabel(0), - mFrameDrawer(0), - mDateObserver(0) -{ - LOGS("DateIconLayoutHandler::DateIconLayoutHandler"); -} - -/* - * DateIconLayoutHandler::~DateIconLayoutHandler() - */ -DateIconLayoutHandler::~DateIconLayoutHandler() -{ - LOGS("DateIconLayoutHandler::~DateIconLayoutHandler()"); - delete mDateObserver; -} - -/* - * DateIconLayoutHandler::initializeLayout() - */ -void DateIconLayoutHandler::initializeLayout(const HbDocumentLoader &layoutLoader, QObject *owner) -{ - this->setParent(owner); - mWidget = qobject_cast(layoutLoader.findWidget(QString(DAY_CONTAINER))); - mNumberLabel = qobject_cast(layoutLoader.findWidget(QString(DATE_ICON_DAYNUMBER))); - mMonthLabel = qobject_cast(layoutLoader.findWidget(QString(DATE_ICON_MONTHLABEL))); - - // Create background drawer only if day container loading succeeded - if (mWidget) { - mFrameDrawer = new HbFrameDrawer(DATE_BACKGROUND, BACKGROUND_FRAME_TYPE); - HbFrameItem* frameItem = new HbFrameItem(mFrameDrawer); - mWidget->setBackgroundItem(frameItem); - } - - setCalendarIconContent(); - setLabelsColor(); - - mDateObserver = new DateTimeObserver(); - connect(mDateObserver, SIGNAL(completed()), this, SIGNAL(dateChanged())); - connect(this, SIGNAL( dateChanged() ), owner, SIGNAL( updateLayout() )); -} - -/* - * DateIconLayoutHandler::updateLayout() - */ -void DateIconLayoutHandler::updateLayout() -{ - LOGS("DateIconLayoutHandler::updateLayout"); - setCalendarIconContent(); -} - -/* - * DateIconLayoutHandler::onTap() - */ -void DateIconLayoutHandler::onTap(QPointF &point) -{ - if (mWidget) { - if (mWidget->sceneBoundingRect().contains(point)) { - LOGS("[[[onTap in DateIcon area]]]"); - launchCalendarMonthView(); - } - } -} - -/* - * DateIconLayoutHandler::onThemeChange() - */ -void DateIconLayoutHandler::onThemeChange() -{ - LOGS("DateIconLayoutHandler::onThemeChange"); - if (mFrameDrawer) { - mFrameDrawer->themeChanged(); - } - setLabelsColor(); -} - -void DateIconLayoutHandler::setLabelsColor() -{ - LOGS("CalendarWidget::CalendarWidget"); - - const QString dayLabelColorAttribute(NUMBER_LABEL_COLOR); - QColor numberLabelColor(HbColorScheme::color(dayLabelColorAttribute)); - if (numberLabelColor.isValid() && mNumberLabel) { - mNumberLabel->setTextColor(numberLabelColor); - } - - const QString monthLabelColorAttribute(MONTH_LABEL_COLOR); - QColor monthLabelColor(HbColorScheme::color(monthLabelColorAttribute)); - if (monthLabelColor.isValid() && mMonthLabel) { - mMonthLabel->setTextColor(monthLabelColor); - } -} - -/* - * DateIconLayoutHandler::setCalendarIconContent() - */ -void DateIconLayoutHandler::setCalendarIconContent() -{ - LOGS("DateIconLayoutHandler::setCalendarIconContent"); - if (mNumberLabel) { - mNumberLabel->setPlainText(QString::number(QDateTime::currentDateTime().date().day(), 10)); - } - if (mMonthLabel) { - mMonthLabel->setPlainText(QLocale::system().monthName( - QDateTime::currentDateTime().date().month())); - } -} - -/* - * DateIconLayoutHandler::launchCalendarMonthView() - */ -void DateIconLayoutHandler::launchCalendarMonthView() -{ - LOGS("DateIconLayoutHandler::launchCalendarMonthView"); - - QString interface("calendar.Launch"); - QString service("com.nokia.services"); - QString method("launchCalendarApp(QDateTime,int)"); - - XQApplicationManager aiwMgr; - XQAiwRequest* request = aiwMgr.create(service, interface, method, false); - if (request == NULL) - { - return; - } - - // Connect result handling signal - connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&))); - // Connect error handling signal or apply lastError function instead. - connect(request, SIGNAL(requestError(int,const QString&)), this, SLOT(handleError(int,const QString&))); - - QList args; - //if there are no elements in the calendar open the current day view - QDateTime currentDate = QDateTime::currentDateTime(); - args << currentDate; - - int viewId = 0; - args << viewId; - - // Set function parameters - request->setArguments(args); - - // Send the request - bool res = request->send(); - if (!res) { - // Request failed. - int error = request->lastError(); - // Handle error - } - - // All done. - delete request; -} - -/* - * DateIconLayoutHandler::handleOk() - */ -void DateIconLayoutHandler::handleOk(const QVariant& var) -{ - Q_UNUSED(var); - LOGS("DateIconLayoutHandler::handleOk"); - mTestResult = 0; - emit requestComplete(); -} - -/* - * DateIconLayoutHandler::handleError() - */ -void DateIconLayoutHandler::handleError(int err, const QString& str) -{ - Q_UNUSED(str); - LOGS("ContentLayoutHandler::handleError"); - mTestResult = err; - emit requestError(); -} - -/* - * TEST Functions - */ - -/* - * DateIconLayoutHandler::testId() - */ -int DateIconLayoutHandler::testId() -{ - return mTestID; -} - -/* - * DateIconLayoutHandler::setTestId() - */ -void DateIconLayoutHandler::setTestId(int testID) -{ - mTestID = testID; -} - -int DateIconLayoutHandler::testResult() -{ - return mTestResult; -} - -void DateIconLayoutHandler::setTestResult(int testResult) -{ - mTestResult = testResult; -} - -//End of file - diff -r db1bf15cefff -r f8e7eccf5f96 calendarwidgetplugin/src/mainlayouthandler.cpp --- a/calendarwidgetplugin/src/mainlayouthandler.cpp Tue Jul 06 11:55:49 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Calendar widget's date icon layout handler -* -*/ - -// System includes -#include -#include -#include -#include -#include - -// User includes -#include "mainlayouthandler.h" -#include "calendarwidgetdebug.h" - -// Local constants -namespace - { - const char WIDGET[] = "CalendarWidget"; - const char *SEPARATOR_LABEL = "separatorLabel"; - const char *SEPARATOR_IMAGE_NAME = "qtg_graf_divider_v_thin"; - const char *BACKGROUND_IMAGE_NAME = "qtg_fr_hswidget_normal"; - const HbFrameDrawer::FrameType BACKGROUND_FRAME_TYPE = HbFrameDrawer::NinePieces; - const HbFrameDrawer::FrameType SEPARATOR_FRAME_TYPE = HbFrameDrawer::OnePiece; - } // namespace - -// ======== MEMBER FUNCTIONS ======== - -MainLayoutHandler::MainLayoutHandler() - : mWidget(0), - mSeparatorLabel(0), - mIconLayoutItem(0), - mBackgroundLayoutItem(0), - mSeparatorLayoutItem(0) -{ - LOGS("MainLayoutHandler::MainLayoutHandler"); -} - -MainLayoutHandler::~MainLayoutHandler() -{ - LOGS("MainLayoutHandler::~MainLayoutHandler"); -} - -void MainLayoutHandler::initializeLayout(const HbDocumentLoader &layoutLoader, QObject *owner) -{ - LOGS("MainLayoutHandler::initializeLayout"); - setParent(owner); - - mWidget = (HbWidget*)layoutLoader.findWidget(WIDGET); - mSeparatorLabel = qobject_cast(layoutLoader.findWidget(QString(SEPARATOR_LABEL))); - - // The rest of the initializion is pointless if loading of the main widget fails. - if (!mWidget) { - return; - } - - addItem(mWidget); - mWidget->setVisible(true); - - HbFrameDrawer* backgroundFrameDrawer = new HbFrameDrawer(BACKGROUND_IMAGE_NAME, - BACKGROUND_FRAME_TYPE); - mBackgroundLayoutItem = new HbFrameItem(backgroundFrameDrawer); - mWidget->setBackgroundItem(mBackgroundLayoutItem); - HbFrameDrawer* separatorFrameDrawer = new HbFrameDrawer(SEPARATOR_IMAGE_NAME, - SEPARATOR_FRAME_TYPE); - mSeparatorLayoutItem = new HbFrameItem(separatorFrameDrawer); - mSeparatorLabel->setBackgroundItem(mSeparatorLayoutItem); - - setPreferredSize(mWidget->preferredSize()); -} - -void MainLayoutHandler::updateLayout() -{ - LOGS("MainLayoutHandler::updateLayout"); -} - -void MainLayoutHandler::onThemeChange() -{ - LOGS("MainLayoutHandler::onThemeChange"); - if (mBackgroundLayoutItem) { - mBackgroundLayoutItem->frameDrawer().themeChanged(); - } - if (mSeparatorLayoutItem) { - mSeparatorLayoutItem->frameDrawer().themeChanged(); - } -}