KRename – powerful batch renamer
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /***************************************************************************
  2. wizard.cpp - description
  3. -------------------
  4. begin : Die Mai 15 15:34:19 CEST 2001
  5. copyright : (C) 2001 by Dominik Seichter
  6. email : domseichter@web.de
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. // Own includes
  17. #include "wizard.h"
  18. #include "krenameimpl.h"
  19. // KDE includes
  20. #include <tdeapplication.h>
  21. #include <kiconloader.h>
  22. #include <tdelocale.h>
  23. #include <tdemenubar.h>
  24. #include <tdemessagebox.h>
  25. #include <tdestartupinfo.h>
  26. // TQt includes
  27. #include <tqlabel.h>
  28. #include <tqlayout.h>
  29. #include <tqpushbutton.h>
  30. #include <tqsizepolicy.h>
  31. #include <tqvbox.h>
  32. wizard::wizard( KRenameImpl* impl, TQRect r, TQWidget* parent, const char* name )
  33. : KWizard( parent, name )
  34. {
  35. setIcon( BarIcon( "krename" ) );
  36. menuBar = new KMenuBar(this);
  37. krename = impl ? impl : new KRenameImpl( this, menuBar, this->finishButton() );
  38. connect( krename, TQT_SIGNAL( pageDone( TQWidget*, const TQString & ) ), this, TQT_SLOT( slotAddPage( TQWidget*, const TQString & ) ) );
  39. connect( krename, TQT_SIGNAL( showPage( int ) ), this, TQT_SLOT( slotShowPage( int ) ) );
  40. connect( krename, TQT_SIGNAL( enableFinish( bool ) ), this, TQT_SLOT( slotEnableFinish( bool ) ) );
  41. if( impl )
  42. {
  43. krename->changeParent( this, menuBar, this->finishButton(), r );
  44. krename->setWizardMode( true );
  45. } else
  46. krename->setup( true );
  47. // Tell TDEStartupInfo that KRename has been loaded completly
  48. TDEStartupInfoId id;
  49. id.initId( kapp->startupId() );
  50. TDEStartupInfo::sendFinish( id );
  51. // Disable ESC key
  52. cancelButton()->setAccel( TQKeySequence() );
  53. }
  54. wizard::~wizard()
  55. {
  56. }
  57. void wizard::slotAddPage( TQWidget* page, const TQString & title )
  58. {
  59. // exclude page 3 from wizard
  60. if( krename->title( 2 ) == title )
  61. {
  62. page->hide();
  63. return;
  64. }
  65. TQString t = title + i18n(" - Step %1 of %2").arg( pageCount()+1 ).arg( 3 );
  66. TQVBox* layout = new TQVBox( this );
  67. new TQLabel( TQString( t ).remove( title.find( "&" ), 1 ), layout );
  68. TQFrame* hbar1 = new TQFrame( layout, "<hr>", 0 );
  69. hbar1->setFrameStyle( TQFrame::Sunken + TQFrame::HLine );
  70. page->reparent( layout, TQPoint( 0, 0 ) );
  71. addPage( layout, t );
  72. setHelpEnabled( layout, false );
  73. }
  74. void wizard::slotShowPage( int page )
  75. {
  76. showPage( this->page( page - 1 ) );
  77. }
  78. void wizard::slotEnableFinish( bool b )
  79. {
  80. setFinishEnabled( page( pageCount() - 1), b );
  81. }
  82. void wizard::accept()
  83. {
  84. /** do nothing */
  85. }
  86. #include "wizard.moc"