• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

skipdlg.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
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 <kpushbutton.h>
00033 #include <kstdguiitem.h>
00034 
00035 #ifdef Q_WS_X11 
00036 #include <kwin.h>
00037 #endif
00038 
00039 using namespace KIO;
00040 
00041 SkipDlg::SkipDlg(QWidget *parent, bool _multi, const QString& _error_text, bool _modal ) :
00042   KDialog ( parent, "" , _modal )
00043 {
00044   // TODO : port to KDialogBase
00045   modal = _modal;
00046 
00047   // Set "StaysOnTop", because this dialog is typically used in kio_uiserver,
00048   // i.e. in a separate process.
00049 #ifdef Q_WS_X11 //FIXME(E): Implement for QT Embedded, mac & win32
00050   if (modal)
00051     KWin::setState( winId(), NET::StaysOnTop );
00052 #endif
00053 
00054   b0 = b1 = b2 = 0L;
00055 
00056   setCaption( i18n( "Information" ) );
00057 
00058   b0 = new KPushButton( KStdGuiItem::cancel(), this );
00059   connect(b0, SIGNAL(clicked()), this, SLOT(b0Pressed()));
00060 
00061   if ( _multi )
00062   {
00063     b1 = new QPushButton( i18n( "Skip" ), this );
00064     connect(b1, SIGNAL(clicked()), this, SLOT(b1Pressed()));
00065 
00066     b2 = new QPushButton( i18n( "Auto Skip" ), this );
00067     connect(b2, SIGNAL(clicked()), this, SLOT(b2Pressed()));
00068   }
00069 
00070   QVBoxLayout *vlayout = new QVBoxLayout( this, 10, 0 );
00071   // vlayout->addStrut( 360 );  makes dlg at least that wide
00072 
00073   QLabel * lb = new QLabel( _error_text, this );
00074   lb->setFixedHeight( lb->sizeHint().height() );
00075   lb->setMinimumWidth( lb->sizeHint().width() );
00076   vlayout->addWidget( lb );
00077 
00078   vlayout->addSpacing( 10 );
00079 
00080   QHBoxLayout* layout = new QHBoxLayout();
00081   vlayout->addLayout( layout );
00082   if ( b0 )
00083   {
00084     b0->setDefault( true );
00085     b0->setFixedSize( b0->sizeHint() );
00086     layout->addWidget( b0 );
00087     layout->addSpacing( 5 );
00088   }
00089   if ( b1 )
00090   {
00091     b1->setFixedSize( b1->sizeHint() );
00092     layout->addWidget( b1 );
00093     layout->addSpacing( 5 );
00094   }
00095   if ( b2 )
00096   {
00097     b2->setFixedSize( b2->sizeHint() );
00098     layout->addWidget( b2 );
00099     layout->addSpacing( 5 );
00100   }
00101 
00102   vlayout->addStretch( 10 );
00103   vlayout->activate();
00104   resize( sizeHint() );
00105 }
00106 
00107 SkipDlg::~SkipDlg()
00108 {
00109 }
00110 
00111 void SkipDlg::b0Pressed()
00112 {
00113   if ( modal )
00114     done( 0 );
00115   else
00116     emit result( this, 0 );
00117 }
00118 
00119 void SkipDlg::b1Pressed()
00120 {
00121   if ( modal )
00122     done( 1 );
00123   else
00124     emit result( this, 1 );
00125 }
00126 
00127 void SkipDlg::b2Pressed()
00128 {
00129   if ( modal )
00130     done( 2 );
00131   else
00132     emit result( this, 2 );
00133 }
00134 
00135 SkipDlg_Result KIO::open_SkipDlg( bool _multi, const QString& _error_text )
00136 {
00137   Q_ASSERT(kapp);
00138 
00139   SkipDlg dlg( 0L, _multi, _error_text, true );
00140   return (SkipDlg_Result) dlg.exec();
00141 }
00142 
00143 #include "skipdlg.moc"

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal