Debian Codegraph @

src/qdirdialog.cpp

raw symbols SCIP
1 /**********************************************************************
2 ** Author: Nicolas Remy
3 ** Copyright (C) 2002-2004 The Board of Trustees of the Leland Stanford Junior
4 ** University
5 ** All rights reserved.
6 **
7 ** This file is part of the luckybackup project
8 **
9 ** This file may be distributed and/or modified under the terms of the
10 ** license defined by the Stanford Center for Reservoir Forecasting and
11 ** appearing in the file LICENSE.XFREE included in the packaging of this file.
12 **
13 ** This file may be distributed and/or modified under the terms of the
14 ** GNU General Public License version 2 as published by the Free Software
15 ** Foundation and appearing in the file LICENSE.GPL included in the
16 ** packaging of this file.
17 **
18 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
19 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 **
21 ** See http://www.gnu.org/copyleft/gpl.html for GPL licensing information.
22 **
23 ** Contact the Stanford Center for Reservoir Forecasting, Stanford University
24 ** if any conditions of this licensing are not clear to you.
25 **
26 **********************************************************************/
27
28 #include "qdirdialog.h"
29
30
31 QDirDialog::QDirDialog( const QString& extension,
32 const QString& dirName, QWidget* parent,
33 const char* name,
34 QFileDialog::FileMode mode,
35 bool modal )
36 : QFileDialog( parent, QString::null, dirName),
37 extension_( extension ) {
38
39 if(name)
40 setObjectName(name);
41
42 setModal(modal);
43 init_dialog( mode );
44 }
45
46 QDirDialog::QDirDialog( const QString& extension,
47 QWidget* parent,
48 const char* name,
49 QFileDialog::FileMode mode,
50 bool modal )
51 : QFileDialog( parent, Qt::Dialog),
52 extension_( extension ) {
53
54 setModal(modal);
55 if(name)
56 setObjectName(name);
57
58 init_dialog( mode );
59 }
60
61
62 void QDirDialog::check_selected_directory( const QString& dirName ) {
63 if( !dirName.endsWith( extension_, Qt::CaseInsensitive) ) return;
64
65 selected_directory_ = dirName;
66 this->accept();
67 }
68
69
70 void QDirDialog::init_dialog( QFileDialog::FileMode mode ) {
71 setFileMode( mode );
72
73 QObject::connect( this, SIGNAL( directoryEntered( const QString& ) ),
74 this, SLOT( check_selected_directory( const QString& ) ) );
75
76 }
77
78
79 void QDirDialog::accept() {
80 QDialog::accept();
81 QStringList sl = selectedFiles();
82 if( selected_directory_.isEmpty() ) {
83 selected_directory_ = sl[0];
84 }
85 }