aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2017-11-14 00:04:49 +0000
committerWeblate <noreply@weblate.org>2017-11-14 00:04:49 +0000
commitdc40a01ae695b47f87daff7ee08f3519d79b12ae (patch)
tree6e1d58f23d4537f8f501ba7e531f9ed90f269dda /src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
parentTranslated using Weblate (German) (diff)
parentAdd a special rule for Ubuntu Linux: (diff)
downloadlumina-dc40a01ae695b47f87daff7ee08f3519d79b12ae.tar.gz
lumina-dc40a01ae695b47f87daff7ee08f3519d79b12ae.tar.bz2
lumina-dc40a01ae695b47f87daff7ee08f3519d79b12ae.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp')
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
index cd88fb56..6377016c 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
@@ -31,6 +31,7 @@ QSSPage::QSSPage(QWidget *parent, bool desktop) : TabPage(parent), m_ui(new Ui::
m_ui->removeButton->setIcon(QIcon::fromTheme("edit-delete"));
m_ui->tool_enable->setEnabled(false);
m_ui->tool_disable->setEnabled(false);
+ m_ui->copyButton->setEnabled(false);
}
QSSPage::~QSSPage(){
@@ -56,6 +57,7 @@ void QSSPage::on_qssListWidget_currentItemChanged(QListWidgetItem *current, QLis
}
//qDebug() << "Got Current Item Changed";
m_ui->tool_disable->setEnabled(current!=0);
+ m_ui->copyButton->setEnabled(current!=0);
if(current){
m_ui->editButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
m_ui->removeButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
@@ -76,6 +78,7 @@ void QSSPage::on_list_disabled_currentItemChanged(QListWidgetItem *current, QLis
}
//qDebug() << "Got Current Item Changed";
m_ui->tool_enable->setEnabled(current!=0);
+ m_ui->copyButton->setEnabled(current!=0);
if(current){
m_ui->editButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
m_ui->removeButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
@@ -127,6 +130,36 @@ void QSSPage::on_editButton_clicked(){
}
}
+void QSSPage::on_copyButton_clicked(){
+ QListWidgetItem *sel = currentSelection();
+ if(sel==0){ return; }
+ QString name = QInputDialog::getText(this, tr("Enter Style Sheet Name"), tr("File name:"), QLineEdit::Normal, sel->text().section(".qss",0,0)+"_copy");
+ if(name.isEmpty()){ return; }
+ if(!name.endsWith(".qss", Qt::CaseInsensitive)){ name.append(".qss"); }
+ QString filePath;
+ if(desktop_qss){ filePath = lthemeengine::userDesktopStyleSheetPath() + name; }
+ else{ filePath = lthemeengine::userStyleSheetPath() + name; }
+ if(QFile::exists(filePath)){
+ QMessageBox::warning(this, tr("Error"), tr("The file \"%1\" already exists").arg(filePath));
+ return;
+ }
+ // Make sure the directory exists
+ QString dir = filePath.section("/",0,-2);
+ if(!QFile::exists(dir)){
+ QDir D(dir);
+ D.mkpath(dir);
+ }
+ //Copy the file over
+ QFile::copy(sel->data(QSS_FULL_PATH_ROLE).toString(), filePath);
+ //creating item
+ QFileInfo info(filePath);
+ QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->list_disabled);
+ item->setToolTip(info.filePath());
+ item->setData(QSS_FULL_PATH_ROLE, info.filePath());
+ item->setData(QSS_WRITABLE_ROLE, info.isWritable());
+ m_ui->list_disabled->setCurrentRow(m_ui->list_disabled->count()-1);
+}
+
void QSSPage::on_removeButton_clicked(){
QListWidgetItem *item = currentSelection();
if(!item){ return; }
bgstack15