summaryrefslogtreecommitdiff
path: root/src/savetextasdialog.cpp
diff options
context:
space:
mode:
authorTannin <Tannin@Miranda>2013-02-16 19:09:57 +0100
committerTannin <Tannin@Miranda>2013-02-16 19:09:57 +0100
commit5d1154c24e2475ed2b7ac248de27ab7b501a1e5e (patch)
tree265341b9c8d057da46b56ad9fde40c9b39963ebb /src/savetextasdialog.cpp
parent44b96e6fb5f484e9a60fe03b99021a1c5f78488d (diff)
- hooks for CreateHardLink
- createprocess hook will now reroute the cwd (fixes SUM, may break other tools?) - profile code moved to separate file - executables can now be linked to toolbar - category filters are now represented as a tree - csv export of mod list - ModInfoDialog is now "window modal" instead of "application modal" - nexus dialog now updates the mod-id field while browsing - right-click in nexus browser allows to open in external browser - ini viewer is no longer modal - bugfix: another attempt to fix processing of invalid header lines in fomod xmls (bom now handled) - bugfix: integrated fomod installer will no longer overwrite detected mod name by the one from the xml - bugfix: "hide file" from conflicted files list now updates that list - bugfix: conflicted files list no longer offers to hide files in BSAs - bugfix: pressing delete on the mod list with multiplie files selected offered to delete the wrong files - regression: mod name guessing with the old regular expression was less likely to lead to an empty mod name. Now both are tried
Diffstat (limited to 'src/savetextasdialog.cpp')
-rw-r--r--src/savetextasdialog.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/savetextasdialog.cpp b/src/savetextasdialog.cpp
new file mode 100644
index 00000000..465e3d65
--- /dev/null
+++ b/src/savetextasdialog.cpp
@@ -0,0 +1,46 @@
+#include "savetextasdialog.h"
+#include "ui_savetextasdialog.h"
+#include <report.h>
+#include <QClipboard>
+#include <QFileDialog>
+
+SaveTextAsDialog::SaveTextAsDialog(QWidget *parent)
+ : QDialog(parent), ui(new Ui::SaveTextAsDialog)
+{
+ ui->setupUi(this);
+}
+
+SaveTextAsDialog::~SaveTextAsDialog()
+{
+ delete ui;
+}
+
+void SaveTextAsDialog::setText(const QString &text)
+{
+ ui->textEdit->setPlainText(text);
+}
+
+void SaveTextAsDialog::on_closeBtn_clicked()
+{
+ this->close();
+}
+
+void SaveTextAsDialog::on_clipboardBtn_clicked()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ clipboard->setText(ui->textEdit->toPlainText());
+}
+
+void SaveTextAsDialog::on_saveAsBtn_clicked()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save CSV"), QString(), tr("Text Files") + " (*.txt *.csv)");
+ if (!fileName.isEmpty()) {
+ QFile file(fileName);
+ if (!file.open(QIODevice::WriteOnly)) {
+ reportError(tr("failed to open \"%1\" for writing").arg(fileName));
+ return;
+ }
+
+ file.write(ui->textEdit->toPlainText().toUtf8());
+ }
+}