KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, QSystemTrayIcon *parent, int timeout ) { KPassivePopup *pop = new KPassivePopup( ); pop->setPopupStyle( popupStyle ); pop->setAutoDelete( true ); pop->setView( caption, text, icon ); pop->d->hideDelay = timeout; QPoint pos = pop->calculateNearbyPoint(parent->geometry()); pop->show(pos); pop->moveNear(parent->geometry()); return pop; }
KPassivePopup *KPassivePopup::message( int popupStyle, const QString &caption, const QString &text, const QPixmap &icon, WId parent, int timeout, const QPoint &p ) { KPassivePopup *pop = new KPassivePopup( parent ); pop->setPopupStyle( popupStyle ); pop->setAutoDelete( true ); pop->setView( caption, text, icon ); pop->d->hideDelay = timeout; if(p.isNull()) pop->show(); else pop->show(p); return pop; }
void BoxContainerItem::showPassivePopup(QWidget *parent, QPtrList< KornMailSubject > *list, int total, const QString &accountName, bool date) { KPassivePopup *popup = new KPassivePopup(parent, "Passive popup"); QVBox *mainvlayout = popup->standardView(i18n("KOrn - %1/%2 (total: %3)").arg(objId()).arg(accountName) .arg(total), "", QPixmap(), 0); QGrid *mainglayout = new QGrid(date ? 3 : 2 , mainvlayout, "Grid-Layout"); QLabel *title = new QLabel(i18n("From"), mainglayout, "from_label"); QFont font = title->font(); font.setBold(true); title->setFont(font); title = new QLabel(i18n("Subject"), mainglayout, "subject_label"); font = title->font(); font.setBold(true); title->setFont(font); if(date) { title = new QLabel(i18n("Date"), mainglayout, "date_label"); font = title->font(); font.setBold(true); title->setFont(font); } for(KornMailSubject *subject = list->first(); subject; subject = list->next()) { new QLabel(subject->getSender(), mainglayout, "from-value"); new QLabel(subject->getSubject(), mainglayout, "subject-value"); if(date) { QDateTime tijd; tijd.setTime_t(subject->getDate()); new QLabel(tijd.toString(), mainglayout, "date-value"); } } popup->setAutoDelete(true); //Now, now care for deleting these pointers. popup->setView(mainvlayout); popup->show(); //Display it }