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
|
/***************************************************************************
dsdirselectdialog.cpp - description
-------------------
begin : Sat Jan 03 2004
copyright : (C) 2004 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 "dsdirselectdialog.h"
// TQt includes
#include <tqcheckbox.h>
#include <tqhbox.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqtooltip.h>
#include <tqvbox.h>
// KDE includes
#include <kdiroperator.h>
#include <klocale.h>
#include <kurlcombobox.h>
DSDirSelectDialog::DSDirSelectDialog( TQWidget* parent )
: KFileDialog( ":KRename", "*", parent, 0, false )
{
setOperationMode( KFileDialog::Opening );
setMode( KFile::Files | KFile::ExistingOnly );
TQVBox* vbox = new TQVBox( this );
if( tqlayout() )
tqlayout()->add( vbox );
else
qDebug("KFileDialog does not have a tqlayout!!!");
checkDir = new TQCheckBox( i18n("Add directory names &with filenames"), vbox );
check = new TQCheckBox( i18n("Add subdirectories &recursively"), vbox );
TQHBox* hbox = new TQHBox( vbox );
TQWidget* spacer = new TQWidget( hbox );
spacer->setMinimumWidth( 20 );
checkHidden = new TQCheckBox( i18n("Add &hidden directories"), hbox );
hbox->setStretchFactor( checkHidden, 4 );
checkOnlyDir = new TQCheckBox( i18n("Add directory names only"), vbox );
connect( check, TQT_SIGNAL( clicked() ), this, TQT_SLOT( enableControls() ));
TQToolTip::add( check, i18n("Walk recursively through the directory tree and add also the content of all subdirectories to the list of files to rename.") );
TQToolTip::add( checkHidden, i18n("If not checked, KRename will ignore directories starting with a dot during recursive adding.") );
TQToolTip::add( checkOnlyDir, i18n("Add only the directory names and not the names of the files in the directory to KRename.") );
TQToolTip::add( checkDir, i18n("This option causes KRename to add also the name of the base directory of the selected files to its list.") );
enableControls();
}
bool DSDirSelectDialog::recursively() const
{
return check->isChecked();
}
bool DSDirSelectDialog::hidden() const
{
return checkHidden->isChecked();
}
bool DSDirSelectDialog::dirs() const
{
return checkDir->isChecked();
}
bool DSDirSelectDialog::onlyDirs() const
{
return checkOnlyDir->isChecked();
}
void DSDirSelectDialog::setRecursively( bool b )
{
check->setChecked( b );
}
void DSDirSelectDialog::enableControls()
{
checkHidden->setEnabled( check->isChecked() );
}
void DSDirSelectDialog::slotOk()
{
const KFileItemList *items = ops->selectedItems();
if ( !items || items->isEmpty() )
{
KDialogBase::accept();
} else
KFileDialog::slotOk();
}
KURL::List DSDirSelectDialog::selectedURLs()
{
KURL::List list = KFileDialog::selectedURLs();
if( list.isEmpty() )
list.append( baseURL() );
return list;
}
#include "dsdirselectdialog.moc"
|