You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
krename/krename/wizard.cpp

107 rivejä
3.2 KiB

/***************************************************************************
wizard.cpp - description
-------------------
begin : Die Mai 15 15:34:19 CEST 2001
copyright : (C) 2001 by Dominik Seichter
email : domseichter@web.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. *
* *
***************************************************************************/
// Own includes
#include "wizard.h"
#include "krenameimpl.h"
// KDE includes
#include <kapplication.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmenubar.h>
#include <kmessagebox.h>
#include <kstartupinfo.h>
// TQt includes
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
#include <tqsizepolicy.h>
#include <tqvbox.h>
wizard::wizard( KRenameImpl* impl, TQRect r, TQWidget* parent, const char* name )
: KWizard( parent, name )
{
setIcon( BarIcon( "krename" ) );
menuBar = new KMenuBar(this);
krename = impl ? impl : new KRenameImpl( this, menuBar, this->finishButton() );
connect( krename, TQT_SIGNAL( pageDone( TQWidget*, const TQString & ) ), this, TQT_SLOT( slotAddPage( TQWidget*, const TQString & ) ) );
connect( krename, TQT_SIGNAL( showPage( int ) ), this, TQT_SLOT( slotShowPage( int ) ) );
connect( krename, TQT_SIGNAL( enableFinish( bool ) ), this, TQT_SLOT( slotEnableFinish( bool ) ) );
if( impl )
{
krename->changeParent( this, menuBar, this->finishButton(), r );
krename->setWizardMode( true );
} else
krename->setup( true );
// Tell KStartupInfo that KRename has been loaded completly
KStartupInfoId id;
id.initId( kapp->startupId() );
KStartupInfo::sendFinish( id );
// Disable ESC key
cancelButton()->setAccel( TQKeySequence() );
}
wizard::~wizard()
{
}
void wizard::slotAddPage( TQWidget* page, const TQString & title )
{
// exclude page 3 from wizard
if( krename->title( 2 ) == title )
{
page->hide();
return;
}
TQString t = title + i18n(" - Step %1 of %2").tqarg( pageCount()+1 ).tqarg( 3 );
TQVBox* tqlayout = new TQVBox( this );
new TQLabel( TQString( t ).remove( title.find( "&" ), 1 ), tqlayout );
TQFrame* hbar1 = new TQFrame( tqlayout, "<hr>", 0 );
hbar1->setFrameStyle( TQFrame::Sunken + TQFrame::HLine );
page->reparent( tqlayout, TQPoint( 0, 0 ) );
addPage( tqlayout, t );
setHelpEnabled( tqlayout, false );
}
void wizard::slotShowPage( int page )
{
showPage( this->page( page - 1 ) );
}
void wizard::slotEnableFinish( bool b )
{
setFinishEnabled( page( pageCount() - 1), b );
}
void wizard::accept()
{
/** do nothing */
}