Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

idpage.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Form implementation generated from reading ui file 'idpage.ui'
00003 **
00004 ** Created: Sat Feb 22 12:08:18 2003
00005 **      by: The User Interface Compiler ($Id: idpage.cpp,v 1.2 2003/05/06 17:58:13 Sigma Exp $)
00006 **
00007 ** WARNING! All changes made in this file will be lost!
00008 ****************************************************************************/
00009 
00010 #include "idpage.h"
00011 
00012 #include <qvariant.h>
00013 #include <qpushbutton.h>
00014 #include <qwidgetstack.h>
00015 #include <qlayout.h>
00016 #include <qtooltip.h>
00017 #include <qwhatsthis.h>
00018 #include <qlabel.h>
00019 #include <qregexp.h>
00020 
00021 PLUGIN_FACTORY(IdPage,"id");
00022 
00023 /*
00024  *  Constructs a IdPage as a child of 'parent', with the 
00025  *  name 'name' and widget flags set to 'f'.
00026  */
00027 IdPage::IdPage( QWidget* parent, const char* name, Master * session, WFlags fl )
00028         : Page( parent, name, session, fl ) {
00029     if ( !name )
00030         setName( "IdPage" );
00031     IdPageLayout = new QGridLayout( this, 1, 1, 6, 6, "IdPageLayout");
00032 
00033     details_button = new QPushButton( this, "details_button" );
00034 
00035     IdPageLayout->addWidget( details_button, 1, 0 );
00036 
00037     update_button = new QPushButton( this, "update_button" );
00038 
00039     IdPageLayout->addWidget( update_button, 1, 2 );
00040 
00041     widgetStack = new QWidgetStack( this, "widgetStack" );
00042 
00043     idform = new IdForm(widgetStack, "idform");
00044     widgetStack->addWidget(idform, 0);
00045 
00046     browser = new MtpBrowser(widgetStack, "browser");
00047     widgetStack->addWidget(browser, 1);
00048 
00049     IdPageLayout->addMultiCellWidget( widgetStack, 0, 0, 0, 2 );
00050     QSpacerItem* spacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00051     IdPageLayout->addItem( spacer, 1, 1 );
00052     languageChange();
00053     resize( QSize(445, 308).expandedTo(minimumSizeHint()) );
00054     
00055     id = 1;
00056     switchPage();
00057     
00058     connect(details_button, SIGNAL(clicked()), SLOT(switchPage()));
00059     connect(update_button, SIGNAL(clicked()), SLOT(updatePage()));
00060     connect(browser,SIGNAL(linkClicked(const QString &)),
00061       session, SLOT(slotLinkClicked(const QString &)));
00062 }
00063 
00064 /*
00065  *  Destroys the object and frees any allocated resources
00066  */
00067 IdPage::~IdPage() {
00068     // no need to delete child widgets, Qt does it all for us
00069 }
00070 
00071 /*
00072  *  Sets the strings of the subwidgets using the current
00073  *  language.
00074  */
00075 void IdPage::languageChange() {
00076     setCaption( tr( "Form1" ) );
00077     details_button->setText( tr( "Details" ) );
00078     update_button->setText( tr( "Update" ) );
00079 }
00080 
00081 void IdPage::switchPage() {
00082     id = 1-id;
00083     if(id) details_button->setText(tr("Abstract"));
00084     else details_button->setText(tr("Details"));
00085     widgetStack->raiseWidget(id);
00086 }
00087 
00088 void IdPage::append(const QString &msg) {
00089     browser->append("<font face=fixed>" + msg + "</font>");    
00090     idform->append(msg);
00091 }
00092 
00093 void IdPage::updatePage() {
00094     QString newmsg("finger " + idform->login_label->text().replace(QRegExp("<[^>]*>"),"").stripWhiteSpace());
00095     browser->clear();
00096     getMaster()->send(newmsg);
00097 }

Generated on Sat May 10 15:09:26 2003 for qnet by doxygen1.3