root/trunk/qt4-gui/src/widgets/filenameedit.h

Revision 6056, 1.7 kB (checked in by flynd, 11 months ago)

Added new input widget for filenames with button to open file dialog. KurlRequester? will be used if built with kde support.

Line 
1/*
2 * This file is part of Licq, an instant messaging client for UNIX.
3 * Copyright (C) 2008 Licq developers
4 *
5 * Licq is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Licq is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Licq; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20#ifndef FILENAMEEDIT_H
21#define FILENAMEEDIT_H
22
23#include <config.h>
24
25#ifdef USE_KDE
26#include <KDE/KUrlRequester>
27#define FILENAMEEDIT_BASE KUrlRequester
28#else
29#include <QWidget>
30#define FILENAMEEDIT_BASE QWidget
31
32class QLineEdit;
33#endif
34
35namespace LicqQtGui
36{
37
38/**
39 * Input field for a filename together with a browse button that will open a
40 * file selection dialog.
41 * Uses KUrlRequester when building with KDE support.
42 */
43class FileNameEdit : public FILENAMEEDIT_BASE
44{
45  Q_OBJECT
46
47public:
48  /**
49   * Constructor
50   *
51   * @parent Parent widget
52   */
53  FileNameEdit(QWidget* parent = NULL);
54
55  /**
56   * Set file name
57   *
58   * @param fileName New file name
59   */
60  void setFileName(const QString& fileName);
61
62  /**
63   * Get file name
64   *
65   * @return File name
66   */
67  QString fileName() const;
68
69#ifndef USE_KDE
70private slots:
71  /**
72   * Open a file dialog to browse for file
73   */
74  void browse();
75
76private:
77  QLineEdit* editField;
78#endif
79};
80
81} // namespace LicqQtGui
82
83#endif
Note: See TracBrowser for help on using the browser.