File indexing completed on 2024-05-12 16:39:55
0001 /* This file is part of the KDE project 0002 Copyright (C) 2011-2018 Jarosław Staniek <staniek@kde.org> 0003 0004 This program is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this program; see the file COPYING. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KEXIASSISTANTPAGE_H 0021 #define KEXIASSISTANTPAGE_H 0022 0023 #include <QWidget> 0024 0025 #include "kexiutils_export.h" 0026 0027 class KexiLinkWidget; 0028 0029 //! A single page for assistant (KexiAssistantWidget). 0030 class KEXIUTILS_EXPORT KexiAssistantPage : public QWidget 0031 { 0032 Q_OBJECT 0033 public: 0034 KexiAssistantPage(const QString& title, const QString& description, 0035 QWidget* parent = 0); 0036 virtual ~KexiAssistantPage(); 0037 void setContents(QWidget* widget); 0038 void setContents(QLayout* layout); 0039 0040 /** 0041 * Returns recent focus widget 0042 * 0043 * Useful to maintain focus when activation returns to the page 0044 */ 0045 QWidget* recentFocusWidget() const; 0046 0047 /** 0048 * Sets recent focus widget 0049 * 0050 * Useful to maintain focus when activation returns to the page 0051 */ 0052 void setRecentFocusWidget(QWidget* widget); 0053 0054 /** 0055 * Restores focus on recent focus widget 0056 * 0057 * If the widget is a QLineEdit, text selection and cursor position remembered during the 0058 * setRecentFocusWidget() call is also restored. If the widget is not a QLineEdit, only focus is 0059 * restored. This method does nothing if there is no focus widget set or the widget has been 0060 * deleted in the meantime. 0061 * 0062 * @see recentFocusWidget 0063 */ 0064 void focusRecentFocusWidget(); 0065 0066 KexiLinkWidget* backButton(); 0067 KexiLinkWidget* nextButton(); 0068 QString title() const; 0069 QString description() const; 0070 public Q_SLOTS: 0071 void setDescription(const QString& text); 0072 void setBackButtonVisible(bool set); 0073 void setNextButtonVisible(bool set); 0074 //! Moves to previous page; if not, warning is displayed on debug output 0075 void back(); 0076 //! Moves to previous page if possible; if not, nothing happens 0077 void tryBack(); 0078 //! Moves to next page 0079 void next(); 0080 Q_SIGNALS: 0081 void backRequested(KexiAssistantPage* page); 0082 void tryBackRequested(KexiAssistantPage* page); 0083 void nextRequested(KexiAssistantPage* page); 0084 void cancelledRequested(KexiAssistantPage* page); 0085 0086 private Q_SLOTS: 0087 void slotLinkActivated(const QString& link); 0088 void slotCancel(); 0089 0090 private: 0091 class Private; 0092 Private * const d; 0093 }; 0094 0095 #endif