phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/src/infowidget.cpp
changeset 27 2f8f8080a020
parent 22 6bb1b21d2484
child 30 ebdbd102c78a
equal deleted inserted replaced
22:6bb1b21d2484 27:2f8f8080a020
    26 #include <hbaction.h>
    26 #include <hbaction.h>
    27 #include <hbcheckbox.h>
    27 #include <hbcheckbox.h>
    28 #include <hbpushbutton.h>
    28 #include <hbpushbutton.h>
    29 #include <hbevent.h>
    29 #include <hbevent.h>
    30 #include <hbcolorscheme.h>
    30 #include <hbcolorscheme.h>
       
    31 #include <hbmessagebox.h>
       
    32 #include <hbframedrawer.h>
    31 #include <QPainter>
    33 #include <QPainter>
    32 #include <QPainterPath>
    34 #include <QPainterPath>
    33 #include <QBrush>
    35 #include <QBrush>
    34 #include <QGraphicsLinearLayout>
    36 #include <QGraphicsLinearLayout>
    35 #include <QApplication>
    37 #include <QApplication>
    38 #include "infowidgetlogging.h"
    40 #include "infowidgetlogging.h"
    39 #include "infowidgetengine.h"
    41 #include "infowidgetengine.h"
    40 #include "infowidgetlayoutmanager.h"
    42 #include "infowidgetlayoutmanager.h"
    41 #include "infowidgetpreferences.h"
    43 #include "infowidgetpreferences.h"
    42 
    44 
    43 const int INFOWIDGET_LINE_WIDTH = 0; 
       
    44 const int INFOWIDGET_MARGIN = 5;
       
    45 const int INFOWIDGET_ROUNDING = 15;
    45 const int INFOWIDGET_ROUNDING = 15;
    46 
    46 const int INFOWIDGET_DEFAULT_HEIGHT = 100;
       
    47 const int INFOWIDGET_DEFAULT_WIDTH = 100;
       
    48 const char *TS_FILE_OPERATOR_WIDGET = "operator_widget"; 
       
    49 const char *TS_FILE_COMMON = "common";
       
    50 const char *BACKGROUND_COLOR_GROUP_ID = "qtc_default_popup_normal"; 
       
    51 const char *BACKGROUND_FRAME_NAME = "qtg_fr_hswidget_normal"; 
       
    52 
       
    53 /*!
       
    54   \class InfoWidget
       
    55   \brief Operator info widget main class. 
       
    56 
       
    57    Implements HomeScreen specific slots and 
       
    58    graphical representation of the 
       
    59    Operator Info widget. 
       
    60 
       
    61    Derived from HbWidget.
       
    62     
       
    63 */
    47 
    64 
    48 /*!
    65 /*!
    49     InfoWidget::InfoWidget() 
    66     InfoWidget::InfoWidget() 
    50 */
    67 */
    51 InfoWidget::InfoWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
    68 InfoWidget::InfoWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
    52     : HbWidget(parent, flags),
    69     : HbWidget(parent, flags),
    53     m_engine(NULL), 
    70     m_engine(NULL), 
    54     m_preferences(NULL),
    71     m_preferences(NULL),
    55     m_layoutManager(NULL),
    72     m_layoutManager(NULL),
    56     m_layout(NULL),
    73     m_layout(NULL),
       
    74     m_frameDrawer(NULL),
    57     m_layoutChanging(false),
    75     m_layoutChanging(false),
    58     m_isDragEvent(false)
    76     m_dragEvent(false), 
       
    77     m_initialized(false)
    59 {
    78 {
    60     INSTALL_TRACE_MSG_HANDLER; 
    79     INSTALL_TRACE_MSG_HANDLER; 
    61     
    80     
    62     DPRINT << ": IN";
    81     DPRINT << ": IN";
    63     
    82     
    64     // Localization file loading
    83     // Localization file loading
    65     QTranslator translator; 
    84     installTranslator(TS_FILE_OPERATOR_WIDGET);
    66     QString lang = QLocale::system().name();
    85     installTranslator(TS_FILE_COMMON);
    67     QString path = "z:/resource/qt/translations/";
       
    68     DPRINT << ": loading translation: " << QString(path + "operator_widget_" + lang);
       
    69     bool translatorLoaded = translator.load(path + "operator_widget_" + lang);
       
    70     DPRINT << ": translator loaded: " << translatorLoaded; 
       
    71     if (translatorLoaded) {
       
    72         qApp->installTranslator(&translator);
       
    73         DPRINT << ": translator installed"; 
       
    74     }
       
    75     
    86     
    76     m_layoutManager = new InfoWidgetLayoutManager(this);
    87     m_layoutManager = new InfoWidgetLayoutManager(this);
    77     Q_ASSERT(m_layoutManager); 
    88     Q_ASSERT(m_layoutManager); 
    78     
    89     
    79     // Create network engine  
       
    80     m_engine = new InfoWidgetEngine(this); 
    90     m_engine = new InfoWidgetEngine(this); 
    81 
    91     Q_ASSERT(m_engine);
    82     // Create widget preference handler 
    92     
    83     m_preferences = new InfoWidgetPreferences(this);
    93     m_preferences = new InfoWidgetPreferences(this);
    84 
    94     Q_ASSERT(m_preferences);
    85     DPRINT << ": reading preferences from meta-object properties";
    95     
    86     initializePreferences();
    96     QObject::connect( m_preferences, SIGNAL(prefChanged(int,int)),
    87 
    97                     m_engine, SLOT(preferenceChanged(int,int)));
    88     // Create widget main layout 
    98     
       
    99     // Setup widget main layout 
    89     m_layout = new QGraphicsLinearLayout;    
   100     m_layout = new QGraphicsLinearLayout;    
    90     m_layout->setSpacing(0); 
   101     m_layout->setSpacing(0); 
    91     m_layout->setContentsMargins(0,0,0,0); 
   102     m_layout->setContentsMargins(0,0,0,0); 
    92     
       
    93     // Layout info display
       
    94     layoutInfoDisplay();
       
    95 
       
    96     setLayout(m_layout);
   103     setLayout(m_layout);
    97 
   104 
    98     // Read initial data from model
   105     // Read color definitions 
    99     updateInfoDisplay(); 
   106     m_backGroundColor = HbColorScheme::color(
   100     
   107             BACKGROUND_COLOR_GROUP_ID);
   101     QObject::connect(m_engine, SIGNAL(modelChanged()), 
   108     if (!m_backGroundColor.isValid()) {
   102             this, SLOT(readModel())); 
   109         m_backGroundColor = Qt::black; 
   103     
   110     }
   104     m_backGroundColor = HbColorScheme::color("popupbackground");
   111     
   105 
   112     // Create background frame drawer 
       
   113     m_frameDrawer = new HbFrameDrawer(
       
   114             BACKGROUND_FRAME_NAME, 
       
   115             HbFrameDrawer::NinePieces);
       
   116     Q_ASSERT(m_frameDrawer); 
       
   117     
       
   118     // Set widget initial size
       
   119     resize(INFOWIDGET_DEFAULT_WIDTH,
       
   120            INFOWIDGET_DEFAULT_HEIGHT); 
       
   121     
   106     DPRINT << ": OUT";
   122     DPRINT << ": OUT";
   107 }
   123 }
   108 
   124 
   109 /*!
   125 /*!
   110     InfoWidget::~InfoWidget() 
   126     InfoWidget::~InfoWidget() 
   118     for (int i=0; i < m_layout->count(); i++) {
   134     for (int i=0; i < m_layout->count(); i++) {
   119         DPRINT << ": item(" << i << ") removed from layout";
   135         DPRINT << ": item(" << i << ") removed from layout";
   120         m_layout->removeAt(i);
   136         m_layout->removeAt(i);
   121         } 
   137         } 
   122     
   138     
       
   139     if (m_frameDrawer) {
       
   140         delete m_frameDrawer;
       
   141         m_frameDrawer = NULL; 
       
   142     }
       
   143     
       
   144     // Remove and delete language translators 
       
   145     removeTranslators(); 
       
   146     
   123     DPRINT << ": OUT"; 
   147     DPRINT << ": OUT"; 
   124     UNINSTALL_TRACE_MSG_HANDLER;
   148     UNINSTALL_TRACE_MSG_HANDLER;
   125 }
   149 }
   126 
   150 
   127 /*!
   151 /*!
       
   152     InfoWidget::onInitialize()
       
   153     
       
   154     Called by HS framework, saved preference data
       
   155     is available when onInitialize() is called and 
       
   156     meta-object data reading should be done here      
       
   157 */
       
   158 void InfoWidget::onInitialize()
       
   159 {
       
   160     DPRINT << ": IN";
       
   161     
       
   162     m_initialized = true; 
       
   163     
       
   164     // Initialize preferences from meta-object data
       
   165     if (!readPersistentPreferences()) {
       
   166 
       
   167         // Reading failed, initialize default values  
       
   168         m_preferences->setPreference(InfoWidgetPreferences::DisplaySpn, 
       
   169                 DISPLAY_SETTING_ON);
       
   170         m_preferences->setPreference(InfoWidgetPreferences::DisplayMcn, 
       
   171                 DISPLAY_SETTING_ON);
       
   172         m_preferences->setPreference(InfoWidgetPreferences::DisplaySatText, 
       
   173                 DISPLAY_SETTING_ON);
       
   174     } 
       
   175     m_preferences->storePreferences(); 
       
   176     
       
   177     // Layout components 
       
   178     layoutInfoDisplay();
       
   179     m_layout->activate(); 
       
   180     
       
   181     // Read initial data from model
       
   182     updateInfoDisplay(); 
       
   183     
       
   184     // Listen for model changes 
       
   185     QObject::connect(m_engine, SIGNAL(modelChanged()), 
       
   186             this, SLOT(readModel())); 
       
   187 
       
   188     DPRINT << ": OUT";
       
   189 }
       
   190 
       
   191 /*!
       
   192     InfoWidget::onUninitialize() 
       
   193 */
       
   194 void InfoWidget::onUninitialize()
       
   195 {
       
   196     DPRINT;
       
   197     m_initialized = false; 
       
   198     m_engine->suspend(); 
       
   199 }
       
   200 
       
   201 /*!
       
   202     InfoWidget::onShow() 
       
   203 */
       
   204 void InfoWidget::onShow()
       
   205 {
       
   206     DPRINT;
       
   207     m_engine->resume(); 
       
   208 }
       
   209 
       
   210 /*!
       
   211     InfoWidget::onHide() 
       
   212 */
       
   213 void InfoWidget::onHide()
       
   214 {
       
   215     DPRINT;
       
   216     m_engine->suspend(); 
       
   217 }
       
   218 
       
   219 /*!
       
   220     InfoWidget::installTranslator() const
       
   221 */
       
   222 bool InfoWidget::installTranslator(QString translationFile)
       
   223 {
       
   224     DPRINT << ": IN";
       
   225 
       
   226     QString lang = QLocale::system().name();
       
   227     QString path = "z:/resource/qt/translations/";
       
   228     bool translatorLoaded(false);  
       
   229     
       
   230     QTranslator* widgetTranslator = new QTranslator;
       
   231     translatorLoaded = widgetTranslator->load(
       
   232             path + translationFile + "_" + lang);
       
   233     if (translatorLoaded) {
       
   234         qApp->installTranslator(widgetTranslator);
       
   235         m_translators.append(widgetTranslator); 
       
   236         DPRINT << ": translator installed: " << translationFile; 
       
   237     } else {
       
   238         delete widgetTranslator; 
       
   239         widgetTranslator = NULL; 
       
   240     }
       
   241     
       
   242     DPRINT << ": OUT";
       
   243     return translatorLoaded;
       
   244 }
       
   245 
       
   246 /*!
       
   247     InfoWidget::removeTranslators() const
       
   248 */
       
   249 void InfoWidget::removeTranslators()
       
   250 {
       
   251     DPRINT << ": IN";
       
   252 
       
   253     foreach (QTranslator *translator, m_translators) {
       
   254         qApp->removeTranslator(translator);
       
   255     }    
       
   256     qDeleteAll(m_translators);
       
   257     m_translators.clear();
       
   258     
       
   259     DPRINT << ": OUT";
       
   260 }
       
   261 
       
   262 /*!
   128     InfoWidget::boundingRect() const
   263     InfoWidget::boundingRect() const
   129 */
   264 */
   130 QRectF InfoWidget::boundingRect() const
   265 QRectF InfoWidget::boundingRect() const
   131 {
   266 {   
   132     DPRINT;
   267     return rect();
   133     
       
   134     QRectF rectF = rect();
       
   135     rectF.adjust(-INFOWIDGET_MARGIN, -INFOWIDGET_MARGIN, 
       
   136             INFOWIDGET_MARGIN, INFOWIDGET_MARGIN);
       
   137     
       
   138     return rectF;
       
   139 }
   268 }
   140 
   269 
   141 /*!
   270 /*!
   142     InfoWidget::shape() const
   271     InfoWidget::shape() const
   143     Return shape
   272     
       
   273     Return Operator widget's shape 
       
   274     according to currect display 
   144 */
   275 */
   145 QPainterPath InfoWidget::shape() const
   276 QPainterPath InfoWidget::shape() const
   146 {
   277 {
   147     DPRINT;    
   278     DPRINT;    
   148     
   279     
   149     QPainterPath path;
   280     QPainterPath path;
   150     path.addRoundRect(boundingRect(), INFOWIDGET_ROUNDING, INFOWIDGET_ROUNDING);
   281     if (m_layoutManager->currentDisplayRole() == 
       
   282                     InfoWidgetLayoutManager::InfoDisplay) {
       
   283         path.addRoundRect(boundingRect(), 
       
   284                 INFOWIDGET_ROUNDING, 
       
   285                 INFOWIDGET_ROUNDING);
       
   286     } else {
       
   287         path.addRect(boundingRect()); 
       
   288     }
   151     return path;
   289     return path;
   152 }
   290 }
   153 
   291 
   154 /*!
   292 /*!
   155     InfoWidget::sizeHint() 
   293     InfoWidget::sizeHint() 
   157 QSizeF InfoWidget::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const   
   295 QSizeF InfoWidget::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const   
   158 {
   296 {
   159     Q_UNUSED(which);
   297     Q_UNUSED(which);
   160     Q_UNUSED(constraint); 
   298     Q_UNUSED(constraint); 
   161     
   299     
   162     QSizeF requiredSize(70,160);
   300     QSizeF requiredSize(
   163     
   301             INFOWIDGET_DEFAULT_WIDTH,
   164     // Try to get size hint from docml content, if not found use default  
   302             INFOWIDGET_DEFAULT_HEIGHT);
   165     // size preference 
   303     
   166     if (m_layoutManager->currentDisplayRole() == 
   304     if (m_initialized) { 
   167                 InfoWidgetLayoutManager::InfoDisplay) {
   305         // Read size hint from docml content
   168         if (m_layoutManager->contentWidget()) {
   306         if (m_layoutManager->currentDisplayRole() == 
   169             requiredSize = m_layoutManager->contentWidget()->minimumSize();
   307                     InfoWidgetLayoutManager::InfoDisplay) {
       
   308             if (m_layoutManager->contentWidget()) {
       
   309                 requiredSize = m_layoutManager->contentWidget()->minimumSize();
       
   310                 // Height according number of rows, if 0 or 1 row use minimum size
       
   311                 int rowCount = m_preferences->visibleItemCount();
       
   312                 if (1 < rowCount) {
       
   313                         requiredSize.rheight() += (rowCount-1)*
       
   314                                 m_layoutManager->rowHeight();
       
   315                 }
   170             }
   316             }
   171     }
   317         }
   172     else if (m_layoutManager->currentDisplayRole() == 
   318         else if (m_layoutManager->currentDisplayRole() == 
   173             InfoWidgetLayoutManager::SettingsDisplay) {
   319                 InfoWidgetLayoutManager::SettingsDisplay) {
   174         requiredSize = QSizeF(250,250);
   320             if (m_layoutManager->contentWidget()) {
   175         if (m_layoutManager->contentWidget()) {
   321                 requiredSize= m_layoutManager->contentWidget()->size();
   176             requiredSize = m_layoutManager->contentWidget()->preferredSize();
   322                 }
   177             }
   323         } 
   178     } 
   324     } 
   179 
   325     
   180     DPRINT << ": returning size: " << requiredSize;
   326     DPRINT << ": returning size: " << requiredSize;
   181     return requiredSize; 
   327     return requiredSize; 
   182 }
   328 }
   183 
   329 
   184 /*!
   330 /*!
   185     InfoWidget::sizePolicy() 
   331     InfoWidget::sizePolicy() 
   186 */
   332 */
   187 QSizePolicy InfoWidget::sizePolicy () const 
   333 QSizePolicy InfoWidget::sizePolicy () const 
   188 {
   334 {
   189     DPRINT;
   335     DPRINT;
   190 
   336     return QSizePolicy(
   191     // Size tells the exact size for the widget    
   337             QSizePolicy::Fixed, 
   192     return QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 
   338             QSizePolicy::Fixed); 
   193 }
       
   194 
       
   195 /*!
       
   196     InfoWidget::onInitialize() 
       
   197 */
       
   198 void InfoWidget::onInitialize()
       
   199 {
       
   200     DPRINT << ": IN";
       
   201     
       
   202     // Initialize preferences from meta-object data 
       
   203     // set by homescreen framework. Homescreen framework 
       
   204     // has restored the properties before calling onInitialize  
       
   205     DPRINT << ": reading preferences from meta-object properties";
       
   206     initializePreferences();
       
   207     
       
   208     DPRINT << ": OUT";
       
   209 }
       
   210 
       
   211 /*!
       
   212     InfoWidget::onUninitialize() 
       
   213 */
       
   214 void InfoWidget::onUninitialize()
       
   215 {
       
   216     DPRINT;
       
   217 }
       
   218 
       
   219 /*!
       
   220     InfoWidget::onShow() 
       
   221 */
       
   222 void InfoWidget::onShow()
       
   223 {
       
   224     DPRINT;
       
   225 }
       
   226 
       
   227 /*!
       
   228     InfoWidget::onHide() 
       
   229 */
       
   230 void InfoWidget::onHide()
       
   231 {
       
   232     DPRINT;
       
   233 }
   339 }
   234 
   340 
   235 /*!
   341 /*!
   236     InfoWidget::updateItemsVisibility() 
   342     InfoWidget::updateItemsVisibility() 
   237 */
   343 */
   240     DPRINT <<": IN"; 
   346     DPRINT <<": IN"; 
   241     int layoutRows = 0; 
   347     int layoutRows = 0; 
   242     QList<QGraphicsWidget *> widgetsToHide; 
   348     QList<QGraphicsWidget *> widgetsToHide; 
   243     
   349     
   244     // Update layout according to item visibility settings
   350     // Update layout according to item visibility settings
   245     // 1. read visible items
   351     if (m_preferences->preference(InfoWidgetPreferences::DisplaySpn).compare(
   246     if (m_preferences->preference(InfoWidgetPreferences::DisplayHomeZone).compare(
       
   247             DISPLAY_SETTING_ON) == 0) {
   352             DISPLAY_SETTING_ON) == 0) {
   248         layoutRows++;
   353         layoutRows++;
   249     } else if (m_layoutManager->currentDisplayRole() != InfoWidgetLayoutManager::SettingsDisplay) {
   354     } else if (m_layoutManager->currentDisplayRole() != InfoWidgetLayoutManager::SettingsDisplay) {
   250         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleHomeZoneLabel); 
   355         m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSpnLabel); 
   251         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleHomeZoneIcon); 
   356         m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSpnIcon); 
   252     }
   357     }
   253     
   358 
   254     if (m_preferences->preference(InfoWidgetPreferences::DisplayMcn).compare(
   359     if (m_preferences->preference(InfoWidgetPreferences::DisplayMcn).compare(
   255             DISPLAY_SETTING_ON) == 0) {
   360             DISPLAY_SETTING_ON) == 0) {
   256         layoutRows++;
   361         layoutRows++;
   257     } else if (m_layoutManager->currentDisplayRole() != InfoWidgetLayoutManager::SettingsDisplay) {
   362     } else if (m_layoutManager->currentDisplayRole() != InfoWidgetLayoutManager::SettingsDisplay) {
   258         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleMcnMarqueeItem); 
   363         m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleMcnMarqueeItem); 
   259         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleMcnIcon); 
   364         m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleMcnIcon); 
   260     }
       
   261 
       
   262     if (m_preferences->preference(InfoWidgetPreferences::DisplayActiveLine).compare(
       
   263             DISPLAY_SETTING_ON) == 0) {
       
   264         layoutRows++;
       
   265     } else if (m_layoutManager->currentDisplayRole() != InfoWidgetLayoutManager::SettingsDisplay) {
       
   266         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleActiveLineLabel); 
       
   267         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleActiveLineIcon); 
       
   268     }
   365     }
   269     
   366     
   270     if (m_preferences->preference(InfoWidgetPreferences::DisplaySatText).compare(
   367     if (m_preferences->preference(InfoWidgetPreferences::DisplaySatText).compare(
   271             DISPLAY_SETTING_ON) == 0) {
   368             DISPLAY_SETTING_ON) == 0) {
   272         layoutRows++;
   369         layoutRows++;
   273     } else if (m_layoutManager->currentDisplayRole() != InfoWidgetLayoutManager::SettingsDisplay) {
   370     } else if (m_layoutManager->currentDisplayRole() != InfoWidgetLayoutManager::SettingsDisplay) {
   274         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleSatTextLabel); 
   371         m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSatMarqueeItem); 
   275         m_layoutManager->hideWidget(InfoWidgetLayoutManager::RoleSatTextIcon); 
   372         m_layoutManager->removeWidget(InfoWidgetLayoutManager::RoleSatTextIcon); 
   276     }
   373     }
   277     
   374     
   278     DPRINT << ": visible layout rows count: " << layoutRows;
   375     DPRINT << ": visible layout rows count: " << layoutRows;
   279     m_layoutManager->setLayoutRows(layoutRows);
   376     m_layoutManager->setLayoutRows(layoutRows);
   280 }
   377 }
   305                 m_layout->removeAt(i);
   402                 m_layout->removeAt(i);
   306                 } 
   403                 } 
   307             
   404             
   308             // Add content widget to main layout 
   405             // Add content widget to main layout 
   309             m_layout->addItem(contentWidget);
   406             m_layout->addItem(contentWidget);
   310             
       
   311             resize(contentWidget->preferredSize()); 
       
   312         }       
   407         }       
   313     }
   408     }
   314     
   409     
   315     m_layoutManager->showAll(); 
   410     m_layoutManager->showAll(); 
   316     updateItemsVisibility(); 
   411     updateItemsVisibility(); 
   317 
   412 
       
   413     m_layout->invalidate();
       
   414     m_layout->activate(); 
       
   415     
   318     endChanges(); 
   416     endChanges(); 
   319     
   417     
   320     DPRINT << ": OUT";
   418     DPRINT << ": OUT";
   321 }
   419 }
   322 
   420 
   346                 m_layout->removeAt(i);
   444                 m_layout->removeAt(i);
   347                 } 
   445                 } 
   348             
   446             
   349             // Add content widget to main layout 
   447             // Add content widget to main layout 
   350             m_layout->addItem(contentWidget); 
   448             m_layout->addItem(contentWidget); 
   351 
       
   352             resize(contentWidget->preferredSize()); 
       
   353         }
   449         }
   354         
   450         
   355         // Connect settings display widget signals 
   451         // Connect settings display widget signals 
   356         initializeSettingsDisplayItems(); 
   452         initializeSettingsDisplayItems(); 
   357     }
   453     }
   358      
   454      
   359     m_layoutManager->showAll(); 
   455     m_layoutManager->showAll(); 
   360 
       
   361     endChanges(); 
   456     endChanges(); 
   362     
   457     
   363     DPRINT << ": OUT";
   458     DPRINT << ": OUT";
   364 }
   459 }
   365 
   460 
   382     DPRINT << ": IN";
   477     DPRINT << ": IN";
   383     
   478     
   384     HbPushButton *okButton = qobject_cast<HbPushButton *>(m_layoutManager->getWidget(
   479     HbPushButton *okButton = qobject_cast<HbPushButton *>(m_layoutManager->getWidget(
   385             InfoWidgetLayoutManager::RoleOkButton));
   480             InfoWidgetLayoutManager::RoleOkButton));
   386     if (okButton) {
   481     if (okButton) {
   387         DPRINT << ": okButton has been returned from layout manager, connecting signal";
       
   388         QObject::connect(okButton, SIGNAL(clicked()), 
   482         QObject::connect(okButton, SIGNAL(clicked()), 
   389                 this, SLOT(settingsEditingFinished())); 
   483                 this, SLOT(settingsEditingFinished()), Qt::UniqueConnection); 
   390     }
   484     }
   391 
   485 
   392     // Connect display setting check boxes
   486     // Connect display setting check boxes
   393     HbCheckBox *homeZoneBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
   487     HbCheckBox *spnCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
   394             InfoWidgetLayoutManager::RoleHomeZoneCheckBox));
   488             InfoWidgetLayoutManager::RoleSpnCheckBox));
   395     if (homeZoneBox) {
   489     if (spnCheckBox) {
   396         DPRINT << ": homeZoneBox has been returned from layout manager, initializing";
   490         spnCheckBox->setChecked(m_preferences->isPreferenceSet(
   397         // Make checkable when home zone display is supported
   491                 InfoWidgetPreferences::DisplaySpn));
   398         homeZoneBox->setCheckable(false); 
   492         
   399         QObject::connect(homeZoneBox, SIGNAL(stateChanged(int)), 
   493         QObject::connect(spnCheckBox, SIGNAL(stateChanged(int)), 
   400                 this, SLOT(homeZoneDisplaySettingChanged(int))); 
   494                 this, SLOT(spnDisplaySettingChanged(int)), Qt::UniqueConnection); 
   401     }
   495     }
   402     
   496     
   403     HbCheckBox *mcnCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
   497     HbCheckBox *mcnCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
   404             InfoWidgetLayoutManager::RoleMcnCheckBox));
   498             InfoWidgetLayoutManager::RoleMcnCheckBox));
   405     if (mcnCheckBox) {
   499     if (mcnCheckBox) {
   406         mcnCheckBox->setChecked(true);
   500         mcnCheckBox->setChecked(m_preferences->isPreferenceSet(
   407         
   501                 InfoWidgetPreferences::DisplayMcn));
   408         DPRINT << ": mcnCheckBox has been returned from layout manager, connecting signal";
   502         
   409         QObject::connect(mcnCheckBox, SIGNAL(stateChanged(int)), 
   503         QObject::connect(mcnCheckBox, SIGNAL(stateChanged(int)), 
   410                 this, SLOT(mcnDisplaySettingChanged(int))); 
   504                 this, SLOT(mcnDisplaySettingChanged(int)), Qt::UniqueConnection); 
   411     }
       
   412     
       
   413     HbCheckBox *activeLineCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
       
   414             InfoWidgetLayoutManager::RoleActiveLineCheckBox));
       
   415     if (activeLineCheckBox) {
       
   416         // Make checkable when active line display is supported
       
   417         activeLineCheckBox->setCheckable(false); 
       
   418 
       
   419         DPRINT << ": activeLineCheckBox has been returned from layout manager, connecting signal";
       
   420         QObject::connect(activeLineCheckBox, SIGNAL(stateChanged(int)), 
       
   421                 this, SLOT(activeLineDisplaySettingChanged(int))); 
       
   422     }
   505     }
   423     
   506     
   424     HbCheckBox *satTextCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
   507     HbCheckBox *satTextCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
   425             InfoWidgetLayoutManager::RoleSatTextCheckBox));
   508             InfoWidgetLayoutManager::RoleSatTextCheckBox));
   426     if (satTextCheckBox) {
   509     if (satTextCheckBox) {
   427         // Make checkable when sat text display is supported
   510         satTextCheckBox->setChecked(m_preferences->isPreferenceSet(
   428         satTextCheckBox->setCheckable(false); 
   511                 InfoWidgetPreferences::DisplaySatText));
   429 
   512         
   430         DPRINT << ": satTextCheckBox has been returned from layout manager, connecting signal";
       
   431         QObject::connect(satTextCheckBox, SIGNAL(stateChanged(int)), 
   513         QObject::connect(satTextCheckBox, SIGNAL(stateChanged(int)), 
   432                 this, SLOT(satDisplaySettingChanged(int))); 
   514                 this, SLOT(satDisplaySettingChanged(int)), Qt::UniqueConnection); 
   433     }
   515     }
   434     
   516     
   435     DPRINT << ": OUT";
   517     DPRINT << ": OUT";
   436 }
   518 }
   437 
   519 
   438 /*!
   520 /*!
   439     InfoWidget::updateInfoDisplay() 
   521     InfoWidget::updateInfoDisplay() 
   440 */
   522 */
   441 void InfoWidget::updateInfoDisplay()
   523 void InfoWidget::updateInfoDisplay()
   442 {
   524 {
   443     DPRINT; 
   525     DPRINT << ": IN"; 
   444     
   526     
   445     QString text;
   527     if (m_layoutManager->currentDisplayRole() == 
   446     InfoWidgetEngine::ModelData modelData = m_engine->modelData(); 
   528             InfoWidgetLayoutManager::InfoDisplay )
   447 
   529         {
   448     HbLabel *homeZoneLabel = qobject_cast<HbLabel *>(m_layoutManager->getWidget(
   530         QString text;
   449             InfoWidgetLayoutManager::RoleHomeZoneLabel));
   531         InfoWidgetEngine::ModelData modelData = m_engine->modelData(); 
   450     if (homeZoneLabel && 
   532     
   451             m_layoutManager->currentDisplayRole() == InfoWidgetLayoutManager::InfoDisplay) {
   533         HbLabel *spnLabel = qobject_cast<HbLabel *>(m_layoutManager->getWidget(
   452         text = modelData.homeZoneTextTag(); 
   534                 InfoWidgetLayoutManager::RoleSpnLabel));
   453         homeZoneLabel->setPlainText(text);
   535         if (spnLabel) {
   454     }        
   536             if (m_engine->modelData().serviceProviderNameDisplayRequired()) {
   455     
   537                 text = modelData.serviceProviderName();  
   456     HbMarqueeItem *mcnMarqueeItem = qobject_cast<HbMarqueeItem *>(m_layoutManager->getWidget(
   538                 spnLabel->setPlainText(text);
   457             InfoWidgetLayoutManager::RoleMcnMarqueeItem));
   539             }
   458     if (mcnMarqueeItem && 
   540         }        
   459             m_layoutManager->currentDisplayRole() == InfoWidgetLayoutManager::InfoDisplay) {
   541         
   460         text = modelData.mcnName(); 
   542         HbMarqueeItem *mcnMarqueeItem = qobject_cast<HbMarqueeItem *>(m_layoutManager->getWidget(
   461         if (text.length()) {
   543                 InfoWidgetLayoutManager::RoleMcnMarqueeItem));
       
   544         if (mcnMarqueeItem) {
       
   545             text = modelData.mcnName(); 
   462             mcnMarqueeItem->setText(text);
   546             mcnMarqueeItem->setText(text);
   463                 
   547             
   464             // Set marquee animation looping mode to infinite
   548             // Set marquee animation looping mode to infinite
   465             mcnMarqueeItem->setLoopCount(-1); 
   549             mcnMarqueeItem->setLoopCount(-1); 
   466             
   550                 
   467             // Finally, start marquee animation
   551             // Finally, start marquee animation
   468             DPRINT << ": mcnMarqueeItem->isAnimating()"; 
   552             DPRINT << ": mcnMarqueeItem->isAnimating()"; 
   469             if (!mcnMarqueeItem->isAnimating()) {
   553             if (!mcnMarqueeItem->isAnimating()) {
   470                 DPRINT << ": mcnMarqueeItem->startAnimation()";   
   554                 DPRINT << ": mcnMarqueeItem->startAnimation()";   
   471                 mcnMarqueeItem->startAnimation();
   555                 mcnMarqueeItem->startAnimation();
   472             }
   556             }
   473         }
   557         }
   474     }
   558     
   475 
   559         HbMarqueeItem *satMarqueeItem = qobject_cast<HbMarqueeItem *>(m_layoutManager->getWidget(
   476     HbLabel *activeLineLabel = qobject_cast<HbLabel *>(m_layoutManager->getWidget(
   560                 InfoWidgetLayoutManager::RoleSatMarqueeItem));
   477             InfoWidgetLayoutManager::RoleActiveLineLabel));
   561         if (satMarqueeItem) {
   478     if (activeLineLabel && 
   562             text = modelData.satDisplayText(); 
   479             m_layoutManager->currentDisplayRole() == InfoWidgetLayoutManager::InfoDisplay) {
   563     
   480         text.setNum(modelData.activeLine());
   564             satMarqueeItem->setText(text);
   481         text.insert(0, hbTrId("Line: "));
   565             
   482     
   566             // Set marquee animation looping mode to infinite
   483         if (text.length()) {
   567             satMarqueeItem->setLoopCount(-1); 
   484             activeLineLabel->setPlainText(text);
   568                         
       
   569             // Finally, start marquee animation
       
   570             DPRINT << ": satMarqueeItem->isAnimating()"; 
       
   571             if (!satMarqueeItem->isAnimating()) {
       
   572                 DPRINT << ": mcnMarqueeItem->startAnimation()";   
       
   573                 satMarqueeItem->startAnimation();
       
   574             }
   485         }
   575         }
   486     }    
   576     }
   487 
       
   488     HbLabel *satTextLabel = qobject_cast<HbLabel *>(m_layoutManager->getWidget(
       
   489             InfoWidgetLayoutManager::RoleSatTextLabel));
       
   490     if (satTextLabel && 
       
   491             m_layoutManager->currentDisplayRole() == InfoWidgetLayoutManager::InfoDisplay) {
       
   492 
       
   493         text = modelData.satDisplayText(); 
       
   494 
       
   495         if (text.length()) {
       
   496             satTextLabel->setPlainText(text);
       
   497         }
       
   498     }    
       
   499 
       
   500 }
   577 }
   501 
   578 
   502 /*!
   579 /*!
   503     InfoWidget::readModel() 
   580     InfoWidget::readModel() 
   504     
   581     
   506 */
   583 */
   507 void InfoWidget::readModel()
   584 void InfoWidget::readModel()
   508 {
   585 {
   509     DPRINT << ": IN"; 
   586     DPRINT << ": IN"; 
   510 
   587 
   511     if (m_layoutManager->currentDisplayRole() == InfoWidgetLayoutManager::InfoDisplay) { 
   588     if (m_layoutManager->currentDisplayRole() == 
       
   589             InfoWidgetLayoutManager::InfoDisplay) { 
   512         updateInfoDisplay(); 
   590         updateInfoDisplay(); 
   513     }
   591     }
   514     DPRINT << ": OUT";
   592     DPRINT << ": OUT";
   515 }
   593 }
   516 
   594 
   527 }
   605 }
   528 
   606 
   529 /*!
   607 /*!
   530     InfoWidget::paint() 
   608     InfoWidget::paint() 
   531 */
   609 */
   532 void InfoWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
   610 void InfoWidget::paint(QPainter *painter, 
       
   611         const QStyleOptionGraphicsItem *option, 
       
   612         QWidget *widget)
   533 {
   613 {
   534     Q_UNUSED(option); 
   614     Q_UNUSED(option); 
   535     Q_UNUSED(widget);
   615     Q_UNUSED(widget);
   536     DPRINT;
   616     DPRINT;
   537 
   617 
   538     if (!m_layoutChanging) {
   618     if (!m_layoutChanging) {
   539         QBrush brush(Qt::white); 
   619         painter->save();
   540         if (m_backGroundColor.isValid()) {
   620         
   541             brush.setColor(m_backGroundColor);
   621         if (m_layoutManager->currentDisplayRole() == 
       
   622                 InfoWidgetLayoutManager::InfoDisplay) { 
       
   623             if (m_frameDrawer) {
       
   624                 m_frameDrawer->paint(painter,boundingRect());
       
   625             }
       
   626         } else {            
       
   627             QBrush brush(Qt::black); 
       
   628             QPainterPath path;
       
   629             path.addRoundRect(boundingRect(), 
       
   630                     INFOWIDGET_ROUNDING, 
       
   631                     INFOWIDGET_ROUNDING);
       
   632             painter->fillPath(path, brush);
   542         }
   633         }
   543         QRectF drawRect = boundingRect(); 
   634         
   544         drawRect.adjust( INFOWIDGET_LINE_WIDTH, INFOWIDGET_LINE_WIDTH, 
       
   545                          -INFOWIDGET_LINE_WIDTH, -INFOWIDGET_LINE_WIDTH );
       
   546         
       
   547         QPainterPath path;
       
   548         path.addRoundRect(drawRect, INFOWIDGET_ROUNDING, INFOWIDGET_ROUNDING);
       
   549     
       
   550         painter->save();
       
   551         painter->fillPath(path, brush);
       
   552         painter->restore();
   635         painter->restore();
   553     }
   636     }
   554 }
   637 }
   555 
   638 
   556 /*!
   639 /*!
   557     InfoWidget::mousePressEvent() 
   640     InfoWidget::mousePressEvent() 
   558 */
   641 */
   559 
       
   560 void InfoWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
   642 void InfoWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
   561 {
   643 {
   562     Q_UNUSED(event);
   644     Q_UNUSED(event);
   563     DPRINT; 
   645     
   564     
   646     // Clear flag 
   565     // Initialize flag 
   647     m_dragEvent = false; 
   566     m_isDragEvent = false; 
       
   567     
       
   568     DPRINT; 
       
   569 }
   648 }
   570 
   649 
   571 /*!
   650 /*!
   572     InfoWidget::mouseReleaseEvent() 
   651     InfoWidget::mouseReleaseEvent() 
   573 */
   652 */
   575 {
   654 {
   576     Q_UNUSED(event);
   655     Q_UNUSED(event);
   577 
   656 
   578     // If in info display and widget wasn't dragged 
   657     // If in info display and widget wasn't dragged 
   579     // change to settings display
   658     // change to settings display
   580     if ((!m_isDragEvent) && 
   659     if ((!m_dragEvent) && 
   581           m_layoutManager->currentDisplayRole() == 
   660           m_layoutManager->currentDisplayRole() == 
   582                   InfoWidgetLayoutManager::InfoDisplay) {
   661                   InfoWidgetLayoutManager::InfoDisplay) {
   583         DPRINT << ": layout settings display";
   662         DPRINT << ": layout settings display";
   584         layoutSettingsDisplay(); 
   663         layoutSettingsDisplay(); 
   585     }
   664     }
   586     
   665     
   587     m_isDragEvent = false; 
   666     // Clear flag 
       
   667     m_dragEvent = false; 
   588 }
   668 }
   589 
   669 
   590 /*!
   670 /*!
   591     InfoWidget::mouseMoveEvent() 
   671     InfoWidget::mouseMoveEvent() 
   592 */
   672 */
   593 void InfoWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
   673 void InfoWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
   594 {
   674 {
   595     Q_UNUSED(event);
   675     Q_UNUSED(event);
   596     
   676     
   597     // Mouse is moving after mouse press event
   677     // Mouse is moving 
   598     m_isDragEvent = true; 
   678     // after mouse press event
   599 }
   679     m_dragEvent = true; 
   600 
   680 }
   601 /*!
   681 
   602     InfoWidget::homeZoneDisplaySettingChanged() 
   682 /*!
   603 */
   683     InfoWidget::spnDisplaySettingChanged() 
   604 void InfoWidget::homeZoneDisplaySettingChanged(int state)
   684 */
       
   685 void InfoWidget::spnDisplaySettingChanged(int state)
   605 {
   686 {
   606     DPRINT << ": state: " << state;
   687     DPRINT << ": state: " << state;
   607     if (state == Qt::Checked){
   688     if (state == Qt::Checked){
   608         m_preferences->setPreference(InfoWidgetPreferences::DisplayHomeZone, DISPLAY_SETTING_ON);
   689         m_preferences->setPreference(InfoWidgetPreferences::DisplaySpn, DISPLAY_SETTING_ON);
   609     } else {
   690     } else {
   610         m_preferences->setPreference(InfoWidgetPreferences::DisplayHomeZone, DISPLAY_SETTING_OFF);
   691         m_preferences->setPreference(InfoWidgetPreferences::DisplaySpn, DISPLAY_SETTING_OFF);
   611     }
   692     }
   612 }
   693 }
   613 
   694 
   614 /*!
   695 /*!
   615     InfoWidget::mcnDisplaySettingChanged() 
   696     InfoWidget::mcnDisplaySettingChanged() 
   623         m_preferences->setPreference(InfoWidgetPreferences::DisplayMcn, DISPLAY_SETTING_OFF);
   704         m_preferences->setPreference(InfoWidgetPreferences::DisplayMcn, DISPLAY_SETTING_OFF);
   624     }
   705     }
   625 }
   706 }
   626 
   707 
   627 /*!
   708 /*!
   628     InfoWidget::activeLineDisplaySettingChanged() 
       
   629 */
       
   630 void InfoWidget::activeLineDisplaySettingChanged(int state)
       
   631 {
       
   632     DPRINT << ": state: " << state; 
       
   633     if (state == Qt::Checked){
       
   634         m_preferences->setPreference(InfoWidgetPreferences::DisplayActiveLine, DISPLAY_SETTING_ON);
       
   635     } else {
       
   636         m_preferences->setPreference(InfoWidgetPreferences::DisplayActiveLine, DISPLAY_SETTING_OFF);
       
   637     }
       
   638 }
       
   639 
       
   640 /*!
       
   641     InfoWidget::satDisplaySettingChanged() 
   709     InfoWidget::satDisplaySettingChanged() 
   642 */
   710 */
   643 void InfoWidget::satDisplaySettingChanged(int state)
   711 void InfoWidget::satDisplaySettingChanged(int state)
   644 {
   712 {
   645     DPRINT << ": state: " << state; 
   713     DPRINT << ": state: " << state; 
   737     DPRINT;
   805     DPRINT;
   738     m_preferences->setPreference(InfoWidgetPreferences::DisplaySatText, value);
   806     m_preferences->setPreference(InfoWidgetPreferences::DisplaySatText, value);
   739 }
   807 }
   740 
   808 
   741 /*!
   809 /*!
   742     InfoWidget::initializePreferences()
   810     InfoWidget::spnDisplay()
   743     
   811     
   744     Read initial Meta-object properties and store to preference handler. 
   812     Getter function for Meta-object property "spnDisplay" 
       
   813 */
       
   814 QString InfoWidget::spnDisplay()
       
   815 {
       
   816     DPRINT; 
       
   817     return m_preferences->preference(InfoWidgetPreferences::DisplaySpn);
       
   818 }
       
   819 
       
   820 /*!
       
   821     InfoWidget::setSpnDisplay()
       
   822     
       
   823     Setter function for Meta-object property "spnDisplay" 
       
   824 */
       
   825 void InfoWidget::setSpnDisplay(QString value)
       
   826 {
       
   827     DPRINT;
       
   828     m_preferences->setPreference(InfoWidgetPreferences::DisplaySpn, value);
       
   829 }
       
   830 
       
   831 /*!
       
   832     InfoWidget::readPersistentPreferences()
       
   833     
       
   834     Read Meta-object properties and store to preference handler. 
   745     Restores preferences from previous session.   
   835     Restores preferences from previous session.   
   746 */
   836 */
   747 void InfoWidget::initializePreferences()
   837 bool InfoWidget::readPersistentPreferences()
   748 {
   838 {
   749     DPRINT << ": IN";
   839     DPRINT << ": IN";
       
   840     bool changed(false); 
       
   841     
   750     QString propertyValue;
   842     QString propertyValue;
   751     
   843     
   752     propertyValue = QObject::property("homeZoneDisplay").toString();
   844     propertyValue = QObject::property("homeZoneDisplay").toString();
   753     m_preferences->setPreference(InfoWidgetPreferences::DisplayHomeZone, 
   845     m_preferences->setPreference(InfoWidgetPreferences::DisplayHomeZone, 
   754             propertyValue);
   846             propertyValue);
   763     
   855     
   764     propertyValue = QObject::property("satDisplay").toString();
   856     propertyValue = QObject::property("satDisplay").toString();
   765     m_preferences->setPreference(InfoWidgetPreferences::DisplaySatText, 
   857     m_preferences->setPreference(InfoWidgetPreferences::DisplaySatText, 
   766             propertyValue);
   858             propertyValue);
   767 
   859 
   768     // Check that at least one item is set visible. If not 
   860     propertyValue = QObject::property("spnDisplay").toString();
   769     // set default item(s) visible. TBD which items and how selected.   
   861     m_preferences->setPreference(InfoWidgetPreferences::DisplaySpn, 
   770     if (m_preferences->visibleItemCount() == 0) {
   862             propertyValue);
   771         DPRINT << ": no visible items initially, setting MCN on by default"; 
   863 
   772         m_preferences->setPreference(InfoWidgetPreferences::DisplayMcn, 
   864     // Check that at least one item is set visible and  
   773                 DISPLAY_SETTING_ON);
   865     // store preferences if true 
       
   866     if (m_preferences->validate()) {
       
   867         changed = m_preferences->storePreferences(); 
       
   868     } 
       
   869         
       
   870     DPRINT << ": OUT";
       
   871     return changed; 
       
   872 }
       
   873 
       
   874 /*!
       
   875     InfoWidget::initializeCheckBoxStates()
       
   876 */
       
   877 void InfoWidget::initializeCheckBoxStates()
       
   878 {
       
   879     DPRINT << ": IN";
       
   880 
       
   881     HbCheckBox *spnCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
       
   882             InfoWidgetLayoutManager::RoleSpnCheckBox));
       
   883     if (spnCheckBox) {
       
   884     spnCheckBox->setChecked(m_preferences->isPreferenceSet(
       
   885                 InfoWidgetPreferences::DisplaySpn));
       
   886     }
       
   887     
       
   888     HbCheckBox *mcnCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
       
   889             InfoWidgetLayoutManager::RoleMcnCheckBox));
       
   890     if (mcnCheckBox) {
       
   891         mcnCheckBox->setChecked(m_preferences->isPreferenceSet(
       
   892                 InfoWidgetPreferences::DisplayMcn));
       
   893     }
       
   894     
       
   895     HbCheckBox *satTextCheckBox = qobject_cast<HbCheckBox *>(m_layoutManager->getWidget(
       
   896             InfoWidgetLayoutManager::RoleSatTextCheckBox));
       
   897     if (satTextCheckBox) {
       
   898         satTextCheckBox->setChecked(m_preferences->isPreferenceSet(
       
   899                 InfoWidgetPreferences::DisplaySatText));
   774     }
   900     }
   775         
   901         
   776     DPRINT << ": OUT"; 
   902     DPRINT << ": OUT"; 
   777 }
   903 }
   778 
   904 
   781 */
   907 */
   782 void InfoWidget::settingsEditingFinished()
   908 void InfoWidget::settingsEditingFinished()
   783 {
   909 {
   784     DPRINT << ": IN";
   910     DPRINT << ": IN";
   785     
   911     
   786     layoutInfoDisplay();
   912     // Save settings data if validation succeeds 
   787     
   913     if (m_preferences->validate()) {
   788     updateInfoDisplay(); 
   914         DPRINT << ": switching to info display";
       
   915         
       
   916         // Store preferences if changed 
       
   917         if (m_preferences->storePreferences()) {
       
   918             // Signal Homescreen FW   
       
   919             emit setPreferences(
       
   920                     m_preferences->preferenceNames());
       
   921             }
       
   922         
       
   923         // ToDo: do only if settings have really changed 
       
   924         m_layoutManager->reloadWidgets(
       
   925                 InfoWidgetLayoutManager::InfoDisplay);
       
   926 
       
   927         // Switch to info display 
       
   928         layoutInfoDisplay();
       
   929         updateInfoDisplay();
       
   930         
       
   931     } else {
       
   932         DPRINT << ": staying in settings display";    
       
   933         // Display warning note
       
   934         settingsValidationFailed(); 
       
   935         
       
   936         // Restore check box states 
       
   937         initializeCheckBoxStates(); 
       
   938     }
   789     
   939     
   790     DPRINT << ": OUT";
   940     DPRINT << ": OUT";
   791 }
   941 }
   792 
   942 
   793 /*!
   943 /*!
   794     InfoWidget::startChanges()
   944     InfoWidget::startChanges()
   795 */
   945 */
   796 void InfoWidget::startChanges()
   946 void InfoWidget::startChanges()
   797 {
   947 {
   798     DPRINT << ": IN";
   948     DPRINT;
   799     
   949     m_layoutChanging = true; 
   800     m_layoutChanging = true;
       
   801     
       
   802     DPRINT << ": OUT";
       
   803 }
   950 }
   804 
   951 
   805 /*!
   952 /*!
   806     InfoWidget::endChanges()
   953     InfoWidget::endChanges()
   807 */
   954 */
   808 void InfoWidget::endChanges()
   955 void InfoWidget::endChanges()
   809 {
   956 {
   810     DPRINT << ": IN";
   957     DPRINT;
   811     
   958     m_layoutChanging = false; 
   812     m_layoutChanging = false;
       
   813     
       
   814     DPRINT << ": OUT";
       
   815 }
   959 }
   816 
   960 
   817 /*!
   961 /*!
   818    \reimp
   962    \reimp
   819 */
   963 */
   820 void InfoWidget::changeEvent(QEvent *event)
   964 void InfoWidget::changeEvent(QEvent *event)
   821 {
   965 {
   822    DPRINT << ": IN";
   966    DPRINT << ": IN";
   823    
   967    
   824    if (event->type() == HbEvent::ThemeChanged) {
   968    if (event->type() == HbEvent::ThemeChanged) {
   825        m_backGroundColor = HbColorScheme::color("popupbackground");
   969        DPRINT << ": HbEvent::ThemeChanged";
       
   970        m_backGroundColor = HbColorScheme::color(
       
   971                BACKGROUND_COLOR_GROUP_ID);
       
   972        if (!m_backGroundColor.isValid()) {
       
   973            m_backGroundColor = Qt::black; 
       
   974        }
   826    }
   975    }
   827    HbWidget::changeEvent( event );
   976    HbWidget::changeEvent(event);
   828    
   977    
   829    DPRINT << ": OUT";
   978    DPRINT << ": OUT";
   830 }
   979 }
   831 
   980 
       
   981 /*!
       
   982    InfoWidget::settingsValidationFailed()
       
   983 */
       
   984 void InfoWidget::settingsValidationFailed()
       
   985 {
       
   986    DPRINT << ": IN";
       
   987    
       
   988    if (m_layoutManager->currentDisplayRole() == 
       
   989                   InfoWidgetLayoutManager::SettingsDisplay) {
       
   990        HbMessageBox::warning(
       
   991                hbTrId("txt_operatorwidget_info_select_one"));
       
   992    }
       
   993 
       
   994    DPRINT << ": OUT";
       
   995 }
       
   996 
       
   997 
   832 // End of File. 
   998 // End of File. 
   833 
   999