Commit 8a2bf09d authored by Robert Knight's avatar Robert Knight

Make history options, manage profiles and edit current profile dialog non-modal as suggested.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=662230
parent df5b3c08
......@@ -56,6 +56,8 @@ EditProfileDialog::EditProfileDialog(QWidget* parent)
_ui->setupUi(mainWidget());
_tempProfile = new Profile;
qDebug() << "Is modal = " << isModal();
}
EditProfileDialog::~EditProfileDialog()
{
......
......@@ -48,7 +48,7 @@ HistorySizeDialog::HistorySizeDialog( QWidget* parent )
setPlainCaption( i18n("History Options") );
setButtons( Default | Ok | Cancel );
setDefaultButton(Ok);
setModal( true );
setModal( false );
// dialog widgets
QWidget* dialogWidget = new QWidget(this);
......@@ -99,6 +99,13 @@ HistorySizeDialog::HistorySizeDialog( QWidget* parent )
_fixedHistoryButton->setFocus( Qt::OtherFocusReason );
connect(this,SIGNAL(defaultClicked()),this,SLOT(useDefaults()));
connect(this,SIGNAL(accepted()),this,SLOT(emitOptionsChanged()));
}
void HistorySizeDialog::emitOptionsChanged()
{
emit optionsChanged( mode() , lineCount() );
}
void HistorySizeDialog::setDefaultMode( HistoryMode mode ) { _defaultMode = mode; }
......
......@@ -95,11 +95,26 @@ public:
/** Returns the default line count, as set with setDefaultLineCount() */
int defaultLineCount() const;
signals:
/**
* Emitted when the user changes the scroll-back mode or line count and
* accepts the change by pressing the OK button
*
* @param mode The current history mode. This is a value from the HistoryMode enum.
* @param lineCount The current line count. This is only applicable if mode is
* FixedSizeHistory
*/
void optionsChanged(int mode , int lineCount);
private slots:
// changes the mode and line count back to the defaults
// specified with setDefaultMode() and setDefaultLineCount()
void useDefaults();
// fires the optionsChanged() signal with the current mode
// and line count as arguments
void emitOptionsChanged();
private:
QAbstractButton* _noHistoryButton;
QAbstractButton* _fixedHistoryButton;
......
......@@ -242,8 +242,8 @@ void MainWindow::newFromProfile(const QString& key)
}
void MainWindow::showManageProfilesDialog()
{
ManageProfilesDialog dialog(this);
dialog.exec();
ManageProfilesDialog* dialog = new ManageProfilesDialog(this);
dialog->show();
}
void MainWindow::showRemoteConnectionDialog()
......
......@@ -15,7 +15,6 @@
#include "EditProfileDialog.h"
#include "Emulation.h"
#include "Filter.h"
#include "HistorySizeDialog.h"
#include "History.h"
#include "IncrementalSearchBar.h"
#include "ScreenWindow.h"
......@@ -485,10 +484,10 @@ void SessionController::debugProcess()
void SessionController::editCurrentProfile()
{
EditProfileDialog dialog(_view);
EditProfileDialog* dialog = new EditProfileDialog( QApplication::activeWindow() );
dialog.setProfile(_session->type());
dialog.exec();
dialog->setProfile(_session->type());
dialog->show();
}
void SessionController::renameSession()
{
......@@ -669,7 +668,7 @@ void SessionController::findPreviousInHistory()
}
void SessionController::showHistoryOptions()
{
HistorySizeDialog* dialog = new HistorySizeDialog(_view);
HistorySizeDialog* dialog = new HistorySizeDialog( QApplication::activeWindow() );
const HistoryType& currentHistory = _session->history();
if ( currentHistory.isEnabled() )
......@@ -685,18 +684,21 @@ void SessionController::showHistoryOptions()
else
dialog->setMode( HistorySizeDialog::NoHistory );
if ( dialog->exec() == QDialog::Accepted )
{
if ( dialog->mode() == HistorySizeDialog::NoHistory )
_session->setHistory( HistoryTypeNone() );
else if ( dialog->mode() == HistorySizeDialog::FixedSizeHistory )
_session->setHistory( HistoryTypeBuffer(dialog->lineCount()) );
else if ( dialog->mode() == HistorySizeDialog::UnlimitedHistory )
_session->setHistory( HistoryTypeFile() );
}
connect( dialog , SIGNAL(optionsChanged(int,int)) ,
this , SLOT(scrollBackOptionsChanged(int,int)) );
delete dialog;
dialog->show();
}
void SessionController::scrollBackOptionsChanged( int mode , int lines )
{
if ( mode == HistorySizeDialog::NoHistory )
_session->setHistory( HistoryTypeNone() );
else if ( mode == HistorySizeDialog::FixedSizeHistory )
_session->setHistory( HistoryTypeBuffer(lines) );
else if ( mode == HistorySizeDialog::UnlimitedHistory )
_session->setHistory( HistoryTypeFile() );
}
void SessionController::saveHistory()
{
SessionTask* task = new SaveHistoryTask();
......
......@@ -14,6 +14,7 @@
#include <KXMLGUIClient>
// Konsole
#include "HistorySizeDialog.h"
#include "ViewProperties.h"
namespace KIO
......@@ -151,6 +152,8 @@ private slots:
void requireUrlFilterUpdate();
void highlightMatches(bool highlight);
void scrollBackOptionsChanged(int mode , int lines);
// debugging slots
void debugProcess();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment