void QSkinDialog::restore() { if(minimized) { setMinimized(false); emit needToShow(); } else if(isHidden()) { show(); } else { emit needToShow(); } }
void UnlockNotifications::updateContents () { UnlockMissedEvents::Types mostRecent = UnlockMissedEvents::getInstance ().getLastType (); if (mostRecent == UnlockMissedEvents::NotifyLast) { emit needToShow (false); /* * Clear out all the missed events... */ foreach (MLabel *label, m_labels) delete label; m_labels.clear (); foreach (MImageWidget *icon, m_icons) delete icon; m_icons.clear (); m_last_subject->setText (""); m_last_icon->setImage (""); } else { emit needToShow (true); /* * It seems that we don't get the signal, forcing it manually to detect * the orientation. */ if (sceneManager()) orientationChanged (sceneManager()->orientation()); /* * Check the actually shown most-recent notification * type... (yeah it is hacky a bit...) */ int actualType = m_icon_ids.key (m_last_icon->image ()); int eventCount = UnlockMissedEvents::getInstance ().getCount (mostRecent); /* * Sms and call must be the highest priority.... * [so it should shown as most recent even there * are newer other events...] */ if (((actualType != UnlockMissedEvents::NotifySms) && (actualType != UnlockMissedEvents::NotifyCall)) || (mostRecent == UnlockMissedEvents::NotifySms) || (mostRecent == UnlockMissedEvents::NotifyCall)) { m_last_icon->setImage (m_icon_ids[mostRecent], QSize (ICON_SIZE, ICON_SIZE)); QString mostRecentText = UnlockMissedEvents::getInstance ().getLastSubject (mostRecent); if (eventCount > 1) { switch (mostRecent) { case UnlockMissedEvents::NotifyCall: mostRecentText = //% "%1 missed calls" qtTrId ("qtn_scrl_missed_call").arg (eventCount); break; case UnlockMissedEvents::NotifySms: mostRecentText = //% "%1 text messages" qtTrId ("qtn_scrl_sms").arg (eventCount); break; case UnlockMissedEvents::NotifyEmail: mostRecentText = //% "%1 emails" qtTrId ("qtn_scrl_email").arg (eventCount); break; case UnlockMissedEvents::NotifyMessage: mostRecentText = //% "%1 chats" qtTrId ("qtn_scrl_chat").arg (eventCount); break; default: break; } } m_last_subject->setText (mostRecentText); } if (m_labels.value (mostRecent, 0) != 0) { /* * Icon+Label exists remove it from the layout */ m_icon_layout->removeItem (m_labels.value (mostRecent)); m_icon_layout->removeItem (m_icons.value (mostRecent)); } else { /* * Create the label & icon */ m_labels[mostRecent] = new MLabel; m_labels[mostRecent]->setObjectName ("LockNotifierLabel"); m_icons[mostRecent] = new MImageWidget; m_icons[mostRecent]->setImage (m_icon_ids[mostRecent], QSize (ICON_SIZE, ICON_SIZE)); m_icons[mostRecent]->setZoomFactor (1.0); m_icons[mostRecent]->setObjectName ("LockNotifierIcon"); } m_labels[mostRecent]->setText (QString ("%L1").arg (eventCount)); /* * Most recent area only visible when orientation is portrait */ int newIndex = (m_mostrecent_area->isVisible () == false) ? 2 : 0; /* Somehow isVisible sometimes lying at first call :-S */ if (m_icon_layout->count () == 0) newIndex = 0; /* * Put the new icons to the proper place... */ m_icon_layout->insertItem (newIndex, m_labels[mostRecent]); m_icon_layout->setAlignment (m_labels[mostRecent], Qt::AlignLeft); m_icon_layout->insertItem (newIndex, m_icons[mostRecent]); m_icon_layout->setAlignment (m_icons[mostRecent], Qt::AlignLeft); } }