File indexing completed on 2024-05-05 05:53:55

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef PROFILESETTINGS_H
0008 #define PROFILESETTINGS_H
0009 
0010 // Qt
0011 #include <QExplicitlySharedDataPointer>
0012 
0013 // KDE
0014 
0015 // Konsole
0016 // TODO: Move this file to the profile folder?
0017 #include "ui_ProfileSettings.h"
0018 
0019 class QItemSelection;
0020 class QStandardItem;
0021 class QStandardItemModel;
0022 
0023 namespace Konsole
0024 {
0025 class Profile;
0026 
0027 /**
0028  * A dialog which lists the available types of profiles and allows
0029  * the user to add new profiles, and remove or edit existing
0030  * profile types.
0031  */
0032 class ProfileSettings : public QWidget, private Ui::ProfileSettings
0033 {
0034     Q_OBJECT
0035 
0036     friend class ShortcutItemDelegate;
0037 
0038 public:
0039     /** Constructs a new profile type with the specified parent. */
0040     explicit ProfileSettings(QWidget *parent = nullptr);
0041     ~ProfileSettings() override;
0042 
0043 private Q_SLOTS:
0044     friend class MainWindow;
0045     void slotAccepted();
0046 
0047     void deleteSelected();
0048     void setSelectedAsDefault();
0049     void createProfile();
0050     void editSelected();
0051 
0052     // enables or disables Edit/Delete/Set as Default buttons when the
0053     // selection changes
0054     void tableSelectionChanged(const QItemSelection &);
0055 
0056     // double clicking the profile name opens the edit profile dialog
0057     void doubleClicked(const QModelIndex &index);
0058 
0059 private:
0060     QExplicitlySharedDataPointer<Profile> currentProfile() const;
0061 
0062     // updates the profile table to be in sync with the
0063     // session manager
0064     void populateTable();
0065 };
0066 
0067 }
0068 #endif // MANAGEPROFILESDIALOG_H