/*************************************************************************** * Copyright (C) 2006 by Michael Kaufmann * * michael@enlighter.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "infopopup.h" #include #include #include #include #include #include #include #include #include #include #include using namespace std; infoPopup::infoPopup( QWidget* parent, const char* name, WFlags fl ) : QWidget ( parent, name, fl ) { if ( !name ) setName( "infoPopupBase" ); // setSizePolicy( QSizePolicy( ( QSizePolicy::SizeType ) 1, ( QSizePolicy::SizeType ) 1, 0, 0, sizePolicy().hasHeightForWidth() ) ); setSizePolicy( QSizePolicy( ( QSizePolicy::SizeType ) 2, ( QSizePolicy::SizeType ) 2, 0, 0, sizePolicy().hasHeightForWidth() ) ); infoPopupBaseLayout = new QGridLayout( this, 1, 1, 0, 2, "infoPopupBaseLayout" ); infoPopupBaseLayout->setResizeMode( QLayout::Minimum ); resize( QSize( 200, 50 ).expandedTo( minimumSizeHint() ) ); clearWState( WState_Polished ); } infoPopup::~infoPopup() {} // void infoPopup::message( const QString & title, const QString & status, const QString & ip, KPassivePopup * popup ) // { // KIconLoader * trayIcons = new KIconLoader( "kovpn" ); // // QPixmap icon = trayIcons->loadIcon( "messagebox_info", KIcon::Desktop ); // QVBox * vb = popup->standardView( title, QString::null, icon ); // // // infoPopup * myPopup = new infoPopup( vb ); // // myPopup->setLeftSpacing( icon.width() + KDialog::marginHint() - 2 ); // popup->setView( vb ); // // // myPopup->setStatusLabel( status ); // // if ( ip == QString::null ) { // // myPopup->removeLocalIPLabel(); // // myPopup->resize( QSize( 53, 20 ).expandedTo( myPopup->minimumSizeHint() ) ); // // myPopup->resize( QSize( 153, 40 ) ); // } else { // // myPopup->setLocalIPLabel( ip ); // } // popup->show(); // } void infoPopup::languageChange() {} void infoPopup::addLine( const QString & key, const QString & value ) { mLines[ key ].key = new QLabel( this, "key" ); mLines[ key ].key->setText( key ); // mLines[ key ].key->setAlignment( Qt::AlignAuto | Qt::AlignTop ); infoPopupBaseLayout->addWidget( mLines[ key ].key, mLines.count(), 1 ); mLines[ key ].value = new QLabel( this, "value" ); mLines[ key ].value->setText( value ); // mLines[ key ].value->setAlignment( Qt::AlignAuto | Qt::AlignTop ); infoPopupBaseLayout->addWidget( mLines[ key ].value, mLines.count(), 2 ); mLines[ key ].spacer = new QSpacerItem( 41, 20, QSizePolicy::Fixed, QSizePolicy::Minimum ); infoPopupBaseLayout->addItem( mLines[ key ].spacer, mLines.count(), 0 ); } void infoPopup::addLine( const QString & value ) { mLines[ value ].value = new QLabel( this, "value" ); mLines[ value ].value->setText( value ); mLines[ value ].value->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak ); infoPopupBaseLayout->addMultiCellWidget( mLines[ value ].value, mLines.count(), mLines.count(), 1, 2 ); mLines[ value ].spacer = new QSpacerItem( 41, 20, QSizePolicy::Fixed, QSizePolicy::Minimum ); infoPopupBaseLayout->addItem( mLines[ value ].spacer, mLines.count(), 0 ); } #include "infopopup.moc"