moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / ktouch / src / ktouchopenrequest.h
blobe23384acc968b46fa898e4300cdaf6f931c8622b
1 /***************************************************************************
2 * ktouchopenrequest.h *
3 * ------------------- *
4 * Copyright (C) 2004 by Andreas Nicolai *
5 * ghorwin@users.sourceforge.net *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 ***************************************************************************/
13 #ifndef KTOUCHOPENREQUEST_H
14 #define KTOUCHOPENREQUEST_H
16 #include "ktouchopenrequest_dlg.h"
18 #include <kurl.h>
19 #include <qstringlist.h>
21 /// Dialog for selecting a file to open.
22 ///
23 /// This dialog is a costumizable dialog and is to be used for all editors.
24 /// It offers the choice between a default (current) file, a prepared selection of
25 /// files, choosing an arbitrary file from somewhere or creating a new file.
26 /// Before using the dialog you have to set it up. You can do this using the
27 /// all-in-one function requestFileToOpen() or manually by setting the
28 /// different widgets yourself. Usually the first proposal will be best, as
29 /// in the following example:
30 /// @code
31 /// KTouchOpenRequest dlg;
32 /// KURL url;
33 /// // current_lecture must hold the URL to the current/default lecture or ""
34 /// // default_lectures must be a QStringList with the default lecture files.
35 /// int result = dlg.requestFileToOpen(url, i18n("Open a lecture file"),
36 /// i18n("Which lecture would you like to open?"), i18n("Current lecture:"),
37 /// i18n("Open a default lecture:"), i18n("Open a lecture file:"),
38 /// i18n("Create a new lecture!"), current_lecture,
39 /// default_lectures, i18n("<no lecture files available>"));
40 ///
41 /// if (result==QDialog::Accepted) {
42 /// doSomethingFancyWith(url);
43 /// }
44 /// @endcode
45 /// If you don't use the function and execute the dialog manually, the chosen
46 /// url is stored in the member variable m_url (if the dialog was accepted by
47 /// the user).
48 ///
49 class KTouchOpenRequest : public KTouchOpenRequestDlg {
50 Q_OBJECT
52 public:
53 /// Default constructor.
54 KTouchOpenRequest(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
55 /// Default destructor.
56 ~KTouchOpenRequest() {}
57 /// Sets up the dialog and runs it.
58 /// @return Returns the dialogs return code, QDialog::Accepted or QDialog::Rejected.
59 int requestFileToOpen(KURL& url, const QString& caption, const QString& title, const QString& currentText,
60 const QString& defaultText, const QString& openText, const QString& newText,
61 KURL current_url = QString::null, QStringList defaultList = QStringList(), QString emptyListText = QString::null);
63 /// After the dialog has been accepted the URL chosen by the user is stored herein.
64 KURL m_url;
66 public slots:
67 /// Called when user selects Ok (used to check whether the URL is well formed).
68 void okBtnClicked();
69 /// Called when user switches to another radiobutton.
70 void radioBtnChanged();
71 /// Called when the user clicks on the "Browse" button and opens the file select dialog.
72 void browseBtnClicked();
76 #endif