• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

ManageProfilesDialog.h

Go to the documentation of this file.
00001 /*
00002     Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301  USA.
00018 */
00019 
00020 #ifndef MANAGEPROFILESDIALOG_H
00021 #define MANAGEPROFILESDIALOG_H
00022 
00023 // Qt
00024 #include <QtGui/QStyledItemDelegate>
00025 #include <QtCore/QSet>
00026 
00027 // KDE
00028 #include <KDialog>
00029 
00030 // Konsole
00031 #include "Profile.h"
00032 
00033 class QItemSelection;
00034 class QShowEvent;
00035 class QStandardItem;
00036 class QStandardItemModel;
00037 
00038 namespace Ui
00039 {
00040     class ManageProfilesDialog;
00041 }
00042 
00043 namespace Konsole
00044 {
00045 
00051 class ManageProfilesDialog : public KDialog
00052 {
00053 Q_OBJECT
00054 
00055 friend class FavoriteItemDelegate;
00056 friend class ShortcutItemDelegate;
00057 
00058 public:
00060     ManageProfilesDialog(QWidget* parent = 0);
00061     virtual ~ManageProfilesDialog();
00062 
00072     void setShortcutEditorVisible(bool visible);
00073 
00074 protected:
00075     virtual void showEvent(QShowEvent* event);
00076 
00077 private slots:
00078     void deleteSelected();
00079     void setSelectedAsDefault();
00080     void newType();
00081     void editSelected();
00082 
00083     void itemDataChanged(QStandardItem* item);
00084 
00085     // enables or disables Edit/Delete/Set as Default buttons when the 
00086     // selection changes
00087     void tableSelectionChanged(const QItemSelection&);
00088 
00089     void updateFavoriteStatus(Profile::Ptr profile, bool favorite);
00090 
00091     void addItems(const Profile::Ptr);
00092     void updateItems(const Profile::Ptr);
00093     void removeItems(const Profile::Ptr);
00094 
00095 private:
00096     Profile::Ptr currentProfile() const; 
00097     QList<Profile::Ptr> selectedProfiles() const; 
00098 
00099     // updates the font of the items to match
00100     // their default / non-default profile status
00101     void updateDefaultItem(); 
00102     void updateItemsForProfile(const Profile::Ptr profile, QList<QStandardItem*>& items) const;
00103     // updates the profile table to be in sync with the 
00104     // session manager
00105     void populateTable();
00106     int rowForProfile(const Profile::Ptr info) const;
00107 
00108     Ui::ManageProfilesDialog* _ui;
00109     QStandardItemModel* _sessionModel;
00110 
00111     static const int ProfileNameColumn = 0;
00112     static const int FavoriteStatusColumn = 1;
00113     static const int ShortcutColumn = 2;
00114     static const int ProfileKeyRole = Qt::UserRole + 1;
00115     static const int ShortcutRole = Qt::UserRole + 1;
00116 };
00117 
00118 class StyledBackgroundPainter 
00119 {
00120 public:
00121     static void drawBackground(QPainter* painter, const QStyleOptionViewItem& option,
00122                 const QModelIndex& index);
00123 };
00124 
00125 class FavoriteItemDelegate : public QStyledItemDelegate
00126 {
00127 public:
00128     FavoriteItemDelegate(QObject* parent = 0);
00129 
00130     virtual bool editorEvent(QEvent* event,QAbstractItemModel* model,
00131                              const QStyleOptionViewItem& option,const QModelIndex& index);
00132     virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, 
00133                         const QModelIndex& index) const;
00134 };
00135 
00136 class ShortcutItemDelegate : public QStyledItemDelegate
00137 {
00138 Q_OBJECT
00139 
00140 public:
00141     ShortcutItemDelegate(QObject* parent = 0);
00142 
00143     virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
00144     virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, 
00145                                     const QModelIndex& index) const;
00146     virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, 
00147                         const QModelIndex& index) const;
00148 
00149 private slots:
00150     void editorModified(const QKeySequence& keys);
00151 
00152 private:
00153     mutable QSet<QWidget*> _modifiedEditors;
00154     mutable QSet<QModelIndex> _itemsBeingEdited;
00155 };
00156 
00157 }
00158 #endif // MANAGEPROFILESDIALOG_H
00159 

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal