summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-05 08:40:27 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-05 08:40:27 +0000
commit219f5db1dcd779f0373d1b97d3878df5b3ab801f (patch)
tree92b54428dda1b3a80d91656c7d55c7ad4863059a
parent4051b34039e079c0969904887fdcabd68bcad681 (diff)
downloadrockbox-219f5db1dcd779f0373d1b97d3878df5b3ab801f.tar.gz
rockbox-219f5db1dcd779f0373d1b97d3878df5b3ab801f.tar.bz2
rockbox-219f5db1dcd779f0373d1b97d3878df5b3ab801f.zip
Theme Editor: Basic save-as functionality working, but only invoked when a tab is closed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26568 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/themeeditor/skindocument.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 2e4f6f464b..8617030180 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -24,6 +24,8 @@
#include <QFile>
#include <QTimer>
#include <QSettings>
+#include <QMessageBox>
+#include <QFileDialog>
SkinDocument::SkinDocument(QWidget *parent) :
QWidget(parent)
@@ -43,6 +45,7 @@ SkinDocument::~SkinDocument()
bool SkinDocument::requestClose()
{
+ saveAs();
return true;
}
@@ -99,5 +102,22 @@ void SkinDocument::save()
void SkinDocument::saveAs()
{
/* Determining the directory to open */
+ QSettings settings;
+ settings.beginGroup("SkinDocument");
+ QString openDir = settings.value("defaultDirectory", "").toString();
+
+ fileName = QFileDialog::getSaveFileName(this, tr("Save File"), openDir,"");
+ QString directory = fileName;
+ directory.chop(fileName.length() - fileName.lastIndexOf('/') - 1);
+ settings.setValue("defaultDirectory", directory);
+
+ settings.endGroup();
+
+ QFile fout(fileName);
+ fout.open(QFile::WriteOnly);
+ fout.write(editor->document()->toPlainText().toAscii());
+ fout.close();
+
+ saved = true;
}