[meego-commits] 5582: Changes to Trunk:Testing/meegotouch-controlpanel

Kaitlin Rupert kaitlin.rupert at intel.com
Mon Jul 12 18:30:31 UTC 2010


Hi,
I have made the following changes to meegotouch-controlpanel in project Trunk:Testing. Please review and accept ASAP.

Thank You,
Kaitlin Rupert

[This message was auto-generated]

---

Request #5582:

  submit:   devel:nokia:trunk/meegotouch-controlpanel(r5) -> Trunk:Testing/meegotouch-controlpanel


Message:
    Update to release tag 0.8.4.  This update is dependent on the libmeegotouch u
pdate.

State:   new          2010-07-12T06:25:32 krupert
Comment: None



changes files:
--------------
--- meegotouch-controlpanel.changes
+++ meegotouch-controlpanel.changes
@@ -0,0 +1,3 @@
+* Thu Jul 08 2010 Kaitlin Rupert <kaitlin.rupert at intel.com> 0.8.4
+- Update to release tag 0.8.4
+

old:
----
  meegotouch-controlpanel-0.7.20.1.tar.bz2
  meegotouchcontrolpanel-0.7.19-install-tests-with-qt4-tests.patch

new:
----
  meegotouch-controlpanel-0.8.4.tar.bz2

spec files:
-----------
--- meegotouch-controlpanel.spec
+++ meegotouch-controlpanel.spec
@@ -1,21 +1,20 @@
 # 
 # Do not Edit! Generated by:
-# spectacle version 0.17
+# spectacle version 0.18
 # 
 # >> macros
 # << macros
 
 Name:       meegotouch-controlpanel
 Summary:    MeeGo Control Panel
-Version:    0.7.20.1
+Version:    0.8.4
 Release:    1
 Group:      System/Libraries
 License:    LGPL v2.1
 URL:        http://www.meego.com
 Source0:    %{name}-%{version}.tar.bz2
 Source100:  meegotouch-controlpanel.yaml
-Patch0:     meegotouchcontrolpanel-0.7.19-install-tests-with-qt4-tests.patch
-Patch1:     meegotouchcontrolpanel-0.7.19-add-english-translations
+Patch0:     meegotouchcontrolpanel-0.7.19-add-english-translations
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 BuildRequires:  pkgconfig(QtCore) >= 4.6.0
@@ -51,17 +50,15 @@
 %prep
 %setup -q -n %{name}-%{version}
 
-# meegotouchcontrolpanel-0.7.19-install-tests-with-qt4-tests.patch
-%patch0 -p1
 # meegotouchcontrolpanel-0.7.19-add-english-translations
-%patch1 -p1
+%patch0 -p1
 # >> setup
 # << setup
 
 %build
 # >> build pre
 export PATH=$PATH:/usr/lib/qt4/bin
-qmake-qt4
+./configure_with_disabled_launcher.sh
 # << build pre
 
 
@@ -78,6 +75,11 @@
 
 # >> install post
 %fdupes %{buildroot}%{_libdir}
+%fdupes %{buildroot}%{_datadir}
+
+#Install tests alongside Qt examples
+mkdir %{buildroot}/%{_qt4_prefix}/tests
+mv %{buildroot}/%{_libdir}/duicontrolpanel-tests %{buildroot}/%{_libdir}/qt4/tests/duicontrolpanel-tests
 
 # meegotouchcontrolpanel.pc
 mkdir -p %{buildroot}%{_libdir}/pkgconfig
@@ -112,10 +114,12 @@
 %files
 %defattr(-,root,root,-)
 # >> files
-%{_bindir}/duicontrolpanel
+%attr(0755, -, -) %{_bindir}/duicontrolpanel
 %{_libdir}/libduicontrolpanel.so
 %{_libdir}/duicontrolpanel/applets/libdeclarative.so
 %{_libdir}/duicontrolpanel/applets/libdcpskeletonapplet.so
+%{_libdir}/duicontrolpanel/applets/libdcpskelbuttonapplet.so
+%{_libdir}/duicontrolpanel/skelbutton.desktop
 %{_datadir}/applications/duicontrolpanel.desktop
 %{_datadir}/dbus-1/interfaces/com.nokia.DuiControlPanelIf.xml
 %{_datadir}/dbus-1/services/com.nokia.duicontrolpanel.service
@@ -129,7 +133,6 @@
 %{_datadir}/l10n/meegotouch/duicontrolpanel_en.qm
 # << files
 
-
 %files devel
 %defattr(-,root,root,-)
 # >> files devel

other changes:
--------------

++++++ meegotouch-controlpanel-0.7.20.1.tar.bz2 -> meegotouch-controlpanel-0.8.4.tar.bz2
--- configure_with_disabled_launcher.sh
+++ configure_with_disabled_launcher.sh
+#! /bin/sh
+
+if [ -f Makefile ]; then
+    make distclean
+fi
+qmake CONFIG+=DISABLE_LAUNCHER
+echo "You can start 'make' now."
+
--- controlpanel/src/component/dcpmaincategory.cpp
+++ controlpanel/src/component/dcpmaincategory.cpp
@@ -46,10 +46,14 @@
 
     m_LandscapeLayout = new MGridLayoutPolicy (m_Layout);
     m_PortraitLayout = new MLinearLayoutPolicy (m_Layout, Qt::Vertical);
-    
+
     m_Layout->setLandscapePolicy (m_LandscapeLayout);
     m_Layout->setPortraitPolicy (m_PortraitLayout);
 
+    // main category is an invisible "pure logical" widget, thats why we
+    // need no margins here
+    m_Layout->setContentsMargins (0,0,0,0);
+
     setLayout (m_Layout);
 }
 
@@ -72,6 +76,14 @@
     }
 }
 
+
+QGraphicsWidget*
+DcpMainCategory::widgetAt (int i)
+{
+    if (i>layout()->count()) return 0;
+    return (QGraphicsWidget*)(layout()->itemAt(i)->graphicsItem());
+}
+
 void 
 DcpMainCategory::setHorizontalSpacing (
         int space)
--- controlpanel/src/component/dcpmaincategory.h
+++ controlpanel/src/component/dcpmaincategory.h
@@ -38,6 +38,7 @@
             const QString    &logicalId = "");
 
     virtual void appendWidget (QGraphicsWidget *component);
+    QGraphicsWidget* widgetAt (int i);
     virtual int  maxColumns ();
     virtual void setMaxColumns (int columns);
     MLayout* mLayout() const { return m_Layout; }
--- controlpanel/src/duicontrolpanel.desktop
+++ controlpanel/src/duicontrolpanel.desktop
@@ -1,6 +1,7 @@
 [Desktop Entry]
 Type=Application
-Name=System settings
+Name=Settings
+X-MeeGo-Logical-Id=qtn_sett_launcher
+X-MeeGo-Translation-Catalog=settings
 Icon=icon-l-settings
 Exec=/usr/bin/duicontrolpanel
-
--- controlpanel/src/duicontrolpanel.invoker
+++ controlpanel/src/duicontrolpanel.invoker
+#!/bin/sh
+exec /usr/bin/invoker --type=m --delay 1 $0.launch "$@"
--- controlpanel/src/main.cpp
+++ controlpanel/src/main.cpp
@@ -21,6 +21,7 @@
 #include <sys/wait.h>
 #include <csignal>
 #include <MApplicationWindow>
+#include <MComponentCache>
 #include <DcpDebug>
 #include <DcpRetranslator>
 #include <MApplication>
@@ -32,64 +33,6 @@
 
 #include "dcpdebug.h"
 
-/*!
- * In this function we fork to a child and then wait until the child is
- * terminated. Then we try to decide what happened with the child process, if it
- * is crashed then we for again.
- * Here we don't want to load use DcpWrongApplets::queryBadApplets() to
- * investigate the disabled applet's list, because that would lead to a
- * situation where we load all the applet *.desktop files in the parent and in
- * the child as well. That would slow down the initialization of the
- * application.
- */
-void 
-startSupervising()
-{
-    DCP_DEBUG ("");
-
-    /* it was necessery to init wrongapplets because it connects the signals
-     * for the segfault, and otherwise segfaulting from DuiApplication for
-     * instance makes duicontrolpanel run in an endless loop
-     */
-    DcpWrongApplets::instance();
-
-    while (fork() > 0) {
-        DCP_DEBUG ("FORKED a child");
-
-        /*
-         * We forked to a child that will do the actual job. We just wait until
-         * it exits.
-         */
-        int result = 0;
-        wait (&result);
-
-        /*
-         * If the child exited because of a signal and the signal shows that it
-         * was a crash we continue (fork again) to start up the program with the
-         * applet disabled. Please note that the child process will end up with
-         * these signals only if it found a fawlty applet. It catches all these
-         * signals and it will call exit() if the crash happened inside the
-         * duicontrolpanel code.
-         */
-        if (WIFSIGNALED(result)) {
-            switch (WTERMSIG(result)) {
-                case SIGILL:
-                case SIGSEGV:
-                case SIGBUS:
-                case SIGABRT:
-                case SIGFPE:
-                    DCP_WARNING ("Child has been aborted.");
-                    continue;
-            }
-        }
-
-        /*
-         * If this was not an applet crash we exit.
-         */
-        exit (result);
-    }
-}
-
 /* 
  * this redefines the signal handler for TERM and INT signals, so as to be able
  * to use aboutToQuit signal from qApp also in these cases 
@@ -111,12 +54,16 @@
 {
     DCP_DEBUG ("");
 
-    MApplication app(argc, argv);
+#ifndef DISABLE_LAUNCHER
+    MApplication *app = MComponentCache::mApplication(argc, argv);
+#else // USE_LAUNCHER
+    MApplication *app = new MApplication (argc, argv);
+#endif // USE_LAUNCHER
     signal(SIGTERM, &onTermSignal);
     signal(SIGINT, &onTermSignal);
 
     // install the new translations if locale changes:
-    QObject::connect(&app, SIGNAL(localeSettingsChanged()),
+    QObject::connect(app, SIGNAL(localeSettingsChanged()),
                      DcpRetranslator::instance(), SLOT(retranslate()));
     /*
      * the translations of duicontrolpanel turned out to be in catalog
@@ -129,15 +76,19 @@
     DuiControlPanelService* service = new DuiControlPanelService();
 
     // mainwindow:
-    MApplicationWindow win;
+#ifndef DISABLE_LAUNCHER
+    MApplicationWindow *win = MComponentCache::mApplicationWindow();
+#else // USE_LAUNCHER
+    MApplicationWindow *win = new MApplicationWindow();
+#endif // USE_LAUNCHER
     service->createStartPage();
-    win.show();
+    win->show();
 
-    return app.exec();
+    return app->exec();
 }
 
 
-int main(int argc, char *argv[])
+M_EXPORT int main(int argc, char *argv[])
 {
     // parse options
     QString desktopDir;
@@ -164,7 +115,7 @@
     }
 
     if (!DcpWrongApplets::isDisabled()) {
-        startSupervising();
+        DcpWrongApplets::connectSupervisorSignals();
     }
 
     /*!
--- controlpanel/src/page/dcpappletbuttons.cpp
+++ controlpanel/src/page/dcpappletbuttons.cpp
@@ -26,7 +26,9 @@
 #include <DcpAppletMetadata>
 #include <DcpAppletObject>
 #include <DcpApplet>
+#include <DcpWidgetTypes>
 #include <DcpContentItem>
+#include <DcpContentButton>
 
 #include <MSceneManager>
 // #include <MGridLayoutPolicy>
@@ -98,11 +100,25 @@
                     withUncategorized ? DcpMain::isCategoryNameEnlisted : NULL);
     }
 
+    // ensure that all needed catalogs are loaded for the applets before construction
+    DcpRetranslator::instance()->ensureTranslationsAreLoaded(metadatas);
+
     // adds the briefwidgets
     foreach (DcpAppletMetadata* item, metadatas) {
         addComponent (item);
     }
-    DcpRetranslator::instance()->ensureTranslationsAreLoaded(metadatas);
+}
+
+DcpAppletMetadata*
+DcpAppletButtons::appletMetadata (int pos)
+{
+    QGraphicsWidget* widget = widgetAt(pos);
+    if (!widget) return 0;
+    DcpContentItem* contentItem = qobject_cast<DcpContentItem*>(widget);
+    if (!contentItem) return 0;
+    DcpAppletObject* applet = contentItem->applet();
+    if (!applet) return 0;
+    return applet->metadata();
 }
 
 void
@@ -111,12 +127,24 @@
     metadata->markActive();
 
     // FIXME: we can avoid this additional lookup i guess
+    QGraphicsWidget *briefWidget;
     DcpAppletObject* applet = DcpAppletDb::instance ()->applet (metadata->name());
-    DcpContentItem* briefWidget = new DcpContentItem (applet, this);
-    briefWidget->setObjectName ("DcpContentItem");
-    briefWidget->setMattiID ("DcpContentItem::" + logicalId() + "::" +
+    int widgetId = metadata->widgetTypeID();
+    if (widgetId == DcpWidgetType::Button) {
+            DcpContentButton *button = new DcpContentButton (applet, this);
+            button->setObjectName ("DcpContentButton");
+            button->setMattiID ("DcpContentButton::" + logicalId() + "::" +
+                             metadata->category() + "::" + metadata->name());
+            briefWidget = button;
+        }
+        else {   
+            DcpContentItem *item = new DcpContentItem (applet, this);
+            item->setObjectName ("DcpContentItem");
+            item->setMattiID ("DcpContentItem::" + logicalId() + "::" +
                              metadata->category() + "::" + metadata->name());
 
+            briefWidget = item;
+    }
     appendWidget (briefWidget);
 }
 
--- controlpanel/src/page/dcpappletbuttons.h
+++ controlpanel/src/page/dcpappletbuttons.h
@@ -45,6 +45,7 @@
             DcpAppletMetadata *metadata);
 
     virtual bool reload();
+    DcpAppletMetadata* appletMetadata (int pos);
 
 protected:
     virtual void createContents();
--- controlpanel/src/page/dcpappletcategorypage.cpp
+++ controlpanel/src/page/dcpappletcategorypage.cpp
@@ -32,7 +32,9 @@
 DcpAppletCategoryPage::DcpAppletCategoryPage (
         const DcpCategoryInfo  *categoryInfo) :
     DcpPage (),
-    m_CategoryInfo (categoryInfo)
+    m_CategoryInfo (categoryInfo),
+    m_TitleId(0),
+    m_Category(0)
 {
 }
 
@@ -62,7 +64,40 @@
     m_CategoryInfo = categoryInfo;
 }
 
-void 
+/*! \brief Returns the count of applets present in the active category.
+ *
+ * Note that it is not very cheap, because it forces the items (widgets) to be
+ * loaded. So only use it in case you want to load the items anyway
+ */
+int
+DcpAppletCategoryPage::appletCount()
+{
+    // this forces loading the items
+    if (!isContentCreated()) {
+        createContent();
+    } else if (m_LoadedAppletCategory != appletCategory()) {
+        m_Category->setCategoryInfo (m_CategoryInfo);
+    }
+
+    return m_Category->getItemCount();
+}
+
+/*! \brief Returns the metadata at the specified position.
+ *
+ * Note, the same applies as for appletCount().
+ */
+DcpAppletMetadata*
+DcpAppletCategoryPage::appletMetadata(int i)
+{
+    if (i < appletCount()) {
+        return m_Category->appletMetadata(i);
+    } else {
+        return 0;
+    }
+}
+
+
+void
 DcpAppletCategoryPage::reload ()
 {
     DCP_DEBUG ("");
--- controlpanel/src/page/dcpappletcategorypage.h
+++ controlpanel/src/page/dcpappletcategorypage.h
@@ -41,6 +41,8 @@
 
     virtual void reload();
     void setTitleId(const char* titleId);
+    int appletCount();
+    DcpAppletMetadata* appletMetadata(int i);
 
 public slots:
     virtual void back();
--- controlpanel/src/page/dcpappletpage.cpp
+++ controlpanel/src/page/dcpappletpage.cpp
@@ -217,6 +217,12 @@
     if (m_Applet->interfaceVersion() >= 2) {
         connect (m_MainWidget, SIGNAL (closePage()),
                  this, SLOT (back ()));
+        if (m_Applet->interfaceVersion() >= 4) {
+            connect (m_MainWidget, SIGNAL (inProgress (bool)),
+                     this, SLOT (setProgressIndicatorVisible (bool)));
+            setProgressIndicatorVisible (
+                    m_MainWidget->isProgressIndicatorVisible());
+        }
     }
 
     // add the actions:
--- controlpanel/src/page/dcpcategorycomponent.cpp
+++ controlpanel/src/page/dcpcategorycomponent.cpp
@@ -35,7 +35,8 @@
 : DcpComponent (category, categoryInfo->appletCategory, parent, 
                 categoryInfo->titleId),
     m_AppletButtons(0),
-    m_CategoryInfo (categoryInfo)
+    m_CategoryInfo (categoryInfo),
+    m_Container(0)
 {
     createContents ();
     setMattiID (QString("DcpCategoryComponent::") + categoryInfo->titleId);
@@ -44,6 +45,7 @@
     // at all, thus disabling margins.
     setContentsMargins(0,0,0,0);
     layout()->setContentsMargins(0,0,0,0);
+    retranslateUi();
 }
 
 
@@ -56,7 +58,12 @@
 DcpCategoryComponent::setTitle (
         const QString &title)
 {
-    m_Container->setTitle (title);
+    if (m_AppletButtons) {
+        m_AppletButtons->setTitle (title);
+    }
+    if (m_Container) {
+        m_Container->setTitle (title);
+    }
     DcpComponent::setTitle (title);
 }
 
--- controlpanel/src/page/dcppage.cpp
+++ controlpanel/src/page/dcppage.cpp
@@ -55,7 +55,11 @@
 void
 DcpPage::createLayout ()
 {
-    new QGraphicsLinearLayout (Qt::Vertical, centralWidget());
+    QGraphicsLinearLayout* layout =
+        new QGraphicsLinearLayout (Qt::Vertical, centralWidget());
+
+    // we should not have margins around the mainwidget
+    layout->setContentsMargins (0,0,0,0);
 }
 
 void 
--- controlpanel/src/page/pagefactory.cpp
+++ controlpanel/src/page/pagefactory.cpp
@@ -29,6 +29,7 @@
 #include <DcpAppletMetadata>
 #include <DcpAppletObject>
 #include <DcpAppletCategoryPage>
+#include <DcpWidgetTypes>
 #include <MainTranslations>
 
 #include <MApplication>
@@ -50,6 +51,13 @@
     connect (MApplication::activeWindow (),
             SIGNAL(pageChanged(MApplicationPage *)),
             this, SLOT(pageChanged(MApplicationPage *)));
+
+    // FIXME XXX: move this back to mainPageFirstShown, because it loads all
+    // desktop files
+    // FIXME XXX appletdb can contain some applets at this state which are
+    // not connected
+    connect (DcpAppletDb::instance(), SIGNAL(appletLoaded(DcpAppletObject*)),
+             this, SLOT(onAppletLoaded(DcpAppletObject*)));
 }
 
 void
@@ -59,7 +67,25 @@
       delete sm_Instance;
     sm_Instance=0;
 }
- 
+
+
+/*
+ * Whenever someone wants an applet to be activated (started, shown on the
+ * screen atc.) a signal is sent to the applet's metadata. Then the applets
+ * metadata will send a signal, so the pagefactory can open a new page for
+ * it.
+ *
+ * If an applet wants to start up an other applet we also got a signal here
+ * so we can start up the applet. In this case we will have an external
+ * referer for the applets main page.
+ */
+ void
+PageFactory::onAppletLoaded (DcpAppletObject *applet)
+{
+    connect (applet, SIGNAL (activate (int)),
+             this, SLOT (appletWantsToStart (int)));
+}
+
 /*!
  * This slotz should be called only once, when the main page has been shown, so
  * we can access the applet database without forcing it to be loaded early. It
@@ -69,30 +95,6 @@
 void
 PageFactory::mainPageFirstShown ()
 {
-    QStringList list;
-
-    /*
-     * Whenever someone wants an applet to be activated (started, shown on the
-     * screen atc.) a signal is sent to the applet's metadata. Then the applets
-     * metadata will send a signal, so the pagefactory can open a new page for
-     * it.
-     *
-     * If an applet wants to start up an other applet we also got a signal here
-     * so we can start up the applet. In this case we will have an external
-     * referer for the applets main page.
-     *
-     * FIXME: this is not good, because when main page is not at all popped up,
-     * for example when starting with an appletpage because of a servicefw
-     * signal, then the applets are not connected, therefor not able to pop up
-     * there other pages, or another applet's page.
-     */
-    list = DcpAppletDb::instance()->appletNames();
-    foreach (QString name, list) {
-        DcpAppletObject *applet = DcpAppletDb::instance()->applet(name);
-        connect (applet, SIGNAL (activate (int)),
-                this, SLOT (appletWantsToStart (int)));
-    }
-
     AppletErrorsDialog::showAppletErrors();
 }
 
@@ -177,7 +179,12 @@
 PageFactory::createAppletPage (PageHandle &handle)
 {
     DcpAppletObject *applet = DcpAppletDb::instance()->applet (handle.param);
-
+    
+    if (applet->widgetTypeID() == DcpWidgetType::Button)
+    {
+        applet->setToggle(!applet->toggle());
+        return 0;
+    }
     /*
      * this prevents openning the same page multiple times,
      * if more signals are coming, for example if user clicks double
@@ -197,7 +204,7 @@
     registerPage (appletPage);
 
     // we do this because we need to know if the page has a widget or not
-    // TODO XXX
+    // TODO
     appletPage->createContent();
 
     if (!appletPage->hasWidget() && !appletPage->hasError()) {
@@ -210,6 +217,19 @@
     }
 }
 
+
+/*!
+ * Creates the applet page based on the applet's metadata
+ */
+DcpPage*
+PageFactory::createAppletPage (DcpAppletMetadata* metadata)
+{
+    PageHandle handle;
+    handle.id = PageHandle::APPLET;
+    handle.param = metadata->name();
+    return createAppletPage (handle);
+}
+
 /*!
  * Creates an applet category page, a page that shows a group of applets the
  * same way the main page shows applets.
@@ -237,6 +257,22 @@
 
     m_AppletCategoryPage->setTitleId (info->titleId);
 
+    /*
+     * If the category contains one applet only, then we do not require the user
+     * to click on that, but switch to the appletPage directly
+     *
+     * It is for service accounts page only, because that whole category gets
+     * provided by an applet.
+     */
+    if (id == PageHandle::ServiceAccounts &&
+        m_AppletCategoryPage->appletCount() == 1)
+    {
+        DcpAppletMetadata* metadata = m_AppletCategoryPage->appletMetadata(0);
+        if (metadata) {
+            return createAppletPage (metadata);
+        }
+    }
+
     return m_AppletCategoryPage;
 }
 
@@ -311,19 +347,6 @@
 {
     connect (page, SIGNAL(openSubPage (const PageHandle &)), 
         this, SLOT(changePage(const PageHandle &)));
-
-    if (page != m_MainPage) {
-        // closeAction TODO XXX on language change, move into to the page?
-        MAction *quitAction;
-
-        quitAction = new MAction (qtTrId(DcpMain::quitMenuItemTextId), page);
-        quitAction->setLocation(MAction::ApplicationMenuLocation);
-
-        connect(quitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
-
-        // Add actions to page
-        page->addAction(quitAction);
-    }
 }
 
 /*!
--- controlpanel/src/page/pagefactory.h
+++ controlpanel/src/page/pagefactory.h
@@ -56,10 +56,12 @@
     PageFactory ();
     DcpPage* createMainPage ();
     DcpPage* createAppletPage(PageHandle& applet);
+    DcpPage* createAppletPage (DcpAppletMetadata* metadata);
     DcpPage* createAppletCategoryPage (PageHandle::PageTypeId pageId);
 
 private slots:
     void pageChanged (MApplicationPage *page);
+    void onAppletLoaded (DcpAppletObject *applet);
 
 private:
     bool tryOpenPageBackward (const PageHandle &handle);
--- controlpanel/src/service/duicontrolpanelservice.cpp
+++ controlpanel/src/service/duicontrolpanelservice.cpp
@@ -128,13 +128,6 @@
     m_StartPage = 0;
     startPageForReal (*handle);
 
-    if (handle->id != PageHandle::MAIN) {
-        /* Normally the applets get connected after the mainpage has
-         * been shown. But now we dont create a mainpage at all,
-         * so we create the connections here:
-         */
-        PageFactory::instance()->mainPageFirstShown();
-    }
     delete handle;
 }
 
--- controlpanel/src/src.pro
+++ controlpanel/src/src.pro
@@ -1,10 +1,28 @@
 include(../../lib/dcpconfig.pri)
 
+DISABLE_LAUNCHER {
+    TARGET = ../duicontrolpanel
+    DEFINES += DISABLE_LAUNCHER
+} else {
+    QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
+    QMAKE_LFLAGS += -pie -rdynamic
+    TARGET = ../duicontrolpanel.launch
+    invoker_trg = ../duicontrolpanel
+    invoker.depends = duicontrolpanel.invoker
+    invoker.commands = cp $$invoker.depends $$invoker_trg
+    QMAKE_EXTRA_TARGETS += invoker
+    # ugly hack that makes invoker_inst happy
+    system(touch $$invoker_trg)
+    invoker_inst.path = $$DCP_PREFIX/bin
+    invoker_inst.files = $$invoker_trg
+    invoker_inst.depends = invoker
+    INSTALLS += invoker_inst
+    QMAKE_CLEAN += $$invoker_trg
+}
+
 QMAKE_LIBDIR += ../../lib/lib/ 
-QMAKE_RPATH = -Wl
-message($$QMAKE_RPATH)
+message($$QMAKE_LFLAGS_RPATH)
 TEMPLATE = app
-TARGET = ../duicontrolpanel
 DEPENDPATH += include ../../lib/src/include
 INCLUDEPATH += $$DEPENDPATH
 message($$INCLUDEPATH)
@@ -34,13 +52,13 @@
 rfs.files += controlpanel-rfs.sh
 rfs.path += $$system(pkg-config --variable osso_rfs_scripts_dir clean-device)
 
+
 INSTALLS += target \
             rfs \
-            desktop_entry
+            desktop_entry 
 
-# FIXME, this is a temporary fix for an issue
 # You can enable delayed applet loading with uncommenting this line:
-# DEFINES += DISABLE_DELAYED_LOADING
+DEFINES += DISABLE_DELAYED_LOADING
 
 contains(DCP_BUILD_FEATURES,coverage) {
   QMAKE_EXTRA_TARGETS += coverage
--- controlpanel/tests/doubles/dcpappletbuttons-fake.cpp
+++ controlpanel/tests/doubles/dcpappletbuttons-fake.cpp
@@ -55,4 +55,8 @@
     return true;
 }
 
+DcpAppletMetadata* DcpAppletButtons::appletMetadata(int)
+{
+    return 0;
+}
 
--- controlpanel/tests/doubles/dcpappletcategorypage-fake.cpp
+++ controlpanel/tests/doubles/dcpappletcategorypage-fake.cpp
@@ -19,7 +19,9 @@
 
 DcpAppletCategoryPage::DcpAppletCategoryPage (
         const DcpCategoryInfo  *categoryInfo) :
-    m_CategoryInfo (categoryInfo)
+    m_CategoryInfo (categoryInfo),
+    m_TitleId(0),
+    m_Category(0)
 {
 }
 
@@ -67,3 +69,15 @@
    Q_UNUSED(titleId);
 }
 
+int
+DcpAppletCategoryPage::appletCount()
+{
+    return 0;
+}
+
+DcpAppletMetadata*
+DcpAppletCategoryPage::appletMetadata(int)
+{
+    return 0;
+}
+
--- controlpanel/tests/doubles/dcpmaincategory-fake.cpp
+++ controlpanel/tests/doubles/dcpmaincategory-fake.cpp
@@ -36,6 +36,7 @@
         QGraphicsWidget *parent,
         const QString& logicalId) 
 : DcpComponent (0, title, parent, logicalId),
+    m_MaxColumns(0),
     m_ColCount (0),
     m_RowCount (0),
     m_ItemCount (0),
@@ -101,3 +102,10 @@
     return m_MaxColumns;
 }
 
+QGraphicsWidget*
+DcpMainCategory::widgetAt (int)
+{
+    return 0;
+}
+
+
--- controlpanel/tests/doubles/dcpmaincategory_with_layout-fake.cpp
+++ controlpanel/tests/doubles/dcpmaincategory_with_layout-fake.cpp
@@ -108,3 +108,10 @@
     return m_MaxColumns;
 }
 
+QGraphicsWidget*
+DcpMainCategory::widgetAt (int)
+{
+    return 0;
+}
+
+
--- controlpanel/tests/doubles/dcpmainpage-fake.cpp
+++ controlpanel/tests/doubles/dcpmainpage-fake.cpp
@@ -17,7 +17,11 @@
 
 #include "dcpmainpage.h"
 
-DcpMainPage::DcpMainPage()
+DcpMainPage::DcpMainPage():
+    m_RecentlyComp(0),
+    m_OtherComp(0),
+    m_HasContent(false),
+    m_WasHidden(false)
 {
 }
 
--- controlpanel/tests/doubles/mapplication-fake.cpp
+++ controlpanel/tests/doubles/mapplication-fake.cpp
@@ -32,3 +32,7 @@
     return activeApplicationWindow();
 }
 
+QString MApplication::binaryName()
+{
+    return "";
+}
--- controlpanel/tests/doubles/pagefactory-fake.cpp
+++ controlpanel/tests/doubles/pagefactory-fake.cpp
@@ -81,3 +81,8 @@
 {
 }
 
+void
+PageFactory::onAppletLoaded (DcpAppletObject *)
+{
+}
+
--- controlpanel/tests/doubles/qgraphicsobject-fake.cpp
+++ controlpanel/tests/doubles/qgraphicsobject-fake.cpp
+#include <QGraphicsObject>
+
+void QGraphicsObject::grabGesture (Qt::GestureType, Qt::GestureFlags)
+{
+}
+
--- controlpanel/tests/ut_dcpappletpage/ut_dcpappletpage.pro
+++ controlpanel/tests/ut_dcpappletpage/ut_dcpappletpage.pro
@@ -45,6 +45,7 @@
     $$STUBSDIR/dcpcategorycomponent-fake.cpp \
     $$STUBSDIR/dcpmaincategory-fake.cpp \
     $$STUBSDIR/qgraphicslinearlayout-fake.cpp \
+    $$STUBSDIR/qgraphicsobject-fake.cpp \
     $$TEST_SOURCES \ 
 
 # base classes
--- controlpanel/tests/ut_pagefactory/ut_pagefactory.cpp
+++ controlpanel/tests/ut_pagefactory/ut_pagefactory.cpp
@@ -185,6 +185,8 @@
      * an appletobject)
      */
     DcpAppletObject* applet = page->applet();
+    factory->onAppletLoaded (applet); // this is necessery because the fake db
+                                      // does not emit a signal for us
     applet->activateSlot(1);
     page = qobject_cast<DcpAppletPage*>(factory->currentPage());
     QVERIFY (page);
--- debian/api
+++ debian/api
+interface: DuiControlPanel 
+libs-pkg: libduicontrolpanel0
+dev-pkg: libduicontrolpanel-dev
+type: library
+headers: /usr/include/duicontrolpanel/*
+state: unstable
+scope: Nokia MeeGo
--- debian/changelog
+++ debian/changelog
@@ -1,3 +1,62 @@
+duicontrolpanel (0.8.4) unstable; urgency=low
+
+  * Some margin fixes
+  * Fixes: NB#170026 - Emitting valuesChanged signal doesn't update
+    valueText displayed in Brief (removes the workaround, because bug got fixed)
+  * Fixes: NB#176941 -  duicontrolpanel crash blocks systemui-applets-ui-tests
+
+ -- Robert Manner <robert.manner at blumsoft.eu>  Mon, 28 Jun 2010 13:33:01 +0200
+
+duicontrolpanel (0.8.3) unstable; urgency=low
+
+  [ Laszlo Gal]
+  * Added api file to debian directory
+
+  [ Robert Manner ]
+  * Fixed compilation warnings
+
+ -- Laszlo Gal <laszlo.gal at blumsoft.eu>  Mon, 21 Jun 2010 12:10:33 +0200
+
+duicontrolpanel (0.8.2) unstable; urgency=low
+
+  * new version
+
+ -- Laszlo Gal <laszlo.gal at blumsoft.eu>  Mon, 20 Jun 2010 10:32:00 +0200
+
+duicontrolpanel (0.8.2~unreleased) unstable; urgency=low
+
+  * new version
+
+ -- Robert Manner <robert.manner at blumsoft.eu>  Thu, 10 Jun 2010 18:50:33 +0200
+
+duicontrolpanel (0.8.1) unstable; urgency=low
+
+  [ Sandor Pinter ]
+  * Enable booster usage, and remove the forking for this
+
+  [ Robert Manner ]
+  * Fixes: NB#172559 - Time and Language UI display some hard coded
+    button (Display language and Keyboard languages)
+
+ -- Robert Manner <robert.manner at blumsoft.eu>  Thu, 10 Jun 2010 18:01:22 +0200
+
+duicontrolpanel (0.8.0) unstable; urgency=low
+
+  [ Sandor Pinter ]
+  * Fixing Coverity issues
+
+  [ Robert Manner ]
+  * Fixes: NB#171520 - The View Menu should not be available on Region
+    format setting view
+  * Adds API for accessing the progress indicator of the page from
+    DcpWidget
+  * Removes the deprecated classes DcpButton* and DcpBriefWidget
+  * 'Applications' category is sorted by applet titles instead of the Order
+    specified in the desktop file (like other categories)
+  * Fixes: NB#169944 - Recently Used list in DCP is sorted improperly
+
+ -- Robert Manner <robert.manner at blumsoft.eu>  Wed, 02 Jun 2010 17:36:26 +0200
+
 duicontrolpanel (0.7.20) unstable; urgency=low
 
   * changelog
--- debian/control
+++ debian/control
@@ -18,12 +18,11 @@
 Depends: libduicontrolpanel (= ${Source-Version}), libmeegotouch-dev (>= 0.20)
 Description: Development files for the control panel application and its applets
 
-# camera-l10n pkg contains the translation for controlpanel, hopefully temporarily
 Package: duicontrolpanel
 Section: x11
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, libduicontrolpanel (= ${Source-Version}),
-         camera-l10n,
+         applauncherd,
          duicontrolpanel-l10n-engineering-english (= ${Source-Version})
 Description: Control Panel
 
@@ -56,6 +55,7 @@
 Package: duicontrolpanel-skeletonapplet
 Section: x11
 Architecture: any
+Replaces: duicontrolpanel-ui-tests
 Depends: ${shlibs:Depends}, ${misc:Depends}, duicontrolpanel, libduicontrolpanel, duicontrolpanel-skeletonapplet-l10n-engineering-english (= ${binary:Version})
 Description: Example applets for duicontrolpanel
   This package contains examples for settings applets created by
--- debian/deb.pri
+++ debian/deb.pri
@@ -20,5 +20,5 @@
 deb.depends = FORCE
 
 
-QMAKE_EXTRA_UNIX_TARGETS += deb 
-QMAKE_EXTRA_UNIX_TARGETS += changelog
+QMAKE_EXTRA_TARGETS += deb 
+QMAKE_EXTRA_TARGETS += changelog
--- debian/duicontrolpanel-skeletonapplet.install
+++ debian/duicontrolpanel-skeletonapplet.install
@@ -1,5 +1,7 @@
 usr/lib/duicontrolpanel/applets/libdcpskeletonapplet.so
+usr/lib/duicontrolpanel/applets/libdcpskelbuttonapplet.so
 usr/lib/duicontrolpanel/skeleton.desktop
+usr/lib/duicontrolpanel/skelbutton.desktop
 usr/share/themes/base/meegotouch/duicontrolpanel/style/skeletonapplet.css
 usr/lib/duicontrolpanel/declexample.desktop
 usr/lib/duicontrolpanel/uidescriptions/example1.xml
--- debian/duicontrolpanel.install
+++ debian/duicontrolpanel.install
@@ -1,4 +1,4 @@
-usr/bin/duicontrolpanel
+usr/bin/duicontrolpanel*
 usr/share/themes/base/meegotouch/duicontrolpanel/style/duicontrolpanel.*
 usr/share/themes/base/meegotouch/duicontrolpanel/images/*
 usr/share/themes/base/meegotouch/duicontrolpanel/svg/*
--- debian/rules
+++ debian/rules
@@ -21,7 +21,11 @@
 endif
 
 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
-    DEBUG = DEFINES+=DEBUG
+    QMAKE_ARG += DEFINES+=DEBUG
+endif
+
+ifneq (,$(findstring nolauncher,$(DEB_BUILD_OPTIONS)))
+    QMAKE_ARG += CONFIG+=DISABLE_LAUNCHER
 endif
 
 configure: configure-stamp
@@ -35,7 +39,7 @@
 build-stamp: configure-stamp 
 	dh_testdir
 
-	DEBIAN_DESTDIR=$(CURDIR)/debian/tmp qmake $(DEBUG)
+	DEBIAN_DESTDIR=$(CURDIR)/debian/tmp qmake $(QMAKE_ARG)
 	DEBIAN_DESTDIR=$(CURDIR)/debian/tmp $(MAKE)
 	touch $@
 
--- declapplet/declapplet.pro
+++ declapplet/declapplet.pro
@@ -1,7 +1,6 @@
 include(../lib/dcpconfig.pri)
 QMAKE_LIBDIR += ../lib/lib/ 
-QMAKE_RPATH = -Wl
-message($$QMAKE_RPATH)
+message($$QMAKE_LFLAGS_RPATH)
 TEMPLATE = lib
 TARGET = lib/declarative
 DEPENDPATH += .
--- examples/binaryapplet/binaryapplet.pro
+++ examples/binaryapplet/binaryapplet.pro
@@ -1,6 +1,7 @@
 TEMPLATE      = subdirs
 
-SUBDIRS += src \
+SUBDIRS += itemlike \
+           buttonlike \
            translations
 
 # for check:
--- examples/binaryapplet/buttonlike
+++ examples/binaryapplet/buttonlike
+(directory)
--- examples/binaryapplet/buttonlike/buttonlike.pro
+++ examples/binaryapplet/buttonlike/buttonlike.pro
+include(../../common.pri)
+TEMPLATE      = lib
+CONFIG       += plugin gui meegotouch silent debug
+
+MOC_DIR	      = .moc
+OBJECTS_DIR   = .objects
+
+HEADERS       = dcpskelbuttonapplet.h \
+                dcpskelbuttonbrief.h
+
+SOURCES       = dcpskelbuttonapplet.cpp \
+                dcpskelbuttonbrief.cpp
+
+css.files     = skelbuttonapplet.css
+DESTDIR       = ../lib
+TARGET        = $$qtLibraryTarget(dcpskelbuttonapplet)
+desktop.files += *.desktop
+desktop.path = $$DCP_DESKTOP_DIR
+target.path += $$DCP_APPLET_DIR
+css.path    += $$DCP_THEME_DIR/style
+
+message("The plugin will be installed to: " $$target.path)
+message("CSS path will be: " $$css.path)
+
+INSTALLS += \
+	    target \
+        css \
+        desktop
+
--- examples/binaryapplet/buttonlike/dcpskelbutton.h
+++ examples/binaryapplet/buttonlike/dcpskelbutton.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef DCPSKELBUTTON_H
+#define DCPSKELBUTTON_H
+namespace DcpSkelButton
+{
+    enum
+     {
+        Main = 0 
+     // Here go ids of more applet pages if any
+     // Page1 = 1,
+     // Page2 = 2,
+    };
+    const int NoReferer = -1;
+}
+#endif // DCPSKELBUTTON_H
--- examples/binaryapplet/buttonlike/dcpskelbuttonapplet.cpp
+++ examples/binaryapplet/buttonlike/dcpskelbuttonapplet.cpp
+#include <QtGui>
+#include <QDebug>
+#include <MAction>
+#include <MTheme>
+#include <DcpWidget>
+#include "dcpskelbuttonapplet.h"
+#include "dcpskelbutton.h"
+#include "dcpskelbuttonbrief.h"
+
+Q_EXPORT_PLUGIN2(skelbuttonapplet, SkelButtonApplet)
+
+void SkelButtonApplet::init()
+{
+    MTheme::loadCSS(QString(CSSDIR) + "skelbuttonapplet.css");
+};
+
+DcpWidget* SkelButtonApplet::constructWidget(int widgetId)
+{
+    // No views for button-like applets by default
+    Q_UNUSED(widgetId);
+    return 0;
+}
+
+QString SkelButtonApplet::title() const
+{
+    //% "SkelButton applet"
+    return qtTrId("dcp_skel_appl_titl");
+}
+
+QVector<MAction*> SkelButtonApplet::viewMenuItems()
+{
+    QVector<MAction*> vector(1);
+    //% "Example action"
+    vector[0] = new MAction(qtTrId("dcp_skel_appl_action"), this);
+    vector[0]->setLocation(MAction::ApplicationMenuLocation);
+    return vector;
+}
+
+DcpBrief* SkelButtonApplet::constructBrief(int)
+{
+    return new SkelButtonBrief();
+}
+
--- examples/binaryapplet/buttonlike/dcpskelbuttonapplet.h
+++ examples/binaryapplet/buttonlike/dcpskelbuttonapplet.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef SKELBUTTONAPPLET_H
+#define SKELBUTTONAPPLET_H
+
+#include <DcpAppletIf>
+#include <QObject>
+class DcpWidget;
+class MAction;
+
+class SkelButtonApplet : public QObject, public DcpAppletIf 
+{
+	Q_OBJECT
+	Q_INTERFACES(DcpAppletIf)
+
+public:
+    virtual void init();
+    virtual DcpWidget* constructWidget(int widgetId);
+    virtual QString title() const;
+    virtual QVector<MAction *> viewMenuItems();
+    virtual DcpBrief* constructBrief(int);
+};
+#endif // SKELBUTTONAPPLET_H
--- examples/binaryapplet/buttonlike/dcpskelbuttonbrief.cpp
+++ examples/binaryapplet/buttonlike/dcpskelbuttonbrief.cpp
+#include <DcpWidgetTypes>
+#include "dcpskelbuttonbrief.h"
+#include <QDebug>
+SkelButtonBrief::SkelButtonBrief():
+    m_ToggleState(true)
+{
+}
+
+QString SkelButtonBrief::valueText() const
+{
+    QString value = m_ToggleState ? "On" : "Off";
+    qDebug() << value;
+    return "value is " + value;
+}
+
+QString SkelButtonBrief::titleText() const
+{
+    return "Button-like applet";
+}
+
+bool SkelButtonBrief::toggle() const
+{
+    return m_ToggleState;
+}
+
+void SkelButtonBrief::setToggle (bool toggle)
+{
+    m_ToggleState = toggle;
+    emit valuesChanged();
+}
+
+int SkelButtonBrief::widgetTypeID() const
+{
+    return DcpWidgetType::Button;
+}
+
--- examples/binaryapplet/buttonlike/dcpskelbuttonbrief.h
+++ examples/binaryapplet/buttonlike/dcpskelbuttonbrief.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef SKELBUTTONBRIEF_H
+#define SKELBUTTONBRIEF_H
+
+#include <DcpBrief>
+
+class SkelButtonBrief: public DcpBrief{
+    Q_OBJECT
+public:
+    SkelButtonBrief();
+    virtual QString valueText() const;
+    virtual QString titleText() const;
+
+    virtual bool toggle() const;
+    virtual void setToggle (bool toggle);
+    virtual int widgetTypeID() const;
+
+private:
+    bool m_ToggleState;
+};
+
+
+#endif // SKELBUTTONBRIEF
--- examples/binaryapplet/buttonlike/skelbutton.desktop
+++ examples/binaryapplet/buttonlike/skelbutton.desktop
+[Desktop Entry]
+Type=DUIApplet
+Name=SkelButton
+Icon=
+Exec=
+X-logical-id=qtn_sett_main_display
+X-translation-catalog=duicontrolpanel-skeletonapplet
+
+[DUI]
+X-DUIApplet-Applet=libdcpskelbuttonapplet.so
+X-DUIApplet-ImageLandscape=Widget_landscape_weather.png
+X-DUIApplet-ImagePortrait=Widget_portrait_weather.png
+
+[DCP]
+Category= Look & Feel
+Order=4
+WidgetType= Button
+
--- examples/binaryapplet/buttonlike/skelbuttonapplet.css
+++ examples/binaryapplet/buttonlike/skelbuttonapplet.css
(renamed from examples/binaryapplet/src/skeletonapplet.css)
--- examples/binaryapplet/itemlike
+++ examples/binaryapplet/itemlike
+(directory)
--- examples/binaryapplet/itemlike/dcpskeleton.h
+++ examples/binaryapplet/itemlike/dcpskeleton.h
(renamed from examples/binaryapplet/src/dcpskeleton.h)
--- examples/binaryapplet/itemlike/dcpskeletonapplet.cpp
+++ examples/binaryapplet/itemlike/dcpskeletonapplet.cpp
(renamed from examples/binaryapplet/src/dcpskeletonapplet.cpp)
--- examples/binaryapplet/itemlike/dcpskeletonapplet.h
+++ examples/binaryapplet/itemlike/dcpskeletonapplet.h
(renamed from examples/binaryapplet/src/dcpskeletonapplet.h)
--- examples/binaryapplet/itemlike/dcpskeletonbrief.cpp
+++ examples/binaryapplet/itemlike/dcpskeletonbrief.cpp
(renamed from examples/binaryapplet/src/dcpskeletonbrief.cpp)
--- examples/binaryapplet/itemlike/dcpskeletonbrief.h
+++ examples/binaryapplet/itemlike/dcpskeletonbrief.h
(renamed from examples/binaryapplet/src/dcpskeletonbrief.h)
--- examples/binaryapplet/itemlike/dcpskeletonwidget.cpp
+++ examples/binaryapplet/itemlike/dcpskeletonwidget.cpp
+#include "dcpskeletonwidget.h"
+#include "dcpskeleton.h"
+#include <mlayout.h>
+#include <mlinearlayoutpolicy.h>
+#include <mlabel.h>
+#include <QTimer>
+
+SkeletonWidget::SkeletonWidget(QGraphicsWidget *parent)
+	    :DcpWidget(parent)
+{
+    setReferer(DcpSkeleton::NoReferer);
+    initWidget();
+
+    // this demonstrates the usage of the progress indicator:
+    setProgressIndicatorVisible (true);
+    QTimer::singleShot ( 3000, this, SLOT(loadingFinished()) );
+}
+
+void
+SkeletonWidget::loadingFinished()
+{
+    setProgressIndicatorVisible (false);
+}
+
+SkeletonWidget::~SkeletonWidget()
+{
+}
+
+
+void SkeletonWidget::initWidget()
+{
+    MLayout *mainLayout = new MLayout(this);
+    mainLayout->setAnimation(0);
+    MLinearLayoutPolicy *mainLayoutPolicy =
+            new MLinearLayoutPolicy(mainLayout, Qt::Horizontal);
+    mainLayout->setPolicy(mainLayoutPolicy);
+	
+    //% "This is a skeleton applet, a minimal binaryapplet for controlpanel"
+	m_aboutLabel = new MLabel(qtTrId("dcp_skel_appl_label"), this);
+	m_aboutLabel->setObjectName("LabelAbout");
+	
+	mainLayoutPolicy->addItem(m_aboutLabel, Qt::AlignLeft);
+    setLayout(mainLayout);
+}
+
--- examples/binaryapplet/itemlike/dcpskeletonwidget.h
+++ examples/binaryapplet/itemlike/dcpskeletonwidget.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef SKELETONWIDGET_H
+#define SKELETONWIDGET_H
+
+#include <DcpWidget>
+
+class MLabel;
+
+class SkeletonWidget : public DcpWidget
+{
+    Q_OBJECT
+
+public:
+    SkeletonWidget(QGraphicsWidget *parent = 0);
+    virtual ~SkeletonWidget();
+
+protected:
+    void initWidget();
+
+protected slots:
+    void loadingFinished();
+
+private:
+    MLabel *m_aboutLabel;
+};
+
+#endif // SKELETONWIDGET_H
+
--- examples/binaryapplet/itemlike/itemlike.pro
+++ examples/binaryapplet/itemlike/itemlike.pro
(renamed from examples/binaryapplet/src/src.pro)
--- examples/binaryapplet/itemlike/skeleton.desktop
+++ examples/binaryapplet/itemlike/skeleton.desktop
(renamed from examples/binaryapplet/src/skeleton.desktop)
--- examples/binaryapplet/itemlike/skeletonapplet.css
+++ examples/binaryapplet/itemlike/skeletonapplet.css
+#LabelAbout {
+        color: #FFFFFF;
+        font: "Nokia Sans Cn" 16;
+}
+
--- examples/binaryapplet/src
+++ examples/binaryapplet/src
-(directory)
--- examples/binaryapplet/src/dcpskeleton.h
+++ examples/binaryapplet/src/dcpskeleton.h
(renamed to examples/binaryapplet/itemlike/dcpskeleton.h)
--- examples/binaryapplet/src/dcpskeletonapplet.cpp
+++ examples/binaryapplet/src/dcpskeletonapplet.cpp
(renamed to examples/binaryapplet/itemlike/dcpskeletonapplet.cpp)
--- examples/binaryapplet/src/dcpskeletonapplet.h
+++ examples/binaryapplet/src/dcpskeletonapplet.h
(renamed to examples/binaryapplet/itemlike/dcpskeletonapplet.h)
--- examples/binaryapplet/src/dcpskeletonbrief.cpp
+++ examples/binaryapplet/src/dcpskeletonbrief.cpp
(renamed to examples/binaryapplet/itemlike/dcpskeletonbrief.cpp)
--- examples/binaryapplet/src/dcpskeletonbrief.h
+++ examples/binaryapplet/src/dcpskeletonbrief.h
(renamed to examples/binaryapplet/itemlike/dcpskeletonbrief.h)
--- examples/binaryapplet/src/dcpskeletonwidget.cpp
+++ examples/binaryapplet/src/dcpskeletonwidget.cpp
-#include "dcpskeletonwidget.h"
-#include "dcpskeleton.h"
-#include <mlayout.h>
-#include <mlinearlayoutpolicy.h>
-#include <mlabel.h>
-
-SkeletonWidget::SkeletonWidget(QGraphicsWidget *parent)
-	    :DcpWidget(parent)
-{
-    setReferer(DcpSkeleton::NoReferer);
-    initWidget();
-}
-
-SkeletonWidget::~SkeletonWidget()
-{
-}
-
-
-void SkeletonWidget::initWidget()
-{
-    MLayout *mainLayout = new MLayout(this);
-    mainLayout->setAnimation(0);
-    MLinearLayoutPolicy *mainLayoutPolicy =
-            new MLinearLayoutPolicy(mainLayout, Qt::Horizontal);
-    mainLayout->setPolicy(mainLayoutPolicy);
-	
-    //% "This is a skeleton applet, a minimal binaryapplet for controlpanel"
-	m_aboutLabel = new MLabel(qtTrId("dcp_skel_appl_label"), this);
-	m_aboutLabel->setObjectName("LabelAbout");
-	
-	mainLayoutPolicy->addItem(m_aboutLabel, Qt::AlignLeft);
-    setLayout(mainLayout);
-}
-
--- examples/binaryapplet/src/dcpskeletonwidget.h
+++ examples/binaryapplet/src/dcpskeletonwidget.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef SKELETONWIDGET_H
-#define SKELETONWIDGET_H
-
-#include <DcpWidget>
- 
-class MLabel;
-
-class SkeletonWidget : public DcpWidget 
-{
-	Q_OBJECT
-		
-public:
-	SkeletonWidget(QGraphicsWidget *parent = 0);
-	virtual ~SkeletonWidget();
-
-protected:
-	void initWidget();
-		
-private:
-	MLabel    *m_aboutLabel;
-		
-};
-#endif // SKELETONWIDGET_H
--- examples/binaryapplet/src/skeleton.desktop
+++ examples/binaryapplet/src/skeleton.desktop
(renamed to examples/binaryapplet/itemlike/skeleton.desktop)
--- examples/binaryapplet/src/skeletonapplet.css
+++ examples/binaryapplet/src/skeletonapplet.css
(renamed to examples/binaryapplet/buttonlike/skelbuttonapplet.css)
--- examples/binaryapplet/src/src.pro
+++ examples/binaryapplet/src/src.pro
(renamed to examples/binaryapplet/itemlike/itemlike.pro)
--- examples/binaryapplet/translations/translations.pro
+++ examples/binaryapplet/translations/translations.pro
@@ -1,7 +1,7 @@
 LANGUAGES = # empty, means to build only engineering English
 CATALOGNAME = duicontrolpanel-skeletonapplet
 #SOURCEDIR = $$PWD/../src
-SOURCEDIR = ../src
+SOURCEDIR = ../itemlike
 TRANSLATIONDIR = $$PWD
 TRANSLATION_INSTALLDIR = /usr/share/l10n/meegotouch
 include(../../translations.pri)
--- lib/dcpconfig.pri
+++ lib/dcpconfig.pri
@@ -3,7 +3,7 @@
 # some hack for some problems experienced before
 {
 	QMAKE_CXXFLAGS_RELEASE += -g                                                                                                                       
-	QMAKE_RPATH = -Wl
+	QMAKE_LFLAGS_RPATH = -Wl
 }
 
 # Directories
--- lib/doc/doc.pri
+++ lib/doc/doc.pri
@@ -2,7 +2,7 @@
 # DOXYGEN_BIN=$$findFile(doxygen)
 DOXYGEN_BIN=doxygen
 
-QMAKE_EXTRA_UNIX_TARGETS += doc
+QMAKE_EXTRA_TARGETS += doc
 doc.target = doc
 isEmpty(DOXYGEN_BIN) {
     doc.commands = @echo "Unable to detect doxygen in PATH"
--- lib/doc/src/news.dox
+++ lib/doc/src/news.dox
@@ -1,5 +1,13 @@
 /*! \page news What's New in DuiControlPanel
 
+\section v080 0.8.0
+\subsection new New features
+- New signal #DcpWidget::setProgressIndicatorVisible for accessing the progress
+  indicator of the page.
+\subsection rem Removed
+- Removed the already deprecated DcpBriefWidget, DcpButton, DcpButtonAlign,
+  DcpButtonToggle, DcpButtonImage
+
 \section v0719 0.7.19
 
 \subsection deprec Deprecated
--- lib/src/appletdb/dcpappletdb.cpp
+++ lib/src/appletdb/dcpappletdb.cpp
@@ -26,15 +26,21 @@
 #include <QDir>
 #include <QDebug>
 #include <MLocale>
+#include <MGConfItem>
 
 #include "dcpdebug.h"
 
 const QString AppletFilter = "*.desktop";
 DcpAppletDb* DcpAppletDbPrivate::sm_Instance = 0;
 
-DcpAppletDbPrivate::DcpAppletDbPrivate()
+static const QString lastUsedAppletKey = QString(MOSTUSEDCOUNTER_GCONFKEY) +
+                                         "/lastUsed";
+
+
+DcpAppletDbPrivate::DcpAppletDbPrivate():
+    hasUniqueMetadata (false)
 {
-    hasUniqueMetadata = false;
+
 }
 
 
@@ -49,10 +55,25 @@
 {
     if (!pathName.isEmpty())
         addFiles (pathName, nameFilter);
+
+    // try to restore the last used applet:
+    QString fileName = MGConfItem(lastUsedAppletKey).value ().toString ();
+    if (d_ptr->appletsByFile.contains (fileName)) {
+        DcpAppletMetadata::setLastUsed (d_ptr->appletsByFile.value (fileName));
+    }
 }
 
 DcpAppletDb::~DcpAppletDb()
 {
+    // store the last used applet:
+    DcpAppletMetadata* lastUsed = DcpAppletMetadata::lastUsed();
+    if (lastUsed) {
+        MGConfItem(lastUsedAppletKey).set (lastUsed->fileName());
+    }
+
+    // free up metadatas and applets
+    destroyData();
+
     delete d_ptr;
 }
 
@@ -84,7 +105,6 @@
         return;
     }
 
-    DcpAppletDbPrivate::sm_Instance->destroyData();
     delete DcpAppletDbPrivate::sm_Instance;
     DcpAppletDbPrivate::sm_Instance = 0;
 }
@@ -169,10 +189,28 @@
     return d_ptr->appletsByFile.values();
 }
 
+
+/*
+ * Categories should be ordered by the way it is specified in their
+ * desktop files, except the applications category, which should be ordered
+ * by the name of the items
+ */
+static void sortACategory (QList<DcpAppletMetadata*>& filtered,
+                           const QString& category)
+{
+    // FIXME: quick solution, we should remove this magic word and
+    //        export the category names (?)
+    qSort(filtered.begin(), filtered.end(),
+          category == "qtn_sett_main_application" ?
+                      DcpAppletMetadata::nameLessThan :
+                      DcpAppletMetadata::orderLessThan
+         );
+}
+
 /*!
  *
  */
-DcpAppletMetadataList 
+DcpAppletMetadataList
 DcpAppletDb::listByCategory (
         const QString &category)
 {
@@ -189,7 +227,7 @@
         }
     }
 
-    qSort(filtered.begin(), filtered.end(), DcpAppletMetadata::orderLessThan);
+    sortACategory (filtered, category);
     return filtered;
 }
 
@@ -243,7 +281,7 @@
         }
     }
 
-    qSort (filtered.begin(), filtered.end(), DcpAppletMetadata::orderLessThan);
+    sortACategory (filtered, n_categories > 0 ? category[0] : QString());
     return filtered;
 }
 
@@ -251,16 +289,27 @@
 DcpAppletDb::listMostUsed ()
 {
     DcpAppletMetadataList mostUsed;
+    DcpAppletMetadata* lastUsed = DcpAppletMetadata::lastUsed();
 
     for (QMap<QString, DcpAppletMetadata*>::iterator iter =
-            d_ptr->appletsByName.begin(); iter != d_ptr->appletsByName.end(); iter++)
-        if (iter.value()->usage())
+            d_ptr->appletsByName.begin(); iter != d_ptr->appletsByName.end();
+            iter++)
+    {
+        // we skip not used items, and also the last used item
+        // (to avoid duplication)
+        if (iter.value()->usage() && iter.value() != lastUsed)
             mostUsed.push_back(iter.value());
+    }
 
    qSort (mostUsed.begin(), mostUsed.end(), 
-           DcpAppletMetadata::usageGreatherThan); 
+           DcpAppletMetadata::usageGreatherThan);
 
-   return mostUsed.mid (0, DcpApplet::MaxMostUsed);
+   // last clicked item should be the first item (see bug NB#169944)
+   if (lastUsed) {
+        mostUsed.prepend (lastUsed);
+   }
+   mostUsed = mostUsed.mid (0, DcpApplet::MaxMostUsed);
+   return mostUsed;
 }
 
 
@@ -283,6 +332,7 @@
         {
             obj = new DcpAppletObject(metadata);
             d_ptr->appletObjectsByName[name] = obj;
+            emit appletLoaded (obj);
         }
         else
             qWarning() << "No such applet:" << name;
--- lib/src/appletdb/dcpappletdb.h
+++ lib/src/appletdb/dcpappletdb.h
@@ -19,6 +19,8 @@
 /* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
 #ifndef DCPAPPLETDB_H
 #define DCPAPPLETDB_H
+
+#include <QObject>
 #include <QList>
 #include <QMap>
 #include <QString>
@@ -41,8 +43,9 @@
 typedef bool (*checkCategory)(const QString &);
 
 class DcpAppletDbPrivate;
-class DcpAppletDb
+class DcpAppletDb: public QObject
 {
+    Q_OBJECT
 public:
     /*!
      * \brief Gives back the db instance
@@ -107,13 +110,16 @@
     void destroyData (void);
     static void destroy (void);
 
+signals:
+    void appletLoaded (DcpAppletObject *applet);
+
 protected:
     /*! \brief protected constructor for singleton*/
     DcpAppletDb (const QString &pathName, const QString &nameFilter);
 
 private:
     DcpAppletDbPrivate *const d_ptr;
-    Q_DISABLE_COPY(DcpAppletDb);  
+    Q_DISABLE_COPY(DcpAppletDb);
     friend class Ut_DcpAppletDb;
 };
 #endif // DCPAPPLETDB_H
--- lib/src/appletdb/dcpappletif.h
+++ lib/src/appletdb/dcpappletif.h
@@ -94,7 +94,7 @@
      * the interface the plugin was compiled with. It lets controlpanel
      * extend the interface without the need to recompile all applets.
      */
-    virtual int interfaceVersion() { return 3; }
+    virtual int interfaceVersion() { return 4; }
 };
 
 Q_DECLARE_INTERFACE (DcpAppletIf, "com.nokia.m.core.DcpAppletIf/1.0")
--- lib/src/appletdb/dcpappletmetadata.cpp
+++ lib/src/appletdb/dcpappletmetadata.cpp
@@ -17,7 +17,6 @@
 
 /* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
 /* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#include <MLocale>
 
 #include "dcpappletmetadata.h"
 #include "dcpappletmetadata_p.h"
@@ -27,6 +26,10 @@
 
 #include "dcpdebug.h"
 
+#include <MLocale>
+#include <mcollator.h>
+
+DcpAppletMetadata* DcpAppletMetadataPrivate::sm_LastUsed = 0;
 
 DcpAppletMetadataPrivate::DcpAppletMetadataPrivate ()
     :
@@ -297,6 +300,7 @@
     MostUsedCounter::instance()->incrementUsageCount (
             QFileInfo(fileName()).baseName()
     );
+    setLastUsed (this);
 }
 
 MDesktopEntry *
@@ -341,6 +345,15 @@
 }
 
 bool 
+DcpAppletMetadata::nameLessThan (
+        DcpAppletMetadata *meta1,
+        DcpAppletMetadata *meta2)
+{
+    return MCollator::compare (meta1->name (), meta2->name ())
+            == MLocale::LessThan;
+}
+
+bool 
 DcpAppletMetadata::usageGreatherThan (
         DcpAppletMetadata *meta1,
         DcpAppletMetadata *meta2)
@@ -407,4 +420,16 @@
     return d_ptr->m_Activated;
 }
 
+/*! \brief Returns the last openned applet's metadata
+ */
+DcpAppletMetadata* DcpAppletMetadata::lastUsed ()
+{
+    return DcpAppletMetadataPrivate::sm_LastUsed;
+}
+
+void DcpAppletMetadata::setLastUsed (DcpAppletMetadata* metadata)
+{
+    DcpAppletMetadataPrivate::sm_LastUsed = metadata;
+}
+
 
--- lib/src/appletdb/dcpappletmetadata.h
+++ lib/src/appletdb/dcpappletmetadata.h
@@ -24,12 +24,6 @@
 #include <QObject>
 #include <QString>
 
-/*
- * This macro shows that the DcpAppletLoader is deprecated, not available any
- * more. FIXME: This macro has to be removed sooner or later.
- */
-#define DCP_APPLET_LOADER_DEPRECATED 1
-
 class MDesktopEntry;
 class DcpAppletMetadataPrivate;
 
@@ -95,13 +89,22 @@
             DcpAppletMetadata *meta1,
             DcpAppletMetadata *meta2);
 
-    bool isDisabled () const;
+    static bool nameLessThan (
+            DcpAppletMetadata *meta1,
+            DcpAppletMetadata *meta2);
+
+     bool isDisabled () const;
     void setDisabled (bool disabled);
 
     void markActive();
     void markInactive();
     bool isActive() const;
 
+    /*! gets the last openned applet */
+    static DcpAppletMetadata* lastUsed ();
+    /*! sets the last openned applet */
+    static void setLastUsed (DcpAppletMetadata* metadata);
+
 protected:
     MDesktopEntry* desktopEntry () const;
     QString desktopEntryStr (int id) const;
--- lib/src/appletdb/dcpappletmetadata_p.h
+++ lib/src/appletdb/dcpappletmetadata_p.h
@@ -36,6 +36,7 @@
     QString m_FileName;
     bool m_Disabled;
     int m_Activated;
+    static DcpAppletMetadata* sm_LastUsed;
 };
 
 enum  {
--- lib/src/appletdb/dcpappletobject.cpp
+++ lib/src/appletdb/dcpappletobject.cpp
@@ -33,8 +33,10 @@
 
 
 
-DcpAppletObjectPrivate::DcpAppletObjectPrivate ()
-    : m_Brief (0)
+DcpAppletObjectPrivate::DcpAppletObjectPrivate ():
+    applet(0),
+    m_Brief (0),
+    m_Metadata(0)
 {
 }
 
@@ -79,6 +81,9 @@
         } else {
             /* FIXME: for supporting old api,
              * please remove ones deprecated ids are removed */
+            DCP_WARNING ("%s: brief->widgetTypeID () returned a DEPRECATED id"
+                         ", please use DcpWidgetType::Label or "
+                         "DcpWidgetType::Image instead", qPrintable(text1()));
             switch (retval) {
                 case DCPLABELBUTTON:
                 case DCPLABEL2BUTTON:
--- lib/src/appletdb/dcpappletobject_p.h
+++ lib/src/appletdb/dcpappletobject_p.h
@@ -30,5 +30,6 @@
     DcpBrief* m_Brief;
     DcpAppletMetadata *m_Metadata;
 };
+
 #endif // DCPAPPLETOBJECT_P_H
 
--- lib/src/appletdb/dcpwidget.cpp
+++ lib/src/appletdb/dcpwidget.cpp
@@ -24,7 +24,8 @@
 
 
 DcpWidgetPrivate::DcpWidgetPrivate ():
-    m_WidgetId (-1)
+    m_WidgetId (-1),
+    isProgressIndicatorVisible (false)
 {
 }
 
@@ -125,3 +126,15 @@
     return QString();
 }
 
+void DcpWidget::setProgressIndicatorVisible(bool visible)
+{
+    d_ptr->isProgressIndicatorVisible = visible;
+    emit inProgress (visible);
+}
+
+bool DcpWidget::isProgressIndicatorVisible() const
+{
+    return d_ptr->isProgressIndicatorVisible;
+}
+
+
--- lib/src/appletdb/dcpwidget.h
+++ lib/src/appletdb/dcpwidget.h
@@ -93,6 +93,31 @@
      * Name of the applet specified in the applet's desktop file.
      */
     virtual QString title() const;
+
+public slots:
+    /*!
+     * \brief Show a progress indicator
+     *
+     * With this function the widget can show a progress indicator
+     * indicating that a longer operation is running.
+     * Same as calling MApplicationPage::setProgressIndicatorVisible.
+     *
+     * \param visible   If true, the progress indicator becomes visible.
+     *                  If false, it will become hidden.
+     */
+    void setProgressIndicatorVisible (bool visible);
+
+public:
+    bool isProgressIndicatorVisible () const;
+
+signals:
+    /*!
+     * \brief Emitted when #setProgressIndicatorVisible gets called
+     *
+     * \param isInProgress If true, the progress indicator becomes visible.
+     *                     If false, it will become hidden.
+     */
+    void inProgress (bool isInProgress);
 };
 
 #endif
--- lib/src/appletdb/dcpwidget_p.h
+++ lib/src/appletdb/dcpwidget_p.h
@@ -21,5 +21,6 @@
 public:
     DcpWidgetPrivate ();
     int m_WidgetId;
+    bool isProgressIndicatorVisible;
 };
 #endif //DCPWIDGETPRIVATE_H 
--- lib/src/appletdb/dcpwrongapplets.cpp
+++ lib/src/appletdb/dcpwrongapplets.cpp
@@ -154,6 +154,7 @@
     raise (signum);
 }
 
+
 /*******************************************************************************
  * Other parts of the code.
  */
@@ -161,6 +162,23 @@
 {
     //Q_ASSERT (false);
     DCP_DEBUG ("");
+
+    // on dcp timestamp change, remove the list of bad applets
+    removeBadsOnDcpTimeStampChange();
+
+    // init cache:
+    m_BadApplets = queryBadApplets();
+}
+
+DcpWrongApplets::~DcpWrongApplets ()
+{
+}
+
+// this had to be separated from the constructor, because
+// the constructor has to be run after MApplication creation
+// and connecting the signals should be before it
+void DcpWrongApplets::connectSupervisorSignals()
+{
     if (!sm_Disabled) {
         signal (SIGTERM, termination_signal_handler);
         signal (SIGHUP,  termination_signal_handler);
@@ -173,16 +191,6 @@
         signal (SIGABRT, termination_signal_handler);
         signal (SIGFPE,  termination_signal_handler);
     }
-
-    // on dcp timestamp change, remove the list of bad applets
-    removeBadsOnDcpTimeStampChange();
-
-    // init cache:
-    m_BadApplets = queryBadApplets();
-}
-
-DcpWrongApplets::~DcpWrongApplets ()
-{
 }
 
 
--- lib/src/appletdb/dcpwrongapplets.h
+++ lib/src/appletdb/dcpwrongapplets.h
@@ -38,6 +38,7 @@
 Q_OBJECT
 
 public:
+    static void connectSupervisorSignals();
     static DcpWrongApplets* instance ();
     static void destroyInstance();
     static void disable();
--- lib/src/dcpretranslator.cpp
+++ lib/src/dcpretranslator.cpp
@@ -18,6 +18,7 @@
 /* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
 /* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
 #include "dcpretranslator.h"
+#include "dcpretranslator_p.h"
 
 #include <MLocale>
 #include <MGConfItem>
@@ -35,19 +36,7 @@
  * in some cases. */
 static const QString NO_LANGUAGE_IS_LOADED_YET = "***";
 
-class DcpRetranslatorPriv {
-public:
-    DcpRetranslatorPriv();
-
-    QString lastLanguage;
-    QSet<QString> loadedTranslations;
-    static DcpRetranslator* instance;
-    static bool compatibleMode;
-    QString binaryName;
-};
-
 DcpRetranslator* DcpRetranslatorPriv::instance = 0;
-bool DcpRetranslatorPriv::compatibleMode = true;
 
 DcpRetranslatorPriv::DcpRetranslatorPriv ():
     lastLanguage (NO_LANGUAGE_IS_LOADED_YET)
@@ -58,11 +47,6 @@
 
 DcpRetranslator::DcpRetranslator (): priv(new DcpRetranslatorPriv())
 {
-    if (DcpRetranslatorPriv::compatibleMode) {
-        // load the translations of the applets:
-        DcpAppletDb *db = DcpAppletDb::instance();
-        ensureTranslationsAreLoaded(db->list());
-    }
 }
 
 /*
@@ -98,16 +82,14 @@
     QString binaryName = priv->binaryName;
     DCP_DEBUG("%s %s", qPrintable(binaryName), qPrintable(language));
 
-    // install engineering english
-    locale.installTrCatalog(binaryName + ".qm");
-    // install real translation
+    // install translation
     locale.installTrCatalog("common");
     locale.installTrCatalog(binaryName);
 
     // load the translations of the active applets:
     DcpAppletDb *db = DcpAppletDb::instance();
     foreach (DcpAppletMetadata* metadata, db->list()) {
-        if (metadata->isActive() || DcpRetranslatorPriv::compatibleMode) {
+        if (metadata->isActive()) {
             loadAppletTranslation (locale, metadata);
         }
     }
@@ -137,13 +119,10 @@
     if (catalog.isEmpty() ) return false;
 
     /* Do not load the translation if it is already loaded
-     * In compatible mode (for suw), it is skipped.
      */
-    if (!DcpRetranslatorPriv::compatibleMode &&
-        priv->loadedTranslations.contains(catalog)) return false;
+    if (priv->loadedTranslations.contains(catalog)) return false;
 
-    locale.installTrCatalog(catalog + ".qm"); // install engineering english
-    locale.installTrCatalog(catalog); // install real translation, if any
+    locale.installTrCatalog(catalog); // install translation, if any
 
     // mark it as loaded:
     priv->loadedTranslations.insert(catalog);
@@ -201,9 +180,8 @@
 DcpRetranslator*
 DcpRetranslator::instance()
 {
-    if (DcpRetranslatorPriv::instance == NULL)
+    if (!DcpRetranslatorPriv::instance)
     {
-        DcpRetranslatorPriv::compatibleMode = false;
         DcpRetranslatorPriv::instance = new DcpRetranslator();
     }
     return DcpRetranslatorPriv::instance;
--- lib/src/dcpretranslator.h
+++ lib/src/dcpretranslator.h
@@ -40,7 +40,6 @@
     Q_OBJECT
 public:
     static DcpRetranslator* instance();
-    DcpRetranslator(); // FIXME, this is deprecated, only for compatibility, suw uses it
 
     void setMainCatalogName (const QString& catalogName);
     void ensureTranslationsAreLoaded(const DcpAppletMetadataList& list);
@@ -50,10 +49,12 @@
    void retranslate();
 
 protected:
+    DcpRetranslator();
     bool loadAppletTranslation (
             MLocale               &locale,
             const DcpAppletMetadata *metadata);
     class DcpRetranslatorPriv* priv;
+    friend class Ut_DcpRetranslator;
 };
 
 #endif
--- lib/src/dcpretranslator_p.h
+++ lib/src/dcpretranslator_p.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
+#ifndef DCPRETRANSLATOR_P_H
+#define DCPRETRANSLATOR_P_H
+#include <QSet>
+
+class DcpRetranslatorPriv {
+public:
+    DcpRetranslatorPriv();
+
+    QString lastLanguage;
+    QSet<QString> loadedTranslations;
+    static DcpRetranslator* instance;
+    QString binaryName;
+};
+#endif // DCPRETRANSLATOR_P_H
+
+
--- lib/src/duicontrolpanel.prf
+++ lib/src/duicontrolpanel.prf
@@ -1,6 +1,6 @@
 include($$[QT_INSTALL_DATA]/mkspecs/dcpconfig.pri)
 
-QMAKE_RPATH = -Wl
+QMAKE_LFLAGS_RPATH = -Wl
 
 # extending include path
 INCLUDEPATH += $$DCP_INSTALL_HEADERS
--- lib/src/include/DcpBriefWidget
+++ lib/src/include/DcpBriefWidget
-#include "dcpbriefwidget.h"
--- lib/src/include/DcpButton
+++ lib/src/include/DcpButton
-#include "dcpbutton.h"
--- lib/src/include/DcpButtonAlign
+++ lib/src/include/DcpButtonAlign
-#include "dcpbuttonalign.h"
--- lib/src/include/DcpButtonImage
+++ lib/src/include/DcpButtonImage
-#include "dcpbuttonimage.h"
--- lib/src/include/DcpButtonToggle
+++ lib/src/include/DcpButtonToggle
-#include "dcpbuttontoggle.h"
--- lib/src/include/DcpContentButton
+++ lib/src/include/DcpContentButton
+#include "dcpcontentbutton.h"
--- lib/src/include/dcpbriefwidget.h
+++ lib/src/include/dcpbriefwidget.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "../widget/dcpbriefwidget.h"
--- lib/src/include/dcpbutton.h
+++ lib/src/include/dcpbutton.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "../widget/dcpbutton.h"
--- lib/src/include/dcpbuttonalign.h
+++ lib/src/include/dcpbuttonalign.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "../widget/dcpbuttonalign.h"
--- lib/src/include/dcpbuttonimage.h
+++ lib/src/include/dcpbuttonimage.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "../widget/dcpbuttonimage.h"
--- lib/src/include/dcpbuttontoggle.h
+++ lib/src/include/dcpbuttontoggle.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include "../widget/dcpbuttontoggle.h"
--- lib/src/include/dcpcontentbutton.h
+++ lib/src/include/dcpcontentbutton.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+#include "../widget/dcpcontentbutton.h"
--- lib/src/src.pro
+++ lib/src/src.pro
@@ -3,7 +3,7 @@
 INCLUDEPATH  += $$system(find ./ -type d)
 MOC_DIR	      = .moc
 OBJECTS_DIR   = .objects
-QMAKE_RPATH = -Wl
+QMAKE_LFLAGS_RPATH = -Wl
 include(../dcpconfig.pri)
 
 # this has to be above finds, because it generates .h .cpp files
--- lib/src/widget/dcpbriefwidget.cpp
+++ lib/src/widget/dcpbriefwidget.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-
-#include "dcpbriefwidget.h"
-#include "dcpappletobject.h"
-#include "dcpappletmetadata.h"
-#include "dcpwidgettypes.h"
-#include "dcpbutton.h"
-#include "dcpbuttontoggle.h"
-#include "dcpbuttonimage.h"
-#include "dcpwrongapplets.h"
-
-#include <MSceneManager>
-#include <QGraphicsLinearLayout>
-#include <QtDebug>
-
-#include "dcpdebug.h"
-
-/******************************************************************************
- * Private data class for the DcpWidget class.
- */
-class DcpBriefWidgetPrivate {
-public:
-    DcpBriefWidgetPrivate ();
-
-    DcpButton *m_RealWidget;
-    DcpAppletObject *m_Applet;
-    bool m_Hidden;
-};
-
-DcpBriefWidgetPrivate::DcpBriefWidgetPrivate ():
-    m_RealWidget (0), 
-    m_Applet (0), 
-    m_Hidden (true)
-{
-}
-
-
-/******************************************************************************
- * Stuff for the DcpBriefWidget class.
- */
-DcpBriefWidget::DcpBriefWidget (
-        DcpAppletObject *applet, 
-        MWidget         *parent):
-    MWidget (parent), 
-    d_ptr (new DcpBriefWidgetPrivate)
-{
-    QGraphicsLinearLayout* layout;
-    
-    layout = new QGraphicsLinearLayout (this);
-    layout->setContentsMargins (0, 0, 0, 0);
-
-    setApplet (applet);
-}
-
-DcpBriefWidget::DcpBriefWidget (
-        int               widgetTypeId,
-        const QString    &line1,
-        const QString    &line2,
-        MWidget        *parent):
-    MWidget (parent),
-    d_ptr (new DcpBriefWidgetPrivate)
-{
-    DcpButton    *toggle;
-    QGraphicsLinearLayout* wlayout = new QGraphicsLinearLayout (this);
-    wlayout->setContentsMargins (0, 0, 0, 0);
-
-    /*
-     * FIXME: I mean unused argument.
-     * All this contructor seems strange, dcpbriefwidget would be about
-     * interaction between the applet and the DcpButtons, consider
-     * using DcpButton directly instead of this
-     *
-     */
-    //DCP_WARNING ("Unsupported widget type: %d", widgetTypeId);
-    Q_UNUSED(widgetTypeId);
-
-    toggle = new DcpButton (this);
-    d_ptr->m_RealWidget = toggle;
-    d_ptr->m_RealWidget->setText1 (line1);
-    d_ptr->m_RealWidget->setText2 (line2);
-    ((QGraphicsLinearLayout*) layout())->addItem (d_ptr->m_RealWidget);
-}
-
-
-DcpBriefWidget::~DcpBriefWidget ()
-{
-    delete d_ptr;
-}
-
-
-/*
- * Constructs the content of the DcpBriefWidget according to the widget type.
- * This is a separate code so the inherited classes might use other code,
- * possibly without any information about the applet variant. This way we can
- * implement internal brief widgets also.
- */
-void
-DcpBriefWidget::constructRealWidget (int widgetTypeId)
-{
-    switch (widgetTypeId) {
-        case DcpWidgetType::Toggle:
-            DCP_DEBUG ("### DcpWidgetType::Toggle ###");
-            d_ptr->m_RealWidget = constructToggle (d_ptr->m_Applet);
-            break;
-
-        case DcpWidgetType::Image:
-            DCP_DEBUG ("### DcpWidgetType::Image ###");
-            d_ptr->m_RealWidget = constructImage (d_ptr->m_Applet);
-            break;
-
-        default:
-            DCP_DEBUG ("### DcpWidgetType::Label ###");
-            d_ptr->m_RealWidget = new DcpButton (this);
-            break;
-    }
-
-
-    if (d_ptr->m_RealWidget) {
-        retranslateUi ();
-        ((QGraphicsLinearLayout*) layout())->addItem (d_ptr->m_RealWidget);
-    }
-}
-
-DcpAppletObject *
-DcpBriefWidget::applet() const
-{
-    return d_ptr->m_Applet;
-}
-
-void 
-DcpBriefWidget::setApplet (
-        DcpAppletObject *applet)
-{
-    // can be optimized if necessery (not recreating the widget, just updating 
-    // its contents)
-    if (d_ptr->m_RealWidget) 
-        d_ptr->m_RealWidget->deleteLater();
-
-    /*
-     * If we had an old applet object. Not a fat chance for that...
-     */
-    if (d_ptr->m_Applet) { 
-        /* 
-         * Metadata is owned by the appletdb, so not removed, only disconnected
-         * both ways.
-         */
-        disconnect (d_ptr->m_Applet, 0, this, 0);
-        disconnect (this, 0, d_ptr->m_Applet, 0);
-        // FIXME: I think this would not be a good idea, we can not disconnect 
-        // all functions, because for example we will loose hide/show signals.
-        // And who knows what else are we going to connect in the future.
-        // this->disconnect ();
-    }
-
-    d_ptr->m_Applet = applet;
-
-    /*
-     * If we have a applet object we can construct a widget for that and then
-     * we can connect some signals.
-     */
-    if (d_ptr->m_Applet) {
-        // FIXME: This might cause a race condition? What if the applet sends
-        // a signal when we are not connected yet?
-        constructRealWidget (d_ptr->m_Applet->widgetTypeID());
-        /*
-         * This will count the activations and activate the applet.
-         */
-        connect (this, SIGNAL (clicked()), 
-                d_ptr->m_Applet, SLOT (slotClicked()));
-        /*
-         * This will follow the breiaf changes on the UI.
-         */
-        connect (d_ptr->m_Applet, SIGNAL (briefChanged()), 
-                this, SLOT (updateContents()));
-    }
-}
-
-void 
-DcpBriefWidget::retranslateUi ()
-{
-    if (d_ptr->m_Applet) {
-        d_ptr->m_RealWidget->setText1 (applet()->text1());
-        updateContents ();
-    }
-}
-
-DcpButtonImage * 
-DcpBriefWidget::constructImage (
-        const DcpAppletObject *applet)
-{
-    DcpButtonImage *image = new DcpButtonImage (this);
-
-    if (applet) {
-        QString   source;
-        
-        /*
-         * If the applet provides an image file name we set the image from that,
-         * otherwise we try to set the image from the icon name.
-         */
-        source = applet->imageName();
-        if (!source.isEmpty()) {
-            DCP_DEBUG ("Calling image->setImageFromFile (%s)", DCP_STR(source));
-            image->setImageFromFile (source);
-        } else {
-            source = applet->iconName();
-            DCP_DEBUG ("Calling image->setImageName (%s)", DCP_STR(source));
-            image->setImageName (source);
-        }
-    }
-
-    return image;
-}
-
-DcpButtonToggle *
-DcpBriefWidget::constructToggle (
-        const DcpAppletObject *applet)
-{
-    DcpButtonToggle *toggle = new DcpButtonToggle (this);
-
-    if (applet) {
-        toggle->setSmallToggle (applet->toggle());
-        toggle->setIconId (applet->toggleIconId());
-        connect (toggle, SIGNAL (smallToggled (bool)),
-             applet, SLOT (setToggle (bool)));
-    }
-
-    return toggle;
-}
-
-void
-DcpBriefWidget::updateContents ()
-{
-    if (!d_ptr->m_Applet)
-        return;
-
-    // for all:
-    d_ptr->m_RealWidget->setText2 (d_ptr->m_Applet->text2());
-
-    // toggle specific:
-    DcpButtonToggle *toggle = qobject_cast<DcpButtonToggle*>
-        (d_ptr->m_RealWidget);
-    if (toggle) {
-        toggle->setSmallToggle (d_ptr->m_Applet->toggle());
-        toggle->setIconId (d_ptr->m_Applet->toggleIconId());
-    }
-
-    // image specific:
-    DcpButtonImage *image = qobject_cast<DcpButtonImage*>(d_ptr->m_RealWidget);
-    if (image) {
-        QString   source;
-
-        /*
-         * If the applet provides an image file name we set the image from that,
-         * otherwise we try to set the image from the icon name.
-         */
-        source = d_ptr->m_Applet->imageName();
-        if (!source.isEmpty()) {
-            DCP_DEBUG ("Calling image->setImageFromFile (%s)", DCP_STR(source));
-            image->setImageFromFile (source);
-        } else {
-            source = d_ptr->m_Applet->iconName();
-            DCP_DEBUG ("Calling image->setImageName (%s)", DCP_STR(source));
-            image->setImageName (source);
-        }
-    }
-}
-
-void
-DcpBriefWidget::showEvent (
-        QShowEvent *event)
-{
-    Q_UNUSED (event);
-    Q_ASSERT (d_ptr->m_RealWidget);
-
-    if (d_ptr->m_Hidden) {
-        // prevents multiple showEvents coming
-        d_ptr->m_Hidden = false;
-
-        connect (d_ptr->m_RealWidget, SIGNAL(clicked()),
-                this, SIGNAL(clicked()));
-
-        if (d_ptr->m_Applet)
-            connect (d_ptr->m_Applet, SIGNAL (briefChanged ()),
-                this, SLOT (updateContents()));
-
-        updateContents();
-    }
-}
-
-void
-DcpBriefWidget::hideEvent (
-        QHideEvent     *event)
-{
-    Q_UNUSED (event);
-    Q_ASSERT (d_ptr->m_RealWidget);
-
-    if (!d_ptr->m_Hidden) {// prevents multiple hideEvents coming
-        d_ptr->m_Hidden = true;
-
-        disconnect (d_ptr->m_RealWidget, SIGNAL(clicked()),
-                this, SIGNAL(clicked()));
-
-        if (d_ptr->m_Applet)
-            disconnect (d_ptr->m_Applet, SIGNAL (briefChanged()),
-                this, SLOT (updateContents()));
-    }
-}
-
--- lib/src/widget/dcpbriefwidget.h
+++ lib/src/widget/dcpbriefwidget.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#ifndef DCPBRIEFWIDGET_H
-#define DCPBRIEFWIDGET_H
-
-#include <MWidget>
-
-class DcpAppletObject;
-class DcpButton;
-class DcpButtonImage;
-class DcpButtonToggle;
-class QShowEvent;
-class QHideEvent;
-class DcpBriefWidgetPrivate;
-
-/*!
- * \brief An activatable entry in the control panel.
- * 
- * The #DcpBriefWidget is an activatable widget in the control panel. It
- * usually has a #DcpAppletObject associated with it, so when the user clicks
- * on the widget the applet variant is activated. The widget connects its
- * clicked() signal to the activate() signal of the #DcpAppletObject object,
- * so the applet variant will be started when the widget is clicked.
- *
- * This class implements the connection between the brief shown on the screen
- * and the applet describing the applet variant.
- *
- * Inside the #DcpBriefWidget there is a #DcpButton, a #DcpButtonImage or a 
- * #DcpButtonToggle as an actual widget.
- *
- * THIS CLASS IS DEPRECATED. Please use #DcpContentItem instead, that works
- * the same.
- */
-
-#ifdef DCP_DISABLE_DEPRECATION_WARNING
-class DcpBriefWidget:
-#else
-class Q_DECL_DEPRECATED DcpBriefWidget:
-#endif
-    public MWidget
-{
-    Q_OBJECT
-
-public:
-    DcpBriefWidget (
-            DcpAppletObject *applet, 
-            MWidget         *parent = 0);
-
-    DcpBriefWidget (
-            int               widgetTypeId,
-            const QString    &line1,
-            const QString    &line2,
-            MWidget        *parent = 0);
-
-    ~DcpBriefWidget();
-
-
-    void setApplet (DcpAppletObject *applet);
-    DcpAppletObject *applet () const;
-
-public slots:
-    void updateContents();
-
-signals:
-    void clicked();
-
-protected:
-    virtual void retranslateUi();
-    virtual void showEvent (QShowEvent *event);
-    virtual void hideEvent (QHideEvent *event);
-
-    virtual void constructRealWidget (int widgetTypeId);
-    DcpButtonImage *constructImage (const DcpAppletObject* applet);
-    DcpButtonToggle *constructToggle (const DcpAppletObject* applet);
-
-private:
-    DcpBriefWidgetPrivate* const d_ptr;
-};
-
-
-#endif 
--- lib/src/widget/dcpbutton.cpp
+++ lib/src/widget/dcpbutton.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#include "dcpbutton.h"
-#include "dcpbutton_p.h"
-#include <MLabel>
-#include <QGraphicsGridLayout>
-#include <QGraphicsSceneMouseEvent>
-
-#include "mwidgetcreator.h"
-M_REGISTER_WIDGET_NO_CREATE(DcpButton)
-
-
-#include "dcpdebug.h"
-
-/******************************************************************************
- * Stuff for the MStylableWidget style handling. 
- */
-#ifdef USE_STYLABLE_WIDGET
-class DcpButtonStyleContainerPrivate {
-    bool none;
-};
-
-DcpButtonStyle::DcpButtonStyle () 
-{
-    DCP_DEBUG ("");
-}
-
-DcpButtonStyle::~DcpButtonStyle () 
-{
-    DCP_DEBUG ("");
-}
-
-DcpButtonStyleContainer::DcpButtonStyleContainer() :
-    d_ptr (new DcpButtonStyleContainerPrivate)
-{
-    DCP_DEBUG ("");
-}
-
-DcpButtonStyleContainer::~DcpButtonStyleContainer()
-{
-    DCP_DEBUG ("");
-}
-
-void DcpButtonStyleContainer::reloadStyles()
-{
-    MWidgetStyleContainer::reloadStyles();
-}
-
-const char* DcpButtonStyleContainer::styleType() const
-{
-    return "DcpButtonStyle";
-}
-#endif
-
-/******************************************************************************
- * Stuff for the private data.
- */
-DcpButtonPrivate::DcpButtonPrivate ():
-    textLayout (0), 
-    label1 (0), 
-    label2 (0)
-{
-}
-
-
-/******************************************************************************
- * Stuff for the DcpButton widget class. 
- */
-DcpButton::DcpButton (MWidget *parent): 
-    #ifdef USE_STYLABLE_WIDGET
-    MStylableWidget (parent), 
-    #else
-    MWidget (parent), 
-    #endif
-    d_ptr (new DcpButtonPrivate)
-{
-    DCP_DEBUG ("");
-    setObjectName ("DcpButton");
-    this->setLayout (createLayout());
-}
-
-/*!
- * protected constructor which avoids creating the layout
- */
-DcpButton::DcpButton(MWidget* parent, bool): 
-    #ifdef USE_STYLABLE_WIDGET
-    MStylableWidget (parent), 
-    #else
-    MWidget (parent), 
-    #endif
-    d_ptr (new DcpButtonPrivate)
-{
-    setObjectName ("DcpButton");
-}
-
-DcpButton::~DcpButton ()
-{
-    delete d_ptr;
-}
-
-
-QGraphicsLayout *
-DcpButton::createLayout ()
-{
-    d_ptr->label1 = new MLabel (this);
-    d_ptr->label1->setAcceptedMouseButtons (0);
-    d_ptr->label1->setTextElide (true);
-
-    d_ptr->label2 = new MLabel();
-    d_ptr->label2->setTextElide (true);
-    d_ptr->label2->setAcceptedMouseButtons (0);
-    d_ptr->label2->setObjectName ("DcpButtonLine2");
-
-    d_ptr->textLayout = new QGraphicsGridLayout ();
-    d_ptr->textLayout->setContentsMargins (0, 0, 0, 0);
-    d_ptr->textLayout->addItem (d_ptr->label1, 0, 0);
-    d_ptr->textLayout->addItem (d_ptr->label2, 1, 0);
-
-    updateLabelSizes ();
-    return d_ptr->textLayout;
-}
-
-void 
-DcpButton::setText1 (
-        const QString &text)
-{
-    d_ptr->label1->setText(text);
-}
-
-void 
-DcpButton::setText2 (
-        const QString &text)
-{
-    if (text == d_ptr->label2->text()) 
-        return;
-
-    d_ptr->label2->setText (text);
-    updateLabelSizes ();
-}
-
-QString 
-DcpButton::getText1() const
-{
-    return d_ptr->label1->text();
-}
-
-QString 
-DcpButton::getText2() const
-{
-    return d_ptr->label2->text();
-}
-
-void 
-DcpButton::updateLabelSizes ()
-{
-    if (d_ptr->label2->text().isEmpty()) {
-        d_ptr->label1->setObjectName ("DcpButtonMain");
-        if (textLayout()->count() > 1) {
-            textLayout()->removeAt(1);
-        }
-        d_ptr->label2->hide();
-    } else {
-        d_ptr->label1->setObjectName ("DcpButtonLine1");
-        if (textLayout()->count() <= 1) {
-            textLayout()->addItem (d_ptr->label2, 1, 0);
-        }
-        d_ptr->label2->show();
-    }
-}
-
-void 
-DcpButton::setText (
-        const QString &text1, 
-        const QString &text2)
-{
-    setText1 (text1);
-    setText2 (text2);
-}
-
-QGraphicsGridLayout *
-DcpButton::textLayout()
-{
-    return d_ptr->textLayout;
-}
-
-void 
-DcpButton::mousePressEvent (
-        QGraphicsSceneMouseEvent *event)
-{
-    DCP_DEBUG ("");
-    Q_UNUSED(event);
-    // this function is only for becoming the mouse grabber item
-    // so that release event is working
-    //
-    // visual feedback for user can be implemented here
-}
-
-void 
-DcpButton::mouseReleaseEvent (
-        QGraphicsSceneMouseEvent *event)
-{
-    DCP_DEBUG ("");
-    if (QRectF(QPointF(), size()).contains(event->pos())) {
-        emit clicked();
-    }
-}
-
--- lib/src/widget/dcpbutton.h
+++ lib/src/widget/dcpbutton.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#ifndef DCPBUTTON_H
-#define DCPBUTTON_H
-
-#include <MWidget>
-
-class MLabel;
-class QGraphicsLayout;
-class QGraphicsGridLayout;
-class QGraphicsSceneMouseEvent;
-class DcpButtonPrivate;
-
-/*
- * This DcpButton class is originally based on the MStylableWidget class, but
- * the actual style was not implemented. When I implemented the elements needed
- * for the actual style it turned out that the libdui is crashing. I believe the
- * bug is in the libdui, I found no actual example of a class based on the
- * MStylableWidget. I did not want to delete the style stuff, so started to
- * use the USE_STYLABLE_WIDGET. Please define this macro to check if the 
- * MStylableWidget is working. until such a time we can use the MWidget
- * instead.
- */
-#ifdef USE_STYLABLE_WIDGET
-#include <MStylableWidget>
-class M_EXPORT DcpButtonStyle : public MWidgetStyle
-{
-    Q_OBJECT
-    M_STYLE(DcpButtonStyle)
-
-    M_STYLE_ATTRIBUTE(bool,    drawTiledHorizontal, DrawTiledHorizontal)
-};
-
-class M_EXPORT DcpButtonStyleContainer : public MWidgetStyleContainer
-{
-    M_STYLE_CONTAINER(DcpButtonStyle)
-};
-#endif
-
-/*!
- * \brief Widget used as part of the brief widget.
- *
- * The #DcpButton is a widget the DuiControlpanel uses as part of the brief
- * widgets representing one applet variant in the main page and the category
- * pages of the control panel UI.
- * TODO if design stays the way it is we could use here an empty
- * WidgetController which supports margins set by css
- *
- * THIS CLASS IS DEPRECATED. Please use MContentItem instead.
- */
-#ifdef USE_STYLABLE_WIDGET
-
-#   ifdef DCP_DISABLE_DEPRECATION_WARNING
-class DcpButton: public MStylableWidget
-#   else
-class Q_DECL_DEPRECATED DcpButton: public MStylableWidget
-#   endif
-
-#else
-
-#   ifdef DCP_DISABLE_DEPRECATION_WARNING
-class DcpButton: public MWidget
-#   else
-class Q_DECL_DEPRECATED DcpButton: public MWidget
-#   endif
-
-#endif
-{
-    Q_OBJECT
-    Q_PROPERTY (QString text1 READ getText1 WRITE setText1)
-    Q_PROPERTY (QString text2 READ getText2 WRITE setText2)
-
-public:
-    explicit DcpButton (MWidget* parent = 0);
-    ~DcpButton ();
-
-    void setText (const QString& text1, const QString& text2);
-    virtual void setText1 (const QString& text);
-    virtual void setText2 (const QString& text);
-    virtual QString getText1 () const;
-    virtual QString getText2 () const;
-
-signals:
-    void clicked();
-
-protected:
-    DcpButton (MWidget *parent, bool);
-    virtual QGraphicsLayout *createLayout();
-    QGraphicsGridLayout *textLayout ();
-    virtual void mousePressEvent (QGraphicsSceneMouseEvent *event);
-    virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
-
-private:
-    void updateLabelSizes();
-    DcpButtonPrivate * const d_ptr;
-    #ifdef USE_STYLABLE_WIDGET
-    M_STYLABLE_WIDGET (DcpButtonStyle)
-    #endif
-};
-
-
-
-#endif
-
--- lib/src/widget/dcpbutton_p.h
+++ lib/src/widget/dcpbutton_p.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef DCPBUTTONPRIVATE_H
-#define DCPBUTTONPRIVATE_H
-class DcpButtonPrivate {
-public:
-    DcpButtonPrivate ();
-    QGraphicsGridLayout *textLayout;
-    MLabel            *label1;
-    MLabel            *label2;
-};
-#endif //DCPBUTTONPRIVATE
-
--- lib/src/widget/dcpbuttonalign.cpp
+++ lib/src/widget/dcpbuttonalign.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#include "dcpbuttonalign.h"
-#include "dcpbuttonalign_p.h"
-
-#include <QGraphicsLinearLayout>
-#include <QGraphicsGridLayout>
-
-#include "dcpdebug.h"
-
-DcpButtonAlignPrivate::DcpButtonAlignPrivate () :
-    alignedWidget (0), 
-    alignLayout (0),
-    alignment (Qt::AlignRight)
-
-{
-}
-
-/*!
- * FIXME: This constructor has an unused unnamed boolean argument. It should be
- * maybe removed?
- */
-DcpButtonAlign::DcpButtonAlign (
-        MWidget *parent): 
-    DcpButton (parent, false),
-    d_ptr (new DcpButtonAlignPrivate)
-{
-}
-
-DcpButtonAlign::~DcpButtonAlign ()
-{
-    delete d_ptr;
-}
-
-
-QGraphicsLayout *
-DcpButtonAlign::createLayout ()
-{
-    Q_ASSERT(alignedWidget());
-
-    DcpButton::createLayout();
-    qreal left, right, top, bottom;
-    textLayout()->getContentsMargins (&left, &top, &right, &bottom);
-    textLayout()->setContentsMargins (0, 0, right, 0);
-
-    d_ptr->alignLayout = new QGraphicsLinearLayout (Qt::Horizontal);
-    d_ptr->alignLayout->setContentsMargins (left, top, right, bottom);
-
-    putupWidgets();
-    return d_ptr->alignLayout;
-}
-
-void 
-DcpButtonAlign::setAlignment (
-        Qt::Alignment align)
-{
-    if (d_ptr->alignment == align)
-        return;
-
-    d_ptr->alignment = align;
-
-    if (d_ptr->alignLayout != NULL) {
-        /* if the layout has already been created, remove and readd the items
-         * in the correct order */
-        d_ptr->alignLayout->removeAt (0);
-        d_ptr->alignLayout->removeAt (1);
-        putupWidgets ();
-    }
-}
-
-void
-DcpButtonAlign::putupWidgets ()
-{
-    Q_ASSERT (alignedWidget());
-    Q_ASSERT (textLayout());
-
-    switch (d_ptr->alignment) {
-        case Qt::AlignRight:
-            d_ptr->alignLayout->addItem (textLayout());
-            d_ptr->alignLayout->addItem (alignedWidget());
-            break;
-
-        case Qt::AlignLeft:
-            d_ptr->alignLayout->addItem (alignedWidget());
-            d_ptr->alignLayout->addItem (textLayout());
-            break;
-
-        default:
-            qFatal ("DcpButtonAlign unsupported alignment");
-            break;
-    }
-
-    d_ptr->alignLayout->setAlignment (alignedWidget(), Qt::AlignVCenter);
-}
-
-MWidget *
-DcpButtonAlign::alignedWidget ()
-{
-    return d_ptr->alignedWidget;
-}
-
-void 
-DcpButtonAlign::setAlignedWidget (
-        MWidget *widget)
-{
-    // only lets to set it up once currently (no widget changing)
-    Q_ASSERT (!d_ptr->alignedWidget); 
-    d_ptr->alignedWidget = widget;
-}
-
-
--- lib/src/widget/dcpbuttonalign.h
+++ lib/src/widget/dcpbuttonalign.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#ifndef DCPBUTTONALIGN_H
-#define DCPBUTTONALIGN_H
-
-#include "dcpbutton.h"
-class QGraphicsLayout;
-class QGraphicsLinearLayout;
-class DcpButtonAlignPrivate;
-
-/*!
- * \brief Parent class for all the brief widgets.
- *
- * The #DcpButtonAlign is the base class for all the brief widget classes. The
- * brief widgets are the widgets inside the main page and the category subpages
- * representing one applet variant.
- *
- * THIS CLASS IS DEPRECATED and will be removed soon.
- */
-class DcpButtonAlign: public DcpButton
-{
-    Q_OBJECT
-
-public:
-    DcpButtonAlign (MWidget *parent);
-    ~DcpButtonAlign ();
-
-    void setWidgetAlignment (Qt::Alignment align);
-
-protected:
-    virtual QGraphicsLayout* createLayout ();
-    void setAlignment (Qt::Alignment align);
-
-    MWidget* alignedWidget ();
-    void setAlignedWidget (MWidget* widget);
-
-private:
-    void putupWidgets ();
-    DcpButtonAlignPrivate * const d_ptr;
-};
-
-
-#endif // DCPBUTTONALIGN_H
-
--- lib/src/widget/dcpbuttonalign_p.h
+++ lib/src/widget/dcpbuttonalign_p.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef DCPBUTTONALIGNPRIVATE_H
-#define DCPBUTTONALIGNPRIVATE_H
-
-class DcpButtonAlignPrivate { 
-public:
-    DcpButtonAlignPrivate ();
-    MWidget              *alignedWidget;
-    QGraphicsLinearLayout  *alignLayout;
-    Qt::Alignment           alignment;
-}; 
-#endif // DCPBUTTONALIGNPRIVATE_H
--- lib/src/widget/dcpbuttonimage.cpp
+++ lib/src/widget/dcpbuttonimage.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#include "dcpbuttonimage.h"
-#include "dcpbuttonimage_p.h"
-
-#include <MButton>
-#include <MImageWidget>
-#include <QGraphicsLinearLayout>
-#include <QtDebug>
-
-#include "dcpdebug.h"
-
-DcpButtonImage::DcpButtonImage (
-        MWidget *parent)
-: DcpButtonAlign (parent), 
-  d_ptr(new DcpButtonImagePrivate)
-{
-    setLayout (createLayout());
-}
-
-/*!
- * Calls MImageWidget::setImage() with the provided strings, in other words it
- * sets the image from an icon name in the theme.
- */
-void 
-DcpButtonImage::setImageName (
-        const QString &iconName)
-{
-    Q_ASSERT (imageWidget());
-    DCP_DEBUG("calling setImage(%s)", DCP_STR(iconName));
-    imageWidget()->setImage (iconName);
-    d_ptr->fileName = "";
-}
-
-/*!
- * Sets the image from an image file.
- */
-void 
-DcpButtonImage::setImageFromFile (
-        const QString &fileName)
-{
-    bool    success;
-    QImage  image;
-
-    /*
-     * The image file might be big, so we need a little speed up here, otherwise
-     * the paging effect is blocked when we go back to the main page.
-     */
-    if (fileName == d_ptr->fileName)
-        return;
-
-    DCP_DEBUG("calling QImage::load(%s)", DCP_STR(fileName));
-    success = image.load (fileName);
-    if (!success) {
-        DCP_WARNING ("The image was not loaded from %s", DCP_STR(fileName));
-        return;
-    }
-
-    image = image.scaled(100, 100, Qt::KeepAspectRatio);
-    imageWidget()->setImage (image);
-
-    d_ptr->fileName = fileName;
-}
-
-
-QGraphicsLayout *
-DcpButtonImage::createLayout ()
-{
-    // we could use the icon of the button here, if it could be set to a custom
-    // file
-    d_ptr->image = new MImageWidget (this);
-    d_ptr->image->setObjectName ("DcpButtonImage");
-    d_ptr->image->setAspectRatioMode (Qt::IgnoreAspectRatio);
-
-    setAlignedWidget (d_ptr->image);
-
-    return DcpButtonAlign::createLayout();
-}
-
-
-MImageWidget *
-DcpButtonImage::imageWidget ()
-{
-    return d_ptr->image;
-}
-
-
-
--- lib/src/widget/dcpbuttonimage.h
+++ lib/src/widget/dcpbuttonimage.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#ifndef DCPBUTTONIMAGE_H
-#define DCPBUTTONIMAGE_H
-
-#include "dcpbuttonalign.h"
-class MImageWidget;
-
-class DcpButtonImagePrivate;
-
-/*!
- * THIS CLASS IS DEPRECATED and will be removed soon.
- */
-class DcpButtonImage: public DcpButtonAlign 
-{
-    Q_OBJECT
-
-public:
-    DcpButtonImage (MWidget *parent = 0);
-
-    void setImageName (const QString& iconName);
-    void setImageFromFile (const QString &fileName);
-    
-protected:
-    virtual QGraphicsLayout *createLayout ();
-    MImageWidget *imageWidget ();
-private:
-    DcpButtonImagePrivate *const d_ptr;
-    Q_DISABLE_COPY(DcpButtonImage);
-};
-
-
-#endif // DCPBUTTONIMAGE_H
--- lib/src/widget/dcpbuttonimage_p.h
+++ lib/src/widget/dcpbuttonimage_p.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef DCPBUTTONIMAGE_P
-#define DCPBUTTONIMAGE_P
-
-class MImageWidget;
-class QString;
-
-class DcpButtonImagePrivate {
-public:
-    MImageWidget *image;
-    QString       fileName;
-};
-#endif // DCPBUTTONIMAGE_P
--- lib/src/widget/dcpbuttontoggle.cpp
+++ lib/src/widget/dcpbuttontoggle.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#include "dcpbuttontoggle.h"
-#include "dcpbuttontoggle_p.h"
-#include <MButton>
-
-DcpButtonToggle::DcpButtonToggle (
-        MWidget *parent)
-    : DcpButtonAlign (parent),
-    d_ptr(new DcpButtonTogglePrivate)
-{
-    this->setLayout(createLayout());
-}
-
-
-QGraphicsLayout *
-DcpButtonToggle::createLayout ()
-{
-    MButton* toggleButton = new MButton (this);
-    toggleButton->setObjectName ("DcpButtonToggle");
-    toggleButton->setCheckable (true);
-    toggleButton->setViewType (MButton::switchType);
-
-    connect (toggleButton, SIGNAL(toggled(bool)),
-             this, SLOT(onSmallToggled(bool)));
-
-    setAlignedWidget(toggleButton);
-
-    return DcpButtonAlign::createLayout();
-}
-
-void 
-DcpButtonToggle::setText2 (
-        const QString &text)
-{
-    d_ptr->text2 = text;
-
-    if (toggleButton()->isChecked()) {
-        DcpButton::setText2(d_ptr->text2);
-    }
-}
-
-void 
-DcpButtonToggle::onSmallToggled (
-        bool isOn)
-{
-    // do not show second line in case it is off:
-    if (isOn){
-        DcpButton::setText2 (d_ptr->text2);
-    } else {
-        DcpButton::setText2 (QString());
-    }
-
-    emit smallToggled (isOn);
-}
-
-void 
-DcpButtonToggle::setSmallToggle (
-        bool isOn)
-{
-    if (toggleButton()->isChecked() != isOn) {
-        toggleButton()->setChecked(isOn);
-    }
-}
-
-MButton *
-DcpButtonToggle::toggleButton ()
-{
-    return qobject_cast<MButton*>(alignedWidget());
-}
-
-void 
-DcpButtonToggle::setIconId (
-        const QString &iconId)
-{
-    if (iconId != this->iconId()) {
-        toggleButton()->setIconID(iconId);
-    }
-}
-
-QString 
-DcpButtonToggle::iconId ()
-{
-    return toggleButton()->iconID();
-}
-
--- lib/src/widget/dcpbuttontoggle.h
+++ lib/src/widget/dcpbuttontoggle.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
-/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
-#ifndef DCPBUTTONTOGGLE_H
-#define DCPBUTTONTOGGLE_H
-
-#include "dcpbuttonalign.h"
-class MButton;
-
-class DcpButtonTogglePrivate;
-
-/*!
- * THIS CLASS IS DEPRECATED and will be removed soon.
- */
-class DcpButtonToggle: public DcpButtonAlign {
-    Q_OBJECT
-public:
-    explicit DcpButtonToggle(MWidget* parent = 0);
-
-    virtual void setText2(const QString& text);
-    virtual void setIconId(const QString& iconId);
-    QString iconId();
-    virtual void setSmallToggle(bool isOn);
-
-signals:
-    void smallToggled (bool isOn);
-
-protected slots:
-    void onSmallToggled (bool isOn);
-
-protected:
-    virtual QGraphicsLayout* createLayout();
-    MButton* toggleButton();
-
-private:
-    DcpButtonTogglePrivate *const d_ptr;
-    Q_DISABLE_COPY(DcpButtonToggle);
-};
-
-
-#endif // DCPBUTTONTOGGLE_H
--- lib/src/widget/dcpbuttontoggle_p.h
+++ lib/src/widget/dcpbuttontoggle_p.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef DCPBUTTONTOGGLE_P_H
-#define DCPBUTTONTOGGLE_P_H
-#include <QString>
-class DcpButtonTogglePrivate {
-public:
-    QString text2;
-};
-#endif // DCPBUTTONTOGGLE_P_H
--- lib/src/widget/dcpcontentbutton.cpp
+++ lib/src/widget/dcpcontentbutton.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
+
+#include "dcpcontentbutton.h"
+#include "dcpcontentbutton_p.h"
+
+#include "dcpdebug.h"
+
+
+DcpContentButtonPrivate::DcpContentButtonPrivate ():
+    m_Applet (0),
+    m_Hidden (true)
+{
+}
+
+/******************************************************************************
+ * Stuff for the DcpContentButton class.
+ */
+DcpContentButton::DcpContentButton (
+        DcpAppletObject *applet,
+        QGraphicsItem   *parent):
+    MButton ("...", parent),
+    d_ptr (new DcpContentButtonPrivate)
+{
+    setApplet (applet);
+}
+
+
+DcpContentButton::~DcpContentButton ()
+{
+    delete d_ptr;
+}
+
+
+DcpAppletObject *
+DcpContentButton::applet() const
+{
+    return d_ptr->m_Applet;
+}
+
+void
+DcpContentButton::setApplet (DcpAppletObject *applet)
+{
+    d_ptr->m_Applet = applet;
+    if (!d_ptr->m_Applet)
+        return;
+
+    connect (this, SIGNAL (clicked()),                                                         
+             d_ptr->m_Applet, SLOT (slotClicked()));
+}
+
+void
+DcpContentButton::retranslateUi ()
+{
+    if (d_ptr->m_Applet) {
+        updateText ();
+    }
+}
+
+
+void
+DcpContentButton::updateText ()
+{
+    setText(applet()->text2());
+    qDebug() << applet()->text2();
+}
+
+
+/*
+ * updates all displayed datas if something changes in the brief / desktop file
+ */
+void
+DcpContentButton::updateContents ()
+{
+    if (!d_ptr->m_Applet)
+        return;
+
+    updateText();
+}
+
+
+void
+DcpContentButton::showEvent (QShowEvent * event)
+{
+    if (d_ptr->m_Hidden) {
+        // prevents multiple showEvents coming
+        d_ptr->m_Hidden = false;
+
+        if (d_ptr->m_Applet)
+            connect (d_ptr->m_Applet, SIGNAL (briefChanged ()), 
+                this, SLOT (updateContents()));
+
+        updateContents();
+    }
+    MButton::showEvent(event);
+}
+
+void
+DcpContentButton::hideEvent (QHideEvent * event)
+{
+    if (!d_ptr->m_Hidden) {// prevents multiple hideEvents coming
+        d_ptr->m_Hidden = true;
+
+        if (d_ptr->m_Applet)
+            disconnect (d_ptr->m_Applet, SIGNAL (briefChanged()),
+                this, SLOT (updateContents()));
+    }
+    MButton::hideEvent(event);
+}
+
+void DcpContentButton::setMattiID (const QString& mattid)
+{
+    d_ptr->m_MattiID = mattid;
+}
+
+QString DcpContentButton::mattiID () const
+{
+    return d_ptr->m_MattiID;
+}
+
--- lib/src/widget/dcpcontentbutton.h
+++ lib/src/widget/dcpcontentbutton.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
+#ifndef DCPCONTENTBUTTON_H
+#define DCPCONTENTBUTTON_H
+
+#include <MButton>
+
+class DcpAppletObject;
+class QShowEvent;
+class QHideEvent;
+class DcpContentButtonPrivate;
+
+/*!
+ * \brief An activatable entry in the control panel.
+ *
+ * This class implements the brief view of an applet shown on the screen
+ * in applet lists.
+ *
+ * It has a #DcpAppletObject associated with it, so when the user clicks
+ * on the widget the applet variant is activated. The widget connects its
+ * clicked() signal to the activate() signal of the #DcpAppletObject object,
+ * so the applet variant will be started when the widget is clicked.
+ *
+ * The widget updates its contents automatically if the applet notifies it
+ * about the changes, see DcpBrief::valuesChanged().
+ *
+ */
+class DcpContentButton: public MButton
+{
+    Q_OBJECT
+
+    //! @cond
+    Q_PROPERTY (QString mattiID READ mattiID WRITE setMattiID)
+    //! @endcond
+
+public:
+    /*! \brief Constructor.
+     *
+     * If you do not set an applet here, be sure to do that before the widget
+     * gets shown on the screen. See #setApplet().
+     */
+    DcpContentButton (
+            DcpAppletObject *applet = 0,
+            QGraphicsItem *parent = 0);
+
+    ~DcpContentButton ();
+
+    /*! \brief Sets the applet the DcpContentItem should handle.
+     *
+     * Currently you can only call it before the ContentItem is popped up,
+     * due to limitations of MContentItem.
+     */
+    void setApplet (DcpAppletObject *applet);
+
+    /*! \brief Returns the applet the DcpContentButton represents */
+    DcpAppletObject *applet () const;
+
+    //! @cond
+    void setMattiID (const QString& mattid);
+    QString mattiID () const;
+    //! @endcond
+
+protected slots:
+    /*! \brief Make the object update according to the values the applet returns
+     *
+     * It is connected on the DcpBrief::valuesChanged() signal if any.
+     */
+    void updateContents ();
+
+protected:
+    virtual void retranslateUi ();
+    virtual void showEvent (QShowEvent *event);
+    virtual void hideEvent (QHideEvent *event);
+
+    /*! \brief Updates all texts according to the values the applet returns */
+    void updateText ();
+private:
+    DcpContentButtonPrivate* const d_ptr;
+
+    friend class Ut_DcpContentButton;
+};
+
+
+#endif
+
--- lib/src/widget/dcpcontentbutton_p.h
+++ lib/src/widget/dcpcontentbutton_p.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef DCPCONTENTBUTTONPRIVATE_H
+#define DCPCONTENTBUTTONPRIVATE_H
+
+#include "dcpappletobject.h"
+#include "dcpappletmetadata.h"
+#include "dcpwidgettypes.h"
+
+/******************************************************************************
+ * Private data class for the DcpContentButton class.
+ */
+class DcpContentButtonPrivate {
+public:
+    DcpContentButtonPrivate ();
+    DcpAppletObject *m_Applet;
+    bool m_Hidden;
+    QString m_MattiID;
+};
+
+#endif // DCPCONTENTBUTTONPRIVATE_H
+
--- lib/src/widget/dcpcontentitem.cpp
+++ lib/src/widget/dcpcontentitem.cpp
@@ -24,14 +24,6 @@
 #include "dcpdebug.h"
 
 
-/* FIXME: this is a workaround against bug NB#170105 -
- * show/hideEvent of MContentItem does not get called
- *
- * Remove it once the bug is solved.
- */
-#define NB170105
-
-
 DcpContentItemPrivate::DcpContentItemPrivate ():
     m_Applet (0),
     m_WidgetTypeId (DcpWidgetType::Label),
@@ -60,6 +52,36 @@
 }
 
 
+static MContentItem::ContentItemStyle invertTwoLineMode (
+        const MContentItem::ContentItemStyle& styl)
+{
+    MContentItem::ContentItemStyle newstyl;
+    switch (styl) {
+        case MContentItem::IconAndTwoTextLabels:
+            newstyl = MContentItem::IconAndSingleTextLabel;
+            break;
+        case MContentItem::SingleTextLabel:
+            newstyl = MContentItem::TwoTextLabels;
+            break;
+        case MContentItem::IconAndSingleTextLabel:
+            newstyl = MContentItem::IconAndTwoTextLabels;
+            break;
+        case MContentItem::TwoTextLabels:
+            newstyl = MContentItem::SingleTextLabel;
+            break;
+        case MContentItem::IconAndSingleTextLabelVertical:
+            newstyl = MContentItem::IconAndTwoTextLabelsVertical;
+            break;
+        case MContentItem::IconAndTwoTextLabelsVertical:
+            newstyl = MContentItem::IconAndSingleTextLabelVertical;
+            break;
+        default:
+            return styl; // do nothing bad at least :)
+    }
+    return newstyl;
+}
+
+
 /*
  * Constructs the content of the DcpContentItem according to the widget type.
  * This is a separate code so the inherited classes might use other code,
@@ -70,10 +92,11 @@
 DcpContentItem::constructRealWidget ()
 {
     d_ptr->m_WidgetTypeId = d_ptr->m_Applet->widgetTypeID();
+    MContentItem::ContentItemStyle styl;
     switch (d_ptr->m_WidgetTypeId) {
         case DcpWidgetType::Image:
             DCP_DEBUG ("### DcpWidgetType::Image ###");
-            model()->setItemStyle(IconAndSingleTextLabel);
+            styl = IconAndSingleTextLabel;
             break;
 
         case DcpWidgetType::Toggle:
@@ -82,11 +105,14 @@
                      qPrintable(applet()->metadata()->name()));
         default:
             DCP_DEBUG ("### DcpWidgetType::Label ###");
-            model()->setItemStyle(SingleTextLabel);
+            styl = SingleTextLabel;
             break;
     }
 
-    updateContents ();
+    if (!d_ptr->m_Applet->text2().isEmpty()) {
+        styl = ::invertTwoLineMode (styl);
+    }
+    model()->setItemStyle(styl);
 }
 
 DcpAppletObject *
@@ -123,10 +149,6 @@
          */
         connect (this, SIGNAL (clicked()),
                 d_ptr->m_Applet, SLOT (slotClicked()));
-#       ifdef NB170105
-        connect (d_ptr->m_Applet, SIGNAL (briefChanged ()), 
-                 this, SLOT (updateContents()));
-#       endif // NB170105
     }
 }
 
@@ -145,30 +167,8 @@
 void
 DcpContentItem::invertTwoLineMode()
 {
-    int styl = model()->itemStyle();
-    MContentItem::ContentItemStyle newstyl;
-    switch (styl) {
-        case IconAndTwoTextLabels:
-            newstyl = IconAndSingleTextLabel;
-            break;
-        case SingleTextLabel:
-            newstyl = TwoTextLabels;
-            break;
-        case IconAndSingleTextLabel:
-            newstyl = IconAndTwoTextLabels;
-            break;
-        case TwoTextLabels:
-            newstyl = SingleTextLabel;
-            break;
-        case IconAndSingleTextLabelVertical:
-            newstyl = IconAndTwoTextLabelsVertical;
-            break;
-        case IconAndTwoTextLabelsVertical:
-            newstyl = IconAndSingleTextLabelVertical;
-            break;
-        default:
-            return; // do nothing bad at least :)
-    }
+    MContentItem::ContentItemStyle newstyl =
+        ::invertTwoLineMode ((MContentItem::ContentItemStyle)model()->itemStyle());
     model()->setItemStyle(newstyl);
 }
 
@@ -185,10 +185,10 @@
      * item will be in, because the widget sizes are set up at setupModel time
      * only, so currently MContentItem only supports changing the value at
      * construction time (bug/feature request to libdui if it is important)
-     */
     if (text2.isEmpty() != subtitle().isEmpty()) {
         invertTwoLineMode();
     }
+     */
     setTitle (applet()->text1());
     setSubtitle (text2);
 }
@@ -294,7 +294,6 @@
 void
 DcpContentItem::showEvent (QShowEvent * event)
 {
-#       ifndef NB170105
     if (d_ptr->m_Hidden) {
         // prevents multiple showEvents coming
         d_ptr->m_Hidden = false;
@@ -305,14 +304,12 @@
 
         updateContents();
     }
-#       endif // NB170105
     MContentItem::showEvent(event);
 }
 
 void
 DcpContentItem::hideEvent (QHideEvent * event)
 {
-#       ifndef NB170105
     if (!d_ptr->m_Hidden) {// prevents multiple hideEvents coming
         d_ptr->m_Hidden = true;
 
@@ -320,7 +317,6 @@
             disconnect (d_ptr->m_Applet, SIGNAL (briefChanged()),
                 this, SLOT (updateContents()));
     }
-#       endif // NB170105
     MContentItem::hideEvent(event);
 }
 
--- lib/src/widget/dcpwidgettypes.h
+++ lib/src/widget/dcpwidgettypes.h
@@ -39,6 +39,7 @@
             Label,
             Toggle,
             Image,
+            Button,
             IdMax
         };
         const QString  
@@ -47,7 +48,8 @@
             "DcpBriefWidgetInvalid",
             "Label",
             "Toggle",
-            "Image"
+            "Image",
+            "Button"
         };
         bool isIdValid(int id); 
 };
--- lib/tests/doubles/mdesktopentry-fake.cpp
+++ lib/tests/doubles/mdesktopentry-fake.cpp
@@ -31,7 +31,8 @@
 
 };
 
-MDesktopEntryPrivate::MDesktopEntryPrivate(const QString& fileName)
+MDesktopEntryPrivate::MDesktopEntryPrivate(const QString& fileName):
+    isValid(false)
 {
     this->fileName = fileName;
     this->values= fileDatas[fileName];
--- lib/tests/doubles/mgconfitem-fake.cpp
+++ lib/tests/doubles/mgconfitem-fake.cpp
@@ -36,7 +36,8 @@
 #define FAKE fakeMap[this]
 
 
-MGConfItem::MGConfItem(const QString &key, QObject *parent)
+MGConfItem::MGConfItem(const QString &key, QObject *parent) :
+    priv(0)
 {
     Q_UNUSED(parent);
     fakeMap.insert(this, new MGConfItemFake(key));
--- lib/tests/doubles/mlocale-fake.cpp
+++ lib/tests/doubles/mlocale-fake.cpp
+#include "mlocale-fake.h"
+
+#include <QHash>
+#include <QList>
+#include <QString>
+
+class FakeLocale {
+    public:
+        QList<QString> catalogs;
+};
+
+static const MLocale* defLocale = 0;
+static QHash<const MLocale*, FakeLocale*> priv;
+
+QList<QString> MLocale_installedCatalogs()
+{
+    return MLocale_catalogs(defLocale);
+}
+
+QList<QString> MLocale_catalogs(const MLocale* locale)
+{
+    return priv[locale]->catalogs;
+}
+
+MLocale::MLocale(QObject *parent):
+    QObject(parent), d_ptr(0)
+{
+    priv.insert (this, new FakeLocale);
+}
+
+MLocale::MLocale(const MLocale &other, QObject *parent):
+    QObject(parent), d_ptr(0)
+{
+    priv.insert (this, new FakeLocale);
+    priv[this]->catalogs = priv[&other]->catalogs;
+}
+
+MLocale::MLocale(const QString &localeName, QObject *parent):
+    QObject(parent), d_ptr(0)
+{
+    Q_UNUSED (localeName);
+    priv.insert (this, new FakeLocale);
+}
+
+MLocale::~MLocale()
+{
+}
+
+void MLocale::installTrCatalog(const QString &name)
+{
+    priv[this]->catalogs.append (name);
+}
+
+void MLocale::setDefault(const MLocale &locale)
+{
+    defLocale = &locale;
+}
+
+
--- lib/tests/doubles/mlocale-fake.h
+++ lib/tests/doubles/mlocale-fake.h
+#ifndef MLOCALE_FAKE_H
+#define MLOCALE_FAKE_H
+
+#include <MLocale>
+
+QList<QString> MLocale_installedCatalogs();
+QList<QString> MLocale_catalogs(const MLocale* locale);
+
+#endif // MLOCALE_FAKE_H
+
--- lib/tests/ft_dcpappletdb/ft_dcpappletdb.cpp
+++ lib/tests/ft_dcpappletdb/ft_dcpappletdb.cpp
@@ -267,3 +267,4 @@
 }
 
 QTEST_APPLESS_MAIN(Ft_DcpAppletDb)
+
--- lib/tests/ft_dcpappletobject/testapp/ft_dcpappletobject.cpp
+++ lib/tests/ft_dcpappletobject/testapp/ft_dcpappletobject.cpp
@@ -79,6 +79,8 @@
 
     DcpBrief *brief = applet->constructBrief();
     DcpWidget *widget = applet->constructWidget(0);
+    QVERIFY(widget);
+    QVERIFY(brief);
 
     // FIXME deleting the widget causes crash in loadCSS!
     // delete widget;
--- lib/tests/ft_dcpappletobject/testplugin/testappletwidget.cpp
+++ lib/tests/ft_dcpappletobject/testplugin/testappletwidget.cpp
@@ -27,12 +27,12 @@
     : DcpWidget(parent)
 {
     MLayout *layout = new MLayout(this);
-    MLinearLayoutPolicy *layoutPolicy = 
+    m_layoutPolicy = 
         new MLinearLayoutPolicy(layout, Qt::Vertical);
-    layout->setPolicy(layoutPolicy);
+    layout->setPolicy(m_layoutPolicy);
 
     MLabel *widget = new MLabel("Test applet1", this);
-    layoutPolicy->addItem(widget, Qt::AlignLeft);
+    m_layoutPolicy->addItem(widget, Qt::AlignLeft);
 
     /*
     MContainer *container = new MContainer("Test container", this);
@@ -51,4 +51,5 @@
 
 TestAppletWidget::~TestAppletWidget()
 {
+    delete m_layoutPolicy;
 }
--- lib/tests/ft_dcpappletobject/testplugin/testappletwidget.h
+++ lib/tests/ft_dcpappletobject/testplugin/testappletwidget.h
@@ -20,6 +20,8 @@
 
 #include <DcpWidget>
 
+class MLinearLayoutPolicy;
+
 class TestAppletWidget : public DcpWidget
 {
    Q_OBJECT
@@ -27,6 +29,8 @@
     public:
        TestAppletWidget(QGraphicsWidget *parent=0);
        virtual ~TestAppletWidget();
+    private:
+    MLinearLayoutPolicy *m_layoutPolicy; 
 };
 
 #endif
--- lib/tests/ft_dcpappletplugin
+++ lib/tests/ft_dcpappletplugin
-(directory)
--- lib/tests/ft_dcpappletplugin/dcpappletmetadata-fake.h
+++ lib/tests/ft_dcpappletplugin/dcpappletmetadata-fake.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef DCPAPPLETMETADATA_FAKE_H__
-#define DCPAPPLETMETADATA_FAKE_H__
-
-#include <QString>
-#include "dcpappletmetadata.h"
-
-namespace DcpAppletMetadataFake {
-
-// set this variable before calling DcpAppletMetadata functions
-// depending on whether you want to test binary or dsl loading
-enum AppletType {
-    TYPE_BINARY,
-    TYPE_DSL
-};
-
-static AppletType appletType = TYPE_BINARY;
-
-} // namespace
-
-// DcpAppletLoader::load() decides the applet type based on non-emptyness
-// of the return value of fullBinary() and dslFilename()
-QString DcpAppletMetadata::fullBinary() const
-{
-    if (DcpAppletMetadataFake::appletType == 
-        DcpAppletMetadataFake::TYPE_BINARY) {
-        return "dummy-binary";
-    }
-    return QString();
-}
-
-QString DcpAppletMetadata::dslFilename() const
-{
-    if (DcpAppletMetadataFake::appletType == 
-        DcpAppletMetadataFake::TYPE_DSL) {
-        return "dummy-dsl";
-    }
-    return QString();
-}
-
-#endif
--- lib/tests/ft_dcpappletplugin/dcpappletplugin-applet.h
+++ lib/tests/ft_dcpappletplugin/dcpappletplugin-applet.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef DCPAPPLETLOADER_APPLET_H__
-#define DCPAPPLETLOADER_APPLET_H__
-
-#include <QObject>
-#include <QVector>
-#include <MAction>
-#include <QtDebug>
-
-#include "dcpappletif.h"
-
-class DcpAppletPluginApplet : public QObject, public DcpAppletIf {
-    Q_OBJECT
-    Q_INTERFACES(DcpAppletIf)
-
-    public:
-        DcpAppletPluginApplet() : m_Initialized(false) {
-        }
-        virtual void init() { 
-            m_Initialized = true;
-        }
-        virtual DcpWidget *constructWidget(int) {return 0;};
-        virtual QString title() const { return 0; };
-        virtual QVector<MAction *> viewMenuItems() {
-            QVector<MAction*> empty;
-            return empty;
-        }
-        virtual DcpBrief* constructBrief(int) { return 0; };
-
-        bool initialized() {
-            return m_Initialized;
-        }
-
-    private:
-        bool m_Initialized;
-};
-
-#endif
--- lib/tests/ft_dcpappletplugin/ft_dcpappletplugin.cpp
+++ lib/tests/ft_dcpappletplugin/ft_dcpappletplugin.cpp
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QObject>
-#include <QGraphicsSceneMouseEvent>
-
-#include "dcpappletplugin.h"
-
-
-#include "ft_dcpappletplugin.h"
-#include "qpluginloader-fake.h"
-#include "dcpappletmetadata-fake.h"
-
-void Ft_DcpAppletPlugin::init()
-{
-}
-
-void Ft_DcpAppletPlugin::cleanup()
-{
-    delete m_subject;
-    m_subject = 0;
-}
-
-void Ft_DcpAppletPlugin::initTestCase()
-{
-}
-
-void Ft_DcpAppletPlugin::cleanupTestCase()
-{
-}
-
-/**
- * checks if appletloader calls applet's init function
- */
-void Ft_DcpAppletPlugin::testLoadBinaryOk()
-{
-    DcpAppletMetadataFake::appletType = 
-        DcpAppletMetadataFake::TYPE_BINARY;
-    qPluginLoaderFakeSuccessful = true;
-    DcpAppletMetadata *metadata = new DcpAppletMetadata("dummy-binary");
-    m_subject = new DcpAppletPlugin(metadata);
-    QVERIFY(m_subject->applet());
-    QVERIFY(
-        dynamic_cast<DcpAppletPluginApplet*>(m_subject->applet())->initialized()
-        );
-    delete metadata;
-    QVERIFY(m_subject->isAppletLoaded());
-}
-
-/**
- * checks if appletloader returns 0 on load error and
- * errorMsg() contains the load error message coming from the QPluginLoader
- */
-void Ft_DcpAppletPlugin::testLoadBinaryError()
-{
-    DcpAppletMetadataFake::appletType = 
-        DcpAppletMetadataFake::TYPE_BINARY;
-    qPluginLoaderFakeSuccessful = false;
-    DcpAppletMetadata *metadata = new DcpAppletMetadata("dummy-binary");
-    m_subject = new DcpAppletPlugin(metadata);
-    QVERIFY(!m_subject->applet());
-    QVERIFY(m_subject->errorMsg().contains(fakeErrorMsg));
-    QVERIFY(!m_subject->isAppletLoaded());
-    delete metadata;
-}
-
-/**
- * TODO
- */
-void Ft_DcpAppletPlugin::testLoadDsl()
-{
-    DcpAppletMetadataFake::appletType = 
-        DcpAppletMetadataFake::TYPE_DSL;
-    QSKIP("TODO: test DSL loading", SkipAll);
-}
-
-
-/**
- * checks if metadata() returns the same pointer that was given in
- * initialization
- */
-void Ft_DcpAppletPlugin::testMetadata()
-{
-    DcpAppletMetadata *metadata = new DcpAppletMetadata("dummy-binary");
-    m_subject = new DcpAppletPlugin(metadata);
-    QVERIFY(m_subject->metadata() == metadata);
-    delete metadata;
-}
-
-void Ft_DcpAppletPlugin::testInterfaceVersion()
-{
-    DcpAppletMetadataFake::appletType = 
-        DcpAppletMetadataFake::TYPE_BINARY;
-    qPluginLoaderFakeSuccessful = true;
-    DcpAppletMetadata *metadata = new DcpAppletMetadata("dummy-binary");
-    m_subject = new DcpAppletPlugin(metadata);
-    QVERIFY(m_subject->applet());
-    QCOMPARE(m_subject->interfaceVersion(), 3);
-    delete m_subject;
-    qPluginLoaderFakeSuccessful = false;
-    m_subject = new DcpAppletPlugin(metadata);
-    QCOMPARE(m_subject->interfaceVersion(), -1);
-    delete metadata;
-}
-
-QTEST_APPLESS_MAIN(Ft_DcpAppletPlugin)
--- lib/tests/ft_dcpappletplugin/ft_dcpappletplugin.h
+++ lib/tests/ft_dcpappletplugin/ft_dcpappletplugin.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef FT_DCPAPPLETPLUGIN_H
-#define FT_DCPAPPLETPLUGIN_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-// the real unit/DcpAppletPlugin class declaration
-#include "dcpappletplugin.h"
-#include "dcpappletmetadata.h"
-
-Q_DECLARE_METATYPE(DcpAppletPlugin*);
-
-class Ft_DcpAppletPlugin : public QObject
-{
-    Q_OBJECT
-
-private slots:
-    void init();
-    void cleanup();
-    void initTestCase();
-    void cleanupTestCase();
-    void testLoadBinaryOk();
-    void testLoadBinaryError();
-    void testLoadDsl();
-    void testMetadata();
-    void testInterfaceVersion();
-
-private:
-    DcpAppletPlugin* m_subject;
-};
-
-#endif
--- lib/tests/ft_dcpappletplugin/ft_dcpappletplugin.pro
+++ lib/tests/ft_dcpappletplugin/ft_dcpappletplugin.pro
-include(../common_top.pri)
-
-INCLUDEPATH += $$system(find $$SRCDIR -type d)
-
-TARGET = ft_dcpappletplugin
-
-TEST_SOURCES = \
-    $$SRCDIR/appletdb/dcpappletplugin.cpp \
-
-# unit test and unit
-SOURCES += \
-    ft_dcpappletplugin.cpp \
-    ../doubles/mdesktopentry-fake.cpp \
-    ../doubles/fileDatas.cpp \
-    $$TEST_SOURCES \ 
-
-# base classes
-SOURCES += \
-
-
-# unit test and unit
-HEADERS += \
-    ft_dcpappletplugin.h \
-    $$SRCDIR/appletdb/dcpappletplugin.h \
-    dcpappletplugin-applet.h \
-    qpluginloader-fake.h \
-
-# base classes
-HEADERS += \
-
-
-# service classes
-HEADERS += \
-
-include(../common_bot.pri)
--- lib/tests/ft_dcpappletplugin/qpluginloader-fake.h
+++ lib/tests/ft_dcpappletplugin/qpluginloader-fake.h
-/***************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
-**
-** This file is part of duicontrolpanel.
-**
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#ifndef QPLUGINLOADER_FAKE_H__
-#define QPLUGINLOADER_FAKE_H__
-
-#include <QtDebug>
-#include "dcpappletplugin-applet.h"
-
-static bool qPluginLoaderFakeSuccessful = true;
-static const QString fakeErrorMsg("fake-error-msg");
-
-
-QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
-{
-    Q_UNUSED(fileName);
-    Q_UNUSED(parent);
-}
-
-QPluginLoader::~QPluginLoader() {}
-
-bool QPluginLoader::load()
-{
-    return qPluginLoaderFakeSuccessful;
-}
-
-QString QPluginLoader::errorString() const
-{
-    if (qPluginLoaderFakeSuccessful) {
-        return "";
-    }
-
-    return fakeErrorMsg;
-}
-
-QObject *QPluginLoader::instance()
-{
-    if (qPluginLoaderFakeSuccessful) {
-        return new DcpAppletPluginApplet();
-    }
-
-    return 0;
-}
-
-#endif
--- lib/tests/ft_dcpcontentbutton
+++ lib/tests/ft_dcpcontentbutton
+(directory)
--- lib/tests/ft_dcpcontentbutton/buttonapplet
+++ lib/tests/ft_dcpcontentbutton/buttonapplet
+(directory)
--- lib/tests/ft_dcpcontentbutton/buttonapplet/button.h
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/button.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef BUTTONAPPLET_H
+#define BUTTONAPPLET_H
+namespace Button
+{
+    enum
+     {
+        Main = 0 
+     // Here go ids of more applet pages if any
+     // Page1 = 1,
+     // Page2 = 2,
+    };
+    const int NoReferer = -1;
+}
+#endif // BUTTONAPPLET_H
--- lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.cpp
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.cpp
+#include <QtGui>
+#include <QDebug>
+#include <MAction>
+#include <MTheme>
+#include <DcpWidget>
+#include "buttonapplet.h"
+#include "button.h"
+#include "buttonbrief.h"
+
+Q_EXPORT_PLUGIN2(buttonapplet, ButtonApplet)
+
+void ButtonApplet::init()
+{
+    MTheme::loadCSS(DATADIR "/buttonapplet.css");
+};
+
+DcpWidget* ButtonApplet::constructWidget(int widgetId)
+{
+    Q_UNUSED(widgetId);
+    return 0;
+}
+
+QString ButtonApplet::title() const
+{
+    return "";
+}
+
+QVector<MAction*> ButtonApplet::viewMenuItems()
+{
+    QVector<MAction*> vector(1);
+    return vector;
+}
+
+DcpBrief* ButtonApplet::constructBrief(int)
+{
+    return new ButtonBrief();
+}
+
--- lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.css
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.css
+#LabelAbout {
+        color: #FFFFFF;
+        font: "Nokia Sans Cn" 16;
+}
+
--- lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.desktop
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.desktop
+[Desktop Entry]
+Type=DUIApplet
+Name=Button
+Icon=
+Exec=
+X-logical-id=qtn_sett_main_display
+X-translation-catalog=duicontrolpanel-skeletonapplet
+
+[DUI]
+X-DUIApplet-Applet=libdcpbuttonapplet.so
+X-DUIApplet-ImageLandscape=Widget_landscape_weather.png
+X-DUIApplet-ImagePortrait=Widget_portrait_weather.png
+
+[DCP]
+Category= Look & Feel
+Order=4
+WidgetType= Button
+
--- lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.h
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef BUTTONAPPLET_H
+#define BUTTONAPPLET_H
+
+#include <DcpAppletIf>
+#include <QObject>
+class DcpWidget;
+class MAction;
+
+class ButtonApplet : public QObject, public DcpAppletIf 
+{
+	Q_OBJECT
+	Q_INTERFACES(DcpAppletIf)
+
+public:
+    virtual void init();
+    virtual DcpWidget* constructWidget(int widgetId);
+    virtual QString title() const;
+    virtual QVector<MAction *> viewMenuItems();
+    virtual DcpBrief* constructBrief(int);
+};
+#endif // BUTTONAPPLET_H
--- lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.pro
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/buttonapplet.pro
+TOPDIR=../../..
+include ($$TOPDIR/dcpconfig.pri)
+TEMPLATE      = lib
+CONFIG       += plugin gui meegotouch silent debug
+INCLUDEPATH += $$system(find $$TOPDIR -type d)
+MOC_DIR	      = .moc
+OBJECTS_DIR   = .objects
+
+HEADERS       = buttonapplet.h \
+                buttonbrief.h
+
+SOURCES       = buttonapplet.cpp \
+                buttonbrief.cpp
+
+TARGET        = $$qtLibraryTarget(dcpbuttonapplet)
+
+                                                                                                                      
+DATADIR = /usr/lib/duicontrolpanel-tests/ft_dcpcontentbutton-data
+
+DEFINES += DATADIR=\\\"$$DATADIR\\\"
+
+desktop.files = buttonapplet.desktop
+desktop.path = $$DATADIR
+target.path = $$DATADIR
+css.files = buttonapplet.css
+css.path = $$DATADIR
+                                                                                                                      
+INSTALLS += target desktop css                   
+INSTALLS += \
+	    target \
+
--- lib/tests/ft_dcpcontentbutton/buttonapplet/buttonbrief.cpp
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/buttonbrief.cpp
+#include <DcpWidgetTypes>
+#include "buttonbrief.h"
+ButtonBrief::ButtonBrief():
+    m_ToggleState(true)
+{
+}
+
+QString ButtonBrief::valueText() const
+{
+    QString value = m_ToggleState ? "On" : "Off";
+    return value;
+}
+
+QString ButtonBrief::titleText() const
+{
+    return "Button-like applet";
+}
+
+bool ButtonBrief::toggle() const
+{
+    return m_ToggleState;
+}
+
+void ButtonBrief::setToggle (bool toggle)
+{
+    m_ToggleState = toggle;
+    emit valuesChanged();
+}
+
+int ButtonBrief::widgetTypeID() const
+{
+    return DcpWidgetType::Button;
+}
+
--- lib/tests/ft_dcpcontentbutton/buttonapplet/buttonbrief.h
+++ lib/tests/ft_dcpcontentbutton/buttonapplet/buttonbrief.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef BUTTONBRIEF_H
+#define BUTTONBRIEF_H
+
+#include <DcpBrief>
+
+class ButtonBrief: public DcpBrief{
+    Q_OBJECT
+public:
+    ButtonBrief();
+    virtual QString valueText() const;
+    virtual QString titleText() const;
+
+    virtual bool toggle() const;
+    virtual void setToggle (bool toggle);
+    virtual int widgetTypeID() const;
+
+private:
+    bool m_ToggleState;
+};
+
+
+#endif // BUTTONBRIEF
--- lib/tests/ft_dcpcontentbutton/ft_dcpcontentbutton.pro
+++ lib/tests/ft_dcpcontentbutton/ft_dcpcontentbutton.pro
+TEMPLATE      = subdirs
+CONFIG += ordered
+
+SUBDIRS += buttonapplet \
+           src \
+
+# for check:
+QMAKE_EXTRA_TARGETS += check
+check.commands = $$system(true)
+
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.commands = $$system(true)
+
--- lib/tests/ft_dcpcontentbutton/src
+++ lib/tests/ft_dcpcontentbutton/src
+(directory)
--- lib/tests/ft_dcpcontentbutton/src/ft_dcpcontentbutton.cpp
+++ lib/tests/ft_dcpcontentbutton/src/ft_dcpcontentbutton.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include "ft_dcpcontentbutton.h"
+#include <DcpAppletMetadata>
+#include <DcpAppletObject>
+
+const QString DesktopFile("/buttonapplet.desktop");
+
+void Ft_DcpContentButton::initTestCase()
+{
+    static int c = 0;
+    static QByteArray arg("dummyarg");
+    char *argp = arg.data();
+
+    qap = new QCoreApplication(c, &argp);
+    qInstallMsgHandler (0);
+    m_DesktopFile = QString(DATADIR) + DesktopFile;
+
+}
+
+void Ft_DcpContentButton::cleanupTestCase()
+{
+}
+
+void Ft_DcpContentButton::init()
+{
+    m_Target = new DcpContentButton();
+}
+
+void Ft_DcpContentButton::cleanup()
+{
+    delete m_Target;
+}
+
+void Ft_DcpContentButton::testConstructor()
+{
+    QVERIFY (m_Target);
+}
+
+void Ft_DcpContentButton::testSetApplet()
+{
+    m_Target->setApplet (0);
+    QVERIFY(!m_Target->applet());
+    DcpAppletMetadata *metadata = new DcpAppletMetadata(m_DesktopFile);
+    
+    QVERIFY(metadata);
+    DcpAppletObject* applet = new DcpAppletObject(metadata);
+    QVERIFY(applet->applet());
+    m_Target->setApplet (applet);
+    QVERIFY(m_Target->applet());
+    QCOMPARE(m_Target->applet(), applet);
+}
+
+void Ft_DcpContentButton::testMattiId()
+{
+    QString matti = "12345";
+    m_Target->setMattiID(matti);
+    QCOMPARE (m_Target->mattiID(), matti);
+}
+
+void Ft_DcpContentButton::testButtonPhases()
+{
+
+}
+
+QTEST_APPLESS_MAIN(Ft_DcpContentButton)
+
--- lib/tests/ft_dcpcontentbutton/src/ft_dcpcontentbutton.h
+++ lib/tests/ft_dcpcontentbutton/src/ft_dcpcontentbutton.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef FT_DCPCONTENTBUTTON_H
+#define FT_DCPCONTENTBUTTON_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include <DcpContentButton>
+
+class QCoreApplication;
+class Ft_DcpContentButton : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void initTestCase();
+    void cleanupTestCase();
+    void init();
+    void cleanup();
+
+    void testConstructor();
+    void testSetApplet();
+    void testMattiId();
+    void testButtonPhases();
+
+private:
+    DcpContentButton* m_Target;
+    QCoreApplication* qap;
+    QString m_DesktopFile;
+};
+
+#endif // FT_DCPCONTENTBUTTON_H
+
--- lib/tests/ft_dcpcontentbutton/src/src.pro
+++ lib/tests/ft_dcpcontentbutton/src/src.pro
+#include ($$[QT_INSTALL_DATA]/mkspecs/dcpconfig.pri)
+TOPDIR=../../..
+TEMPLATE      = app 
+QT += testlib
+INCLUDEPATH += $$system(find $$TOPDIR -type d)
+CONFIG       += meegotouch silent debug
+DATADIR = /usr/lib/duicontrolpanel-tests/ft_dcpcontentbutton-data
+
+DEFINES += DATADIR=\\\"$$DATADIR\\\"
+DEFINES += APPLET_LIBS=\\\"$$DATADIR\\\" DATADIR=\\\"$$DATADIR\\\" DESKTOP_DIR=\\\"$$DATADIR\\\" 
+DEFINES += MOSTUSEDCOUNTER_GCONFKEY=\\\"/apps/duicontrolpanel/usagecount\\\"
+
+# disable internal deprecation warnings:                                                                              DEFINES += DCP_DISABLE_DEPRECATION_WARNING
+TARGET = ft_dcpcontentbutton
+
+TEST_SOURCES = \
+    $$TOPDIR/src/widget/dcpcontentbutton.cpp \
+    $$TOPDIR/src/widget/dcpwidgettypes.cpp \
+    $$TOPDIR/src/appletdb/dcpappletmetadata.cpp \
+    $$TOPDIR/src/appletdb/dcpappletplugin.cpp \
+    $$TOPDIR/src/appletdb/dcpappletdb.cpp \
+    $$TOPDIR/src/appletdb/dcpappletobject.cpp \
+    $$TOPDIR/src/dcpdebug.cpp \
+    $$TOPDIR/src/appletdb/dcpmostusedcounter.cpp \
+
+# unit test and unit
+SOURCES += \
+    ft_dcpcontentbutton.cpp \
+    $$TEST_SOURCES \
+
+# base classes
+SOURCES += \
+
+
+# unit test and unit
+HEADERS += \
+    ft_dcpcontentbutton.h \
+    $$TOPDIR/src/widget/dcpcontentbutton.h \
+    $$TOPDIR/src/appletdb/dcpappletmetadata.h \
+    $$TOPDIR/src/appletdb/dcpappletplugin.h \
+    $$TOPDIR/src/appletdb/dcpappletdb.h \
+    $$TOPDIR/src/appletdb/dcpmostusedcounter.h \
+    $$TOPDIR/src/widget/dcpwidgettypes.h \
+    $$TOPDIR/src/appletdb/dcpappletobject.h \
+    $$TOPDIR/src/dcpdebug.h \
+
+# base classes
+HEADERS += \
+
+
+# service classes
+HEADERS += \
+
+
--- lib/tests/ft_dcpcontentitem/ft_dcpcontentitem.cpp
+++ lib/tests/ft_dcpcontentitem/ft_dcpcontentitem.cpp
@@ -18,13 +18,18 @@
 #include "ft_dcpcontentitem.h"
 #include "dcpappletobject.h"
 #include "dcpappletmetadata.h"
+#include <MApplication>
 
 void Ft_DcpContentItem::initTestCase()
 {
+    int argc = 1;
+    char *argv = (char *) "./ft_dcpcontentitem";
+    app = new MApplication(argc, &argv);
 }
 
 void Ft_DcpContentItem::cleanupTestCase()
 {
+    delete app;
 }
 
 void Ft_DcpContentItem::init()
--- lib/tests/ft_dcpcontentitem/ft_dcpcontentitem.h
+++ lib/tests/ft_dcpcontentitem/ft_dcpcontentitem.h
@@ -23,6 +23,7 @@
 
 #include <dcpcontentitem.h>
 
+class MApplication;
 class Ft_DcpContentItem : public QObject
 {
     Q_OBJECT
@@ -38,7 +39,7 @@
     void testMattiId();
 private:
     DcpContentItem* m_Target;
-
+    MApplication *app;
 };
 
 #endif // FT_DCPCONTENTITEM_H
--- lib/tests/ft_dcpcontentitem/ft_dcpcontentitem.pro
+++ lib/tests/ft_dcpcontentitem/ft_dcpcontentitem.pro
@@ -10,11 +10,11 @@
 # unit test and unit
 SOURCES += \
     ft_dcpcontentitem.cpp \
-    ../doubles/mcontentitem-fake.cpp \
-    ../doubles/mtheme-fake.cpp \
-    ../../../controlpanel/tests/doubles/dcpappletmetadata-fake.cpp \
-    ../../../controlpanel/tests/doubles/dcpappletplugin-fake.cpp \
-    ../../../controlpanel/tests/doubles/dcpappletobject-fake.cpp \
+#   ../doubles/mcontentitem-fake.cpp \
+#   ../doubles/mtheme-fake.cpp \
+#   ../../../controlpanel/tests/doubles/dcpappletmetadata-fake.cpp \
+#   ../../../controlpanel/tests/doubles/dcpappletplugin-fake.cpp \
+#   ../../../controlpanel/tests/doubles/dcpappletobject-fake.cpp \
     $$TEST_SOURCES \
 
 # base classes
@@ -24,7 +24,7 @@
 # unit test and unit
 HEADERS += \
     ft_dcpcontentitem.h \
-    ../../../controlpanel/tests/doubles/dcpappletplugin-applet.h \
+#    ../../../controlpanel/tests/doubles/dcpappletplugin-applet.h \
     $$SRCDIR/widget/dcpcontentitem.h \
 
 # base classes
--- lib/tests/tests.pro
+++ lib/tests/tests.pro
@@ -1,5 +1,8 @@
 TEMPLATE    = subdirs
 
+# this is only necessery because subprojects uses one compilation directory
+CONFIG += ordered
+
 contains(DCP_BUILD_FEATURES,coverage) {
   SUBDIRS = $$system(ls -1d ut_*/)
 } else {
--- lib/tests/ut_dcpappletplugin/qpluginloader-fake.h
+++ lib/tests/ut_dcpappletplugin/qpluginloader-fake.h
@@ -25,7 +25,9 @@
 static const QString fakeErrorMsg("fake-error-msg");
 
 
-QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
+QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent) :
+    d(0),
+    did_load(false)
 {
     Q_UNUSED(fileName);
     Q_UNUSED(parent);
--- lib/tests/ut_dcpappletplugin/ut_dcpappletplugin.cpp
+++ lib/tests/ut_dcpappletplugin/ut_dcpappletplugin.cpp
@@ -53,11 +53,11 @@
         DcpAppletMetadataFake::TYPE_BINARY;
     qPluginLoaderFakeSuccessful = true;
     DcpAppletMetadata *metadata = new DcpAppletMetadata("dummy-binary");
+    DcpAppletPluginApplet *appl = NULL;
     m_subject = new DcpAppletPlugin(metadata);
     QVERIFY(m_subject->applet());
-    QVERIFY(
-        dynamic_cast<DcpAppletPluginApplet*>(m_subject->applet())->initialized()
-        );
+    appl = dynamic_cast<DcpAppletPluginApplet*>(m_subject->applet());
+    QVERIFY(appl && appl->initialized());
     delete metadata;
     QVERIFY(m_subject->isAppletLoaded());
 }
@@ -110,7 +110,7 @@
     DcpAppletMetadata *metadata = new DcpAppletMetadata("dummy-binary");
     m_subject = new DcpAppletPlugin(metadata);
     QVERIFY(m_subject->applet());
-    QCOMPARE(m_subject->interfaceVersion(), 3);
+    QCOMPARE(m_subject->interfaceVersion(), 4);
     delete m_subject->d_ptr->appletInstance;
     m_subject->d_ptr->appletInstance = 0;
     QCOMPARE(m_subject->interfaceVersion(), -1);
--- lib/tests/ut_dcpcontentbutton
+++ lib/tests/ut_dcpcontentbutton
+(directory)
--- lib/tests/ut_dcpcontentbutton/ut_dcpcontentbutton.cpp
+++ lib/tests/ut_dcpcontentbutton/ut_dcpcontentbutton.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include "ut_dcpcontentbutton.h"
+#include "dcpcontentbutton_p.h"
+
+void Ut_DcpContentButton::initTestCase()
+{
+}
+
+void Ut_DcpContentButton::cleanupTestCase()
+{
+}
+
+void Ut_DcpContentButton::init()
+{
+    m_Target = new DcpContentButton();
+}
+
+void Ut_DcpContentButton::cleanup()
+{
+    delete m_Target;
+}
+
+void Ut_DcpContentButton::testConstructor()
+{
+    QVERIFY (m_Target);
+}
+
+void Ut_DcpContentButton::testSetApplet()
+{
+    m_Target->setApplet (0);
+    QVERIFY(!m_Target->d_ptr->m_Applet);
+
+    DcpAppletObject* applet =
+        new DcpAppletObject(new DcpAppletMetadata("fake"));
+    m_Target->setApplet (applet);
+
+    // was the applet set?
+    QCOMPARE (m_Target->d_ptr->m_Applet, applet);
+
+    // were the signals connected?
+    // ... TODO: briefChanged from the applet and clicked to the applet
+}
+
+void Ut_DcpContentButton::testMattiId()
+{
+    QString matti = "12345";
+    m_Target->setMattiID(matti);
+    QCOMPARE (m_Target->mattiID(), matti);
+}
+
+void Ut_DcpContentButton::testUpdateContents()
+{
+    
+}
+
+void Ut_DcpContentButton::testRetranslateUi()
+{
+    DcpAppletObject* applet =
+        new DcpAppletObject(new DcpAppletMetadata("fake"));
+    m_Target->setApplet (applet);
+
+    // test if updateText gets called on retranslateUi
+    m_Target->setText ("xxx");
+    m_Target->retranslateUi();
+    QCOMPARE (m_Target->text(), applet->text2());
+}
+
+void Ut_DcpContentButton::testShowHideEvent()
+{
+    DcpAppletObject* applet =
+        new DcpAppletObject(new DcpAppletMetadata("fake"));
+    m_Target->setApplet (applet);
+
+    // check if the widget updates on showEvent
+    m_Target->setText ("xxx");
+    m_Target->showEvent(0);
+    QCOMPARE (m_Target->text(), applet->text2());
+
+    // check if signals gets reconnected on showEvent
+    // ... TODO
+}
+
+void Ut_DcpContentButton::testUpdateText()
+{
+    DcpAppletObject* applet =
+        new DcpAppletObject(new DcpAppletMetadata("fake"));
+    m_Target->setApplet (applet);
+    m_Target->setText ("xxx");
+
+    m_Target->updateText();
+
+    // updates the texts:
+    QCOMPARE (m_Target->text(), QString("fake-text2"));
+}
+
+
+QTEST_APPLESS_MAIN(Ut_DcpContentButton)
+
--- lib/tests/ut_dcpcontentbutton/ut_dcpcontentbutton.h
+++ lib/tests/ut_dcpcontentbutton/ut_dcpcontentbutton.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef UT_DCPCONTENTBUTTON_H
+#define UT_DCPCONTENTBUTTON_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include <dcpcontentbutton.h>
+
+class Ut_DcpContentButton : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void initTestCase();
+    void cleanupTestCase();
+    void init();
+    void cleanup();
+
+    void testConstructor();
+    void testSetApplet();
+    void testMattiId();
+    void testUpdateContents();
+    void testRetranslateUi();
+    void testShowHideEvent();
+    void testUpdateText();
+
+private:
+    DcpContentButton* m_Target;
+
+};
+
+#endif // UT_DCPCONTENTBUTTON_H
+
--- lib/tests/ut_dcpcontentbutton/ut_dcpcontentbutton.pro
+++ lib/tests/ut_dcpcontentbutton/ut_dcpcontentbutton.pro
+include(../common_top.pri)
+
+INCLUDEPATH += $$system(find $$SRCDIR -type d)
+
+TARGET = ut_dcpcontentbutton
+
+TEST_SOURCES = \
+    $$SRCDIR/widget/dcpcontentbutton.cpp \
+
+# unit test and unit
+SOURCES += \
+    ut_dcpcontentbutton.cpp \
+    ../doubles/mtheme-fake.cpp \
+    ../../../controlpanel/tests/doubles/dcpappletmetadata-fake.cpp \
+    ../../../controlpanel/tests/doubles/dcpappletplugin-fake.cpp \
+    $$TEST_SOURCES \
+
+# base classes
+SOURCES += \
+
+
+# unit test and unit
+HEADERS += \
+    ut_dcpcontentbutton.h \
+    ../../../controlpanel/tests/doubles/dcpappletplugin-applet.h \
+    $$SRCDIR/widget/dcpcontentbutton.h \
+
+# base classes
+HEADERS += \
+
+
+# service classes
+HEADERS += \
+
+include(../common_bot.pri)
+
--- lib/tests/ut_dcpcontentitem/ut_dcpcontentitem.cpp
+++ lib/tests/ut_dcpcontentitem/ut_dcpcontentitem.cpp
@@ -78,13 +78,12 @@
 
     // test if updateText gets called on retranslateUi
     m_Target->setTitle ("xxx");
-    m_Target->updateText();
+    m_Target->retranslateUi();
     QCOMPARE (m_Target->title(), applet->text1());
 }
 
 void Ut_DcpContentItem::testShowHideEvent()
 {
-    QSKIP ("NB#170105 meegotouch bug", SkipSingle);
     DcpAppletObject* applet =
         new DcpAppletObject(new DcpAppletMetadata("fake"));
     m_Target->setApplet (applet);
--- lib/tests/ut_dcpretranslator
+++ lib/tests/ut_dcpretranslator
+(directory)
--- lib/tests/ut_dcpretranslator/ut_dcpretranslator.cpp
+++ lib/tests/ut_dcpretranslator/ut_dcpretranslator.cpp
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include <QObject>
+#include <QGraphicsSceneMouseEvent>
+
+#include <dcpretranslator.h>
+#include <dcpretranslator_p.h>
+#include <dcpappletmetadata.h>
+#include <filedatas.h>
+#include "mlocale-fake.h"
+#include "dcpappletdb.h"
+
+#include "ut_dcpretranslator.h"
+
+void Ut_DcpRetranslator::init()
+{
+    m_subject = DcpRetranslator::instance();
+    m_subject->priv->loadedTranslations.clear();
+}
+
+void Ut_DcpRetranslator::cleanup()
+{
+}
+
+void Ut_DcpRetranslator::initTestCase()
+{
+    desktopTestFile =  "test.desktop";
+    desktopBadTestFile = "testBad.desktop";
+
+    fileDatas[desktopTestFile]["Name"] = "Browser";
+    fileDatas[desktopTestFile]["Desktop Entry/Type"] = "DUIApplet";
+    fileDatas[desktopTestFile]["Desktop Entry/Icon"] = "";
+    fileDatas[desktopTestFile]["Desktop Entry/Exec"] = "";
+    fileDatas[desktopTestFile]["Desktop Entry/X-logical-id"] = "qtn_sett_main_browser";
+    fileDatas[desktopTestFile]["Desktop Entry/X-translation-catalog"] = "duisettings";
+    fileDatas[desktopTestFile]["DUI/X-DUIApplet-Applet"] = "testapplet.so";
+    fileDatas[desktopTestFile]["DUI/X-DUIApplet/ImageLandscape"] = "Widget_landscape_weather.png";
+    fileDatas[desktopTestFile]["DUI/X-DUIApplet-ImagePortrait"] = "Widget_portrait_weather.png";
+    fileDatas[desktopTestFile]["DUI/X-DUIApplet-ApplicationCommand"] = "./test";
+    fileDatas[desktopTestFile]["DUI/X-DUIApplet-Dslfile"] = "dslfile";
+    fileDatas[desktopTestFile]["DCP/Category"] = "Application";
+    fileDatas[desktopTestFile]["DCP/Order"] = "1";
+    fileDatas[desktopTestFile]["DCP/WidgetType"] = "DcpLabel2";
+    fileDatas[desktopTestFile]["DCP/Text2"] = "firefox";
+    fileDatas[desktopTestFile]["DCP/Align"] = "RIGHT";
+    fileDatas[desktopTestFile]["DCP/Image"] = "test.png";
+    fileDatas[desktopTestFile]["DCP/Part"] = "RobiJonMegKutyaraDer";
+    fileDatas[desktopTestFile]["DCP/Parent"] = "RobiJonMegKutyaraDer_II";
+    fileDatas[desktopTestFile]["isValid"] = "y";
+    fileDatas[desktopBadTestFile]["Desktop Entry/Name"] = "Browser";
+    fileDatas[desktopBadTestFile]["Desktop Entry/Type"] = "DUIApplet";
+    fileDatas[desktopBadTestFile]["Desktop Entry/Icon"] = "";
+    fileDatas[desktopBadTestFile]["Desktop Entry/Exec"] = "";
+    fileDatas[desktopBadTestFile]["Desktop Entry/X-logical-id"] = "qtn_sett_main_browser";
+    fileDatas[desktopBadTestFile]["Desktop Entry/X-translation-catalog"] = "";
+    fileDatas[desktopBadTestFile]["DUI/X-DUIApplet-Applet"] = "libexampleapplet.so";
+    fileDatas[desktopBadTestFile]["DUI/X-DUIApplet/ImageLandscape"] = "Widget_landscape_weather.png";
+    fileDatas[desktopBadTestFile]["DUI/X-DUIApplet-ImagePortrait"] = "Widget_portrait_weather.png";
+    fileDatas[desktopBadTestFile]["DCP/Category"] = "Application";
+    fileDatas[desktopBadTestFile]["DCP/Order"] = "1";
+    fileDatas[desktopBadTestFile]["DCP/WidgetType"] = "DcpLabel2";
+    fileDatas[desktopBadTestFile]["DCP/Text2"] = "firefox";
+    fileDatas[desktopBadTestFile]["isValid"] = "n";
+
+    DcpAppletDb::instance()->addFile (desktopTestFile);
+}
+
+void Ut_DcpRetranslator::cleanupTestCase()
+{
+}
+
+void Ut_DcpRetranslator::testInstance()
+{
+    QVERIFY(m_subject);
+    QCOMPARE((void*)m_subject, (void*)DcpRetranslator::instance());
+    QCOMPARE((void*)m_subject, (void*)m_subject->priv->instance);
+}
+
+void Ut_DcpRetranslator::testMainCatalogName()
+{
+    m_subject->setMainCatalogName("duisettings");
+    QCOMPARE(m_subject->priv->binaryName, QString("duisettings"));
+    m_subject->setMainCatalogName("settings");
+    QCOMPARE(m_subject->priv->binaryName, QString("settings"));
+}
+
+void Ut_DcpRetranslator::testEnsureTranslationsAreLoaded()
+{
+    DcpAppletMetadata metadata (desktopTestFile);
+    DcpAppletMetadataList list;
+    list << &metadata;
+
+    QVERIFY(!m_subject->priv->loadedTranslations.contains("duisettings"));
+    m_subject->ensureTranslationsAreLoaded (list);
+    QVERIFY(m_subject->priv->loadedTranslations.contains("duisettings"));
+    m_subject->priv->loadedTranslations.remove("duisettings");
+
+    // check that the default locale was correctly filled up:
+    QVERIFY (MLocale_installedCatalogs ().contains("duisettings"));
+}
+
+void Ut_DcpRetranslator::testEnsureTranslationLoaded()
+{
+    DcpAppletMetadata metadata (desktopTestFile);
+
+    QVERIFY(!m_subject->priv->loadedTranslations.contains("duisettings"));
+    m_subject->ensureTranslationLoaded (&metadata);
+    QVERIFY(m_subject->priv->loadedTranslations.contains("duisettings"));
+    m_subject->priv->loadedTranslations.remove("duisettings");
+
+    // check that the default locale was correctly filled up:
+    QVERIFY (MLocale_installedCatalogs ().contains("duisettings"));
+}
+
+void Ut_DcpRetranslator::testRetrenslate()
+{
+    // cleanup
+    m_subject->priv->loadedTranslations.clear();
+    m_subject->priv->loadedTranslations.insert("shouldBeRemoved");
+    QCOMPARE (DcpAppletDb::instance()->list().count(), 1);
+    DcpAppletDb::instance()->list().at(0)->markActive();
+
+    m_subject->retranslate();
+
+    // emptied the list of loaded translations:
+    QVERIFY (!m_subject->priv->loadedTranslations.contains("shouldBeRemoved"));
+    // loaded the catalogs for the active items:
+    QVERIFY (m_subject->priv->loadedTranslations.contains("duisettings"));
+
+    // checks that it does not load the catalogs again if run several times
+    m_subject->priv->loadedTranslations.clear();
+    m_subject->retranslate();
+    QVERIFY (m_subject->priv->loadedTranslations.isEmpty());
+}
+
+void Ut_DcpRetranslator::testLoadAppletTranslationOK()
+{
+    MLocale locale;
+    DcpAppletMetadata *metadata = new DcpAppletMetadata(desktopTestFile);
+    QVERIFY(!m_subject->priv->loadedTranslations.contains("duisettings"));
+    QVERIFY(m_subject->loadAppletTranslation(locale, metadata));
+    QVERIFY(m_subject->priv->loadedTranslations.contains("duisettings"));
+    m_subject->priv->loadedTranslations.remove("duisettings");
+
+    // check that the locale was correctly filled up:
+    QVERIFY (MLocale_catalogs (&locale).contains("duisettings"));
+
+    delete metadata;
+}
+
+void Ut_DcpRetranslator::testLoadAppletTranslationNOK()
+{
+    MLocale locale;
+    DcpAppletMetadata *metadata = new DcpAppletMetadata(desktopBadTestFile);
+    QVERIFY(!m_subject->priv->loadedTranslations.contains("duisettings"));
+    QVERIFY(!m_subject->loadAppletTranslation(locale, metadata));
+    QVERIFY(!m_subject->priv->loadedTranslations.contains("duisettings"));
+
+    delete metadata;
+}
+
+QTEST_APPLESS_MAIN(Ut_DcpRetranslator)
+
--- lib/tests/ut_dcpretranslator/ut_dcpretranslator.h
+++ lib/tests/ut_dcpretranslator/ut_dcpretranslator.h
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Karoliina T. Salminen <karoliina.t.salminen at nokia.com>
+**
+** This file is part of duicontrolpanel.
+**
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#ifndef UT_DCPRETRANSLATOR_H
+#define UT_DCPRETRANSLATOR_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+// the real unit/DcpRetranslator class declaration
+#include <dcpretranslator.h>
+
+Q_DECLARE_METATYPE(DcpRetranslator*);
+
+class Ut_DcpRetranslator : public QObject
+{
+    Q_OBJECT
+
+private slots:
+    void init();
+    void cleanup();
+    void initTestCase();
+    void cleanupTestCase();
+    void testInstance();
+    void testMainCatalogName();
+    void testEnsureTranslationsAreLoaded();
+    void testEnsureTranslationLoaded();
+    void testRetrenslate();
+    void testLoadAppletTranslationOK();
+    void testLoadAppletTranslationNOK();
+    
+    
+private:
+    DcpRetranslator* m_subject;
+    QString desktopTestFile;
+    QString desktopBadTestFile;
+};
+
+#endif
--- lib/tests/ut_dcpretranslator/ut_dcpretranslator.pro
+++ lib/tests/ut_dcpretranslator/ut_dcpretranslator.pro
+include(../common_top.pri)
+
+INCLUDEPATH += $$system(find $$SRCDIR -type d)
+
+TARGET = ut_dcpretranslator
+
+TEST_SOURCES = \
+    $$SRCDIR/dcpretranslator.cpp \
+
+# unit test and unit
+SOURCES += \
+    ut_dcpretranslator.cpp \
+    ../../../controlpanel/tests/doubles/mapplication-fake.cpp \ 
+    ../../../controlpanel/tests/doubles/mapplicationwindow-fake.cpp \ 
+    ../doubles/filedatas.cpp \
+    ../doubles/mdesktopentry-fake.cpp \
+    ../doubles/mgconfitem-fake.cpp \
+    ../doubles/mlocale-fake.cpp \
+    $$TEST_SOURCES \
+
+# base classes
+SOURCES += \
+
+
+# unit test and unit
+HEADERS += \
+    ut_dcpretranslator.h \
+    $$SRCDIR/dcpretranslator.h \
+    ../doubles/filedatas.h \
+    ../doubles/mgconfitem-fake.h \
+    ../doubles/mlocale-fake.h \
+
+# base classes
+HEADERS += \
+
+
+# service classes
+HEADERS += \
+
+
--- lib/tests/ut_dcpwidget/ut_dcpwidget.cpp
+++ lib/tests/ut_dcpwidget/ut_dcpwidget.cpp
@@ -17,6 +17,7 @@
 
 #include <QObject>
 #include <QGraphicsSceneMouseEvent>
+#include <QSignalSpy>
 
 #include <dcpwidget.h>
 #include <dcpwidget_p.h>
@@ -67,5 +68,26 @@
     QVERIFY(m_subject->pagePans()); // default behaviour
 }
 
+void Ut_DcpWidget::testProgressIndicator()
+{
+    // default value:
+    QVERIFY(!m_subject->isProgressIndicatorVisible());
+
+    QSignalSpy spy (m_subject, SIGNAL(inProgress(bool)));
+
+    // show it:
+    m_subject->setProgressIndicatorVisible(true);
+    QVERIFY(m_subject->isProgressIndicatorVisible());
+    QCOMPARE(spy.count(), 1);
+    QVERIFY(spy.takeFirst().at(0).toBool());
+
+    // hide it:
+    m_subject->setProgressIndicatorVisible(false);
+    QVERIFY(!m_subject->isProgressIndicatorVisible());
+    QCOMPARE(spy.count(), 1);
+    QVERIFY(!spy.takeFirst().at(0).toBool());
+}
+
 
 QTEST_APPLESS_MAIN(Ut_DcpWidget)
+
--- lib/tests/ut_dcpwidget/ut_dcpwidget.h
+++ lib/tests/ut_dcpwidget/ut_dcpwidget.h
@@ -39,6 +39,7 @@
     void testWidgetId();
     void testBack();
     void testPagePans();
+    void testProgressIndicator();
 private:
     DcpWidget* m_subject;
 };
--- lib/tests/ut_dcpwrongapplets/ut_dcpwrongapplets.cpp
+++ lib/tests/ut_dcpwrongapplets/ut_dcpwrongapplets.cpp
@@ -180,6 +180,23 @@
 }
 
 
+void Ut_DcpWrongApplets::testConnectSupervisorSignals()
+{
+    // check if signals get connected:
+    DcpWrongApplets::connectSupervisorSignals();
+
+    QVERIFY(connectedSignals.contains(SIGTERM));
+    QVERIFY(connectedSignals.contains(SIGHUP));
+    QVERIFY(connectedSignals.contains(SIGINT));
+    QVERIFY(connectedSignals.contains(SIGQUIT));
+    QVERIFY(connectedSignals.contains(SIGILL));
+    QVERIFY(connectedSignals.contains(SIGSEGV));
+    QVERIFY(connectedSignals.contains(SIGBUS));
+    QVERIFY(connectedSignals.contains(SIGABRT));
+    QVERIFY(connectedSignals.contains(SIGFPE));
+}
+
+
 void Ut_DcpWrongApplets::testInstanceNDestroy()
 {
     // some cleanup:
@@ -194,17 +211,6 @@
     QVERIFY (DcpWrongApplets::sm_Instance);
     QCOMPARE (wa, DcpWrongApplets::sm_Instance);
 
-    // check if signals get connected:
-    QVERIFY(connectedSignals.contains(SIGTERM));
-    QVERIFY(connectedSignals.contains(SIGHUP));
-    QVERIFY(connectedSignals.contains(SIGINT));
-    QVERIFY(connectedSignals.contains(SIGQUIT));
-    QVERIFY(connectedSignals.contains(SIGILL));
-    QVERIFY(connectedSignals.contains(SIGSEGV));
-    QVERIFY(connectedSignals.contains(SIGBUS));
-    QVERIFY(connectedSignals.contains(SIGABRT));
-    QVERIFY(connectedSignals.contains(SIGFPE));
-
     // ensure that removeBadsOnTimeStampChange gets called
     QVERIFY (conf.value().isValid());
 
--- lib/tests/ut_dcpwrongapplets/ut_dcpwrongapplets.h
+++ lib/tests/ut_dcpwrongapplets/ut_dcpwrongapplets.h
@@ -31,6 +31,7 @@
     void initTestCase();
     void cleanupTestCase();
 
+    void testConnectSupervisorSignals();
     void testBacktraceLineIsAnApplet();
     void testMarkAppletAsBad();
     void testSomeCrashHappened();
--- projects.pro
+++ projects.pro
@@ -26,6 +26,6 @@
   coverage.commands =      cd lib && make coverage && cd .. \
                         && cd controlpanel && make coverage && cd ..\
                         && genhtml --no-branch-coverage --legend -t \"libdcp and dcp unit test coverage\" -o coverage/ lib/tests/ut*/selected.cov controlpanel/tests/ut*/selected.cov
-#  QMAKE_DISTCLEAN += -r coverage/*
+  QMAKE_DISTCLEAN += -r coverage/*
 }
 
--- translations.pri
+++ translations.pri
@@ -76,7 +76,7 @@
 out = $$system($$LRELEASE -help)
 # the second parameter of contains can be a regexp!
 contains(out, .*markuntranslated.*) {
-    LRELEASE += -markuntranslated '!!\ '
+    LRELEASE += -markuntranslated '!!\\ '
 }
 
 TRANSLATIONS = $$prependAll(LANGUAGES, $$TRANSLATIONDIR/$${CATALOGNAME}_,.ts)

++++++ meegotouch-controlpanel.yaml
--- meegotouch-controlpanel.yaml
+++ meegotouch-controlpanel.yaml
@@ -1,6 +1,6 @@
 Name: meegotouch-controlpanel
 Summary: MeeGo Control Panel
-Version: 0.7.20.1
+Version: 0.8.4
 Release: 1
 Group: System/Libraries
 License: LGPL v2.1
@@ -8,7 +8,6 @@
 Sources:
     - "%{name}-%{version}.tar.bz2"
 Patches:
-    - meegotouchcontrolpanel-0.7.19-install-tests-with-qt4-tests.patch
     - meegotouchcontrolpanel-0.7.19-add-english-translations
 Description: MeeGo Control Panel 
 

++++++ deleted files:
--- meegotouchcontrolpanel-0.7.19-install-tests-with-qt4-tests.patch



More information about the MeeGo-commits mailing list