Commit 5f005026 authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

Port KTextEdit/KDialog to QInputDialog::getMultiLineText

showEnvironmentEditor()
parent 5cc59399
......@@ -37,6 +37,7 @@
#include <QtCore/QUrl>
#include <QFontDialog>
#include <QFileDialog>
#include <QInputDialog>
#include <QDialog>
#include <QDebug>
// KDE
......@@ -330,25 +331,20 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile)
}
void EditProfileDialog::showEnvironmentEditor()
{
bool ok;
const Profile::Ptr profile = lookupProfile();
QWeakPointer<KDialog> dialog = new KDialog(this);
KTextEdit* edit = new KTextEdit(dialog.data());
QStringList currentEnvironment = profile->environment();
edit->setPlainText(currentEnvironment.join("\n"));
edit->setToolTip(i18nc("@info:tooltip", "One environment variable per line"));
dialog.data()->setPlainCaption(i18n("Edit Environment"));
dialog.data()->setMainWidget(edit);
QString text = QInputDialog::getMultiLineText(this,
i18n("Edit Environment"),
i18n("One environment variable per line"),
currentEnvironment.join("\n"),
&ok);
if (dialog.data()->exec() == QDialog::Accepted) {
QStringList newEnvironment = edit->toPlainText().split('\n');
if (ok && !text.isEmpty()) {
QStringList newEnvironment = text.split('\n');
updateTempProfileProperty(Profile::Environment, newEnvironment);
}
delete dialog.data();
}
void EditProfileDialog::setupTabsPage(const Profile::Ptr profile)
{
......
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