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