Commit cc6fec2b authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Made it possible to choose a name when copying a color scheme

Based on a window-modal input dialog, so that it appears as a sheet on
the Mac.

Reviewed-by: Norwegian Rock Cat
parent 60905c48
......@@ -44,6 +44,7 @@
#include <QtGui/QComboBox>
#include <QtGui/QFileDialog>
#include <QtGui/QFontDatabase>
#include <QtGui/QInputDialog>
#include <QtGui/QListWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QPalette>
......@@ -425,6 +426,19 @@ void FontSettingsPage::colorSchemeSelected(int index)
}
void FontSettingsPage::copyColorScheme()
{
QInputDialog *dialog = new QInputDialog(d_ptr->ui.copyButton->window());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setInputMode(QInputDialog::TextInput);
dialog->setWindowTitle(tr("Copy Color Scheme"));
dialog->setLabelText(tr("Color Scheme name:"));
dialog->setTextValue(tr("%1 (copy)").arg(d_ptr->m_value.colorScheme().name()));
connect(dialog, SIGNAL(textValueSelected(QString)), this, SLOT(copyColorScheme(QString)));
dialog->open();
}
void FontSettingsPage::copyColorScheme(const QString &name)
{
int index = d_ptr->ui.schemeComboBox->currentIndex();
if (index == -1)
......@@ -444,7 +458,7 @@ void FontSettingsPage::copyColorScheme()
d_ptr->m_value.setColorScheme(d_ptr->ui.schemeEdit->colorScheme());
ColorScheme scheme = d_ptr->m_value.colorScheme();
scheme.setName(tr("%1 (copy)").arg(scheme.name()));
scheme.setName(name);
scheme.save(fileName);
d_ptr->m_value.setColorSchemeFileName(fileName);
......
......@@ -113,6 +113,7 @@ private slots:
void fontSizeSelected(const QString &sizeString);
void colorSchemeSelected(int index);
void copyColorScheme();
void copyColorScheme(const QString &name);
void deleteColorScheme();
private:
......
......@@ -123,7 +123,7 @@
<item>
<widget class="QPushButton" name="copyButton">
<property name="text">
<string>Copy</string>
<string>Copy...</string>
</property>
</widget>
</item>
......
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