skipdlg.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "kio/skipdlg.h"
00020
00021 #include <stdio.h>
00022 #include <assert.h>
00023
00024 #include <qmessagebox.h>
00025 #include <qpushbutton.h>
00026 #include <qwidget.h>
00027 #include <qlayout.h>
00028 #include <qlabel.h>
00029
00030 #include <kapplication.h>
00031 #include <klocale.h>
00032 #include <kurl.h>
00033 #include <kwin.h>
00034
00035 using namespace KIO;
00036
00037 SkipDlg::SkipDlg(QWidget *parent, bool _multi, const QString& _error_text, bool _modal ) :
00038 KDialog ( parent, "" , _modal )
00039 {
00040
00041 modal = _modal;
00042
00043
00044
00045 #ifndef Q_WS_QWS //FIXME(E): Implement for QT Embedded
00046 if (modal)
00047 KWin::setState( winId(), NET::StaysOnTop );
00048 #endif
00049
00050 b0 = b1 = b2 = 0L;
00051
00052 setCaption( i18n( "Information" ) );
00053
00054 b0 = new QPushButton( i18n( "Cancel" ), this );
00055 connect(b0, SIGNAL(clicked()), this, SLOT(b0Pressed()));
00056
00057 b1 = new QPushButton( i18n( "Skip" ), this );
00058 connect(b1, SIGNAL(clicked()), this, SLOT(b1Pressed()));
00059
00060 if ( _multi )
00061 {
00062 b2 = new QPushButton( i18n( "Auto Skip" ), this );
00063 connect(b2, SIGNAL(clicked()), this, SLOT(b2Pressed()));
00064 }
00065
00066 QVBoxLayout *vlayout = new QVBoxLayout( this, 10, 0 );
00067
00068
00069 QLabel * lb = new QLabel( _error_text, this );
00070 lb->setFixedHeight( lb->sizeHint().height() );
00071 lb->setMinimumWidth( lb->sizeHint().width() );
00072 vlayout->addWidget( lb );
00073
00074 vlayout->addSpacing( 10 );
00075
00076 QHBoxLayout* layout = new QHBoxLayout();
00077 vlayout->addLayout( layout );
00078 if ( b0 )
00079 {
00080 b0->setDefault( true );
00081 b0->setFixedSize( b0->sizeHint() );
00082 layout->addWidget( b0 );
00083 layout->addSpacing( 5 );
00084 }
00085 if ( b1 )
00086 {
00087 b1->setFixedSize( b1->sizeHint() );
00088 layout->addWidget( b1 );
00089 layout->addSpacing( 5 );
00090 }
00091 if ( b2 )
00092 {
00093 b2->setFixedSize( b2->sizeHint() );
00094 layout->addWidget( b2 );
00095 layout->addSpacing( 5 );
00096 }
00097
00098 vlayout->addStretch( 10 );
00099 vlayout->activate();
00100 resize( sizeHint() );
00101 }
00102
00103 SkipDlg::~SkipDlg()
00104 {
00105 }
00106
00107 void SkipDlg::b0Pressed()
00108 {
00109 if ( modal )
00110 done( 0 );
00111 else
00112 emit result( this, 0 );
00113 }
00114
00115 void SkipDlg::b1Pressed()
00116 {
00117 if ( modal )
00118 done( 1 );
00119 else
00120 emit result( this, 1 );
00121 }
00122
00123 void SkipDlg::b2Pressed()
00124 {
00125 if ( modal )
00126 done( 2 );
00127 else
00128 emit result( this, 2 );
00129 }
00130
00131 SkipDlg_Result KIO::open_SkipDlg( bool _multi, const QString& _error_text )
00132 {
00133 Q_ASSERT(kapp);
00134
00135 SkipDlg dlg( 0L, _multi, _error_text, true );
00136 return (SkipDlg_Result) dlg.exec();
00137 }
00138
00139 #include "skipdlg.moc"
This file is part of the documentation for kdelibs Version 3.1.0.