Exemplo n.º 1
0
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
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
/**
 * @short Shows a popup
 * @author Rene Schmidt <*****@*****.**>
 * @version 0.1
 */
void KLAidWidget::showPopUp(QString &caption, QString &text, uint &tOut)
{
  // Tell user when the next popup will be shown
  QToolTip::add(tray, i18n("K Learning Aid %1").arg(VER) + "\nNext PopUp will be shown at " + aut->projectTime(aut->getInterval()));

 // this is a candidate for subclassing... Copied in part from kpassivepopup.cpp (c) by KDE Team
    KPassivePopup *pop = new KPassivePopup( tray );

    pop->setPaletteForegroundColor(*tmpFgColor);
    pop->setPaletteBackgroundColor(*tmpBgColor);
    
    QVBox *vb = new QVBox( pop );
    vb->setSpacing( KDialog::spacingHint() );
 
      QHBox *hb=0;
      hb = new QHBox(vb);
      hb->setMargin(0);
      hb->setSpacing(KDialog::spacingHint() );
      QLabel *ttlIcon=0;
      ttlIcon = new QLabel( hb, "title_icon" );
      ttlIcon->setPixmap( SmallIcon("ktimer") );
      ttlIcon->setAlignment( AlignLeft );

      if ( !caption.isEmpty() ) {
        QLabel *ttl=0;
        ttl = new QLabel(caption, hb ? hb : vb, "title_label");
  
        ttl->setFont( *fntCaption );
        ttl->setAlignment( Qt::AlignHCenter );
            if ( hb )
                hb->setStretchFactor( ttl, 10 ); // enforce centering
      }
  
      if ( !text.isEmpty() ) {
        QLabel *msg=0;
        msg = new QLabel( text, vb, "msg_label" );
        msg->setFont( *fntBody );
        msg->setAlignment( AlignLeft );
      }

    pop->setTimeout(tOut);
    //pop->setView( title, txt, SmallIcon("ktimer"));
    pop->setView(vb);
    pop->show();
}
Exemplo n.º 5
0
void TrayIcon::showPassivePopup(const QString & msg,const QString & title)
{
	KPassivePopup* p = KPassivePopup::message(KPassivePopup::Boxed,title,msg,m_kt_pix, this);
	p->setPalette(QToolTip::palette());
	p->setLineWidth(1);
}