Commit 4f71fabf authored by Robert Knight's avatar Robert Knight

More Session -> Profile renaming. Make default profile bold in 'Manage...

More Session -> Profile renaming.  Make default profile bold in 'Manage Profiles' dialog.  Show KDE directory selection dialog when clicking on initial directory edit button in profile edit dialog.

svn path=/branches/work/konsole-split-view/; revision=659341
parent 1a0b94d8
......@@ -102,7 +102,7 @@ kde4_automoc(${konsole_KDEINIT_SRCS})
kde4_add_kdeinit_executable( konsole ${konsole_KDEINIT_SRCS})
target_link_libraries(kdeinit_konsole ${KDE4_KDEPRINT_LIBS} ${QT_QTXML_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBS} )
target_link_libraries(kdeinit_konsole ${KDE4_KDEPRINT_LIBS} ${QT_QTXML_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBS} ${KDE4_KFILE_LIBS} )
# XRender library for true transparency support
if(X11_Xrender_FOUND)
......@@ -165,7 +165,7 @@ kde4_add_plugin(konsolepart WITH_PREFIX ${konsolepart_PART_SRCS})
set_target_properties(konsolepart PROPERTIES DEFINE_SYMBOL KONSOLE_PART)
target_link_libraries(konsolepart ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} )
target_link_libraries(konsolepart ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS} )
if(X11_XTest_LIB)
target_link_libraries(konsolepart ${X11_XTest_LIB} )
endif(X11_XTest_LIB)
......
......@@ -26,6 +26,7 @@
// KDE
#include <KFontDialog>
#include <KIcon>
#include <KDirSelectDialog>
// Konsole
#include "ColorScheme.h"
......@@ -48,14 +49,17 @@ EditProfileDialog::~EditProfileDialog()
{
delete _ui;
}
void EditProfileDialog::setSessionType(const QString& key)
void EditProfileDialog::setProfile(const QString& key)
{
_sessionTypeKey = key;
_profileKey = key;
const Profile* info = SessionManager::instance()->sessionType(key);
const Profile* info = SessionManager::instance()->profile(key);
Q_ASSERT( info );
// update caption
setCaption( QString("Edit Profile \"%1\"").arg(info->name()) );
// setup each page of the dialog
setupGeneralPage(info);
setupAppearencePage(info);
......@@ -69,6 +73,19 @@ void EditProfileDialog::setupGeneralPage(const Profile* info)
_ui->commandEdit->setText( info->command(false,false) );
_ui->initialDirEdit->setText( info->defaultWorkingDirectory() );
_ui->iconSelectButton->setIcon( KIcon(info->icon()) );
// signals and slots
connect( _ui->dirSelectButton , SIGNAL(clicked()) , this , SLOT(selectInitialDir()) );
}
void EditProfileDialog::selectInitialDir()
{
const KUrl& url = KDirSelectDialog::selectDirectory(_ui->initialDirEdit->text(),
true,
0L,
i18n("Select Initial Directory"));
if ( !url.isEmpty() )
_ui->initialDirEdit->setText(url.path());
}
void EditProfileDialog::setupAppearencePage(const Profile* info)
{
......
......@@ -58,15 +58,17 @@ public:
*
* @param key The key for the session type provided by the SessionManager instance
*/
void setSessionType(const QString& key);
void setProfile(const QString& key);
/**
* Returns a session info object representing the new or modified session
* type.
* Returns a profile instance representing the new or modified profile.
*/
Profile* newSessionInfo();
Profile* newProfile();
private slots:
// general page
void selectInitialDir();
// appearence page
void setFontSize(int pointSize);
void showFontDialog();
......@@ -87,7 +89,7 @@ private:
void applyAdvancedPage(MutableSessionInfo* info);
Ui::EditProfileDialog* _ui;
QString _sessionTypeKey;
QString _profileKey;
};
/**
......
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>630</width>
<height>477</height>
<width>505</width>
<height>524</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -28,7 +28,7 @@
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>3</number>
<number>0</number>
</property>
<property name="usesScrollButtons" >
<bool>false</bool>
......@@ -37,166 +37,195 @@
<attribute name="title" >
<string>General</string>
</attribute>
<widget class="QLabel" name="label_9" >
<property name="geometry" >
<rect>
<x>10</x>
<y>69</y>
<width>96</width>
<height>26</height>
</rect>
</property>
<property name="text" >
<string>Initial Directory:</string>
</property>
</widget>
<widget class="QLabel" name="label_3" >
<property name="geometry" >
<rect>
<x>10</x>
<y>39</y>
<width>96</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>Command:</string>
</property>
</widget>
<widget class="QLabel" name="label_2" >
<property name="geometry" >
<rect>
<x>10</x>
<y>10</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>Session Name:</string>
</property>
</widget>
<widget class="QLabel" name="label_10" >
<property name="geometry" >
<rect>
<x>20</x>
<y>140</y>
<width>57</width>
<height>18</height>
</rect>
</property>
<property name="text" >
<string>Icon:</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_5" >
<property name="geometry" >
<rect>
<x>10</x>
<y>200</y>
<width>590</width>
<height>126</height>
</rect>
</property>
<property name="title" >
<string>Default Tab Title</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QRadioButton" name="radioButton_4" >
<property name="text" >
<string>Program Name</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_7" >
<property name="text" >
<string>Current Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_5" >
<property name="text" >
<string>Session Name</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_6" >
<property name="text" >
<string>Custom Format</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLineEdit" name="commandEdit" >
<property name="geometry" >
<rect>
<x>111</x>
<y>39</y>
<width>450</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QToolButton" name="dirSelectButton" >
<property name="geometry" >
<rect>
<x>568</x>
<y>69</y>
<width>30</width>
<height>26</height>
</rect>
</property>
<property name="text" >
<string>...</string>
</property>
</widget>
<widget class="QLineEdit" name="sessionNameEdit" >
<property name="geometry" >
<rect>
<x>111</x>
<y>10</y>
<width>450</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="initialDirEdit" >
<property name="geometry" >
<rect>
<x>111</x>
<y>70</y>
<width>450</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="iconSelectButton" >
<property name="geometry" >
<rect>
<x>110</x>
<y>110</y>
<width>83</width>
<height>71</height>
</rect>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="profileNameLabel" >
<property name="text" >
<string>Profile Name:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QLineEdit" name="sessionNameEdit" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Command:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="commandEdit" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Initial Directory:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QLineEdit" name="initialDirEdit" />
</item>
<item row="2" column="3" >
<widget class="QToolButton" name="dirSelectButton" >
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>Icon:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="iconSelectButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string/>
</property>
<property name="iconSize" >
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
</item>
<item row="3" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" colspan="4" >
<widget class="QGroupBox" name="groupBox_5" >
<property name="title" >
<string>Tab Titles</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Tab Title Format:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="lineEdit" />
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="pushButton" >
<property name="text" >
<string>Edit...</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Remote Tab Title Format:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="lineEdit_2" />
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="pushButton_2" >
<property name="text" >
<string>Edit..</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="4" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Window &amp;&amp; Tab Bar Options</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="showMenuBarButton" >
<property name="text" >
<string>Show Menu Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="alwaysHideTabBarButton" >
<property name="text" >
<string>Always hide tab bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="autoShowTabBarButton" >
<property name="text" >
<string>Show tab bar when more than one tab is open</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="alwaysShowTabBarButton" >
<property name="text" >
<string>Always show tab bar</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
......@@ -218,7 +247,7 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item rowspan="4" row="0" column="0" >
<item rowspan="5" row="0" column="0" >
<widget class="QListView" name="colorSchemeList" >
<property name="verticalScrollMode" >
<enum>QAbstractItemView::ScrollPerPixel</enum>
......@@ -247,14 +276,21 @@
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="selectColorSchemeButton" >
<property name="text" >
<string>Select</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
<width>75</width>
<height>201</height>
</size>
</property>
</spacer>
......@@ -343,46 +379,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Window Options</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="showMenuBarButton" >
<property name="text" >
<string>Show Menu Bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="alwaysHideTabBarButton" >
<property name="text" >
<string>Always hide tab bar</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="autoShowTabBarButton" >
<property name="text" >
<string>Show tab bar when more than one tab is open</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="alwaysShowTabBarButton" >
<property name="text" >
<string>Always show tab bar</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
......@@ -390,7 +386,7 @@
<string>Keyboard Setup</string>
</attribute>
<layout class="QGridLayout" >
<item rowspan="4" row="0" column="0" >
<item rowspan="5" row="0" column="0" >
<widget class="QListView" name="keyBindingList" />
</item>
<item row="0" column="1" >
......@@ -415,14 +411,21 @@
</widget>
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="selectKeyBindingsButton" >
<property name="text" >
<string>Select</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
<width>75</width>
<height>331</height>
</size>
</property>
</spacer>
......
......@@ -199,8 +199,8 @@ void MainWindow::setSessionList(ProfileList* list)
{
sessionListChanged(list->actions());
connect( list , SIGNAL(sessionSelected(const QString&)) , this ,
SLOT(sessionSelected(const QString&)) );
connect( list , SIGNAL(profileSelected(const QString&)) , this ,
SLOT(newFromProfile(const QString&)) );
connect( list , SIGNAL(actionsChanged(const QList<QAction*>&)) , this ,
SLOT(sessionListChanged(const QList<QAction*>&)) );
......@@ -229,7 +229,7 @@ void MainWindow::showShortcutsDialog()
KShortcutsDialog::configure( actionCollection() );
}
void MainWindow::sessionSelected(const QString& key)
void MainWindow::newFromProfile(const QString& key)
{
emit requestSession(key,_viewManager);
}
......
......@@ -101,7 +101,7 @@ class MainWindow : public KXmlGuiWindow
void showManageProfilesDialog();
void showRemoteConnectionDialog();
void showShortcutsDialog();
void sessionSelected(const QString&);
void newFromProfile(const QString&);
void activeViewChanged(SessionController* controller);
void activeViewTitleChanged(ViewProperties*);
......
......@@ -49,9 +49,9 @@ ManageProfilesDialog::ManageProfilesDialog(QWidget* parent)
// update table and listen for changes to the session types
updateTableModel();
connect( SessionManager::instance() , SIGNAL(sessionTypeAdded(const QString&)) , this,
connect( SessionManager::instance() , SIGNAL(profileAdded(const QString&)) , this,
SLOT(updateTableModel()) );
connect( SessionManager::instance() , SIGNAL(sessionTypeRemoved(const QString&)) , this,
connect( SessionManager::instance() , SIGNAL(profileRemoved(const QString&)) , this,
SLOT(updateTableModel()) );
// ensure that session names are fully visible
......@@ -79,17 +79,18 @@ void ManageProfilesDialog::updateTableModel()
_sessionModel = new QStandardItemModel(this);
_sessionModel->setHorizontalHeaderLabels( QStringList() << "Name"
<< "Show in Menu" );
QListIterator<QString> keyIter( SessionManager::instance()->availableSessionTypes() );
QListIterator<QString> keyIter( SessionManager::instance()->availableProfiles() );
while ( keyIter.hasNext() )
{
const QString& key = keyIter.next();
Profile* info = SessionManager::instance()->sessionType(key);
Profile* info = SessionManager::instance()->profile(key);
QList<QStandardItem*> itemList;
QStandardItem* item = new QStandardItem( info->name() );
item->setData(key);
const bool isFavorite = SessionManager::instance()->favorites().contains(key);
QStandardItem* favoriteItem = new QStandardItem();
......@@ -104,6 +105,7 @@ void ManageProfilesDialog::updateTableModel()
_sessionModel->appendRow(itemList);
}
updateDefaultItem();
_ui->sessionTable->setModel(_sessionModel);
// listen for changes in the table selection and update the state of the form's buttons
......@@ -123,11 +125,34 @@ void ManageProfilesDialog::updateTableModel()
tableSelectionChanged( _ui->sessionTable->selectionModel()->selection() );
}
void ManageProfilesDialog::updateDefaultItem()
{
const QString& defaultKey = SessionManager::instance()->defaultProfileKey();