1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/***************************************************************************
tabs.cpp - description
-------------------
begin : Die Mai 20 2003
copyright : (C) 2003 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. *
* *
***************************************************************************/
#include "tabs.h"
#include "krenameimpl.h"
#include "kmyhistorycombo.h"
// TQt includes
#include <tqlayout.h>
#include <tqsizepolicy.h>
#include <tqtabwidget.h>
// KDE includes
#include <tdeapplication.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include <tdemenubar.h>
#include <tdemessagebox.h>
#include <kpushbutton.h>
#include <tdestartupinfo.h>
tabs::tabs(KRenameImpl* impl, TQRect r, TQWidget *parent, const char *name )
: TQDialog(parent,name)
{
setIcon( BarIcon( "krename" ) );
TQVBoxLayout* layout = new TQVBoxLayout( this, 6, 6 );
TQHBoxLayout* buttons = new TQHBoxLayout( 0, 6, 6 );
TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Expanding );
tab = new TQTabWidget( this );
finishButton = new KPushButton( i18n("&Finish"), this );
finishButton->setIconSet( SmallIconSet( "go-last" ) );
finishButton->setDefault( true );
cancelButton = new KPushButton( i18n("&Cancel"), this );
cancelButton->setIconSet( SmallIconSet( "button_cancel" ) );
buttons->addItem( spacer );
buttons->addWidget( finishButton );
buttons->addWidget( cancelButton );
layout->addWidget( tab );
layout->addLayout( buttons );
layout->setStretchFactor( tab, 2 );
menuBar = new KMenuBar( this );
layout->setMenuBar( menuBar );
connect( cancelButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( close() ) );
krename = impl ? impl : new KRenameImpl( this, menuBar, 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 ) ) );
connect( tab, TQT_SIGNAL( currentChanged( TQWidget* ) ), this, TQT_SLOT( slotTabChanged() ) );
if( impl )
{
krename->changeParent( this, menuBar, finishButton, r );
krename->setWizardMode( false );
} else
krename->setup( false );
// Tell TDEStartupInfo that KRename has been loaded completly
TDEStartupInfoId id;
id.initId( kapp->startupId() );
TDEStartupInfo::sendFinish( id );
}
tabs::~tabs()
{
}
void tabs::slotAddPage( TQWidget* page, const TQString & title )
{
tab->addTab( page, title );
}
void tabs::slotShowPage( int page )
{
tab->setCurrentPage( page - 1 );
}
void tabs::slotEnableFinish( bool b )
{
finishButton->setEnabled( b );
}
void tabs::slotTabChanged()
{
if( tab->currentPageIndex() == tab->count() - 1 )
{
krename->filename->setFocus();
krename->filename->lineEdit()->selectAll();
}
}
void tabs::keyPressEvent( TQKeyEvent *e )
{
// ESC should not close KRename
if( e->key() == TQt::Key_Escape )
e->accept();
else
e->ignore();
}
#include "tabs.moc"
|