summaryrefslogtreecommitdiffstats
path: root/src/knowitchooser.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 02:48:30 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 02:48:30 +0000
commite1481e0a7c066357dfb67136f331b5f069d94f3c (patch)
tree19599adc9a54e8295402ceb25d6f2ea42edea439 /src/knowitchooser.cpp
downloadknowit-e1481e0a7c066357dfb67136f331b5f069d94f3c.tar.gz
knowit-e1481e0a7c066357dfb67136f331b5f069d94f3c.zip
Added abandoned KDE3 version of knowit
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knowit@1091582 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/knowitchooser.cpp')
-rw-r--r--src/knowitchooser.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/knowitchooser.cpp b/src/knowitchooser.cpp
new file mode 100644
index 0000000..61e6542
--- /dev/null
+++ b/src/knowitchooser.cpp
@@ -0,0 +1,85 @@
+/***************************************************************************
+ knowitchooser.cpp - description
+ -------------------
+ begin : pi? lut 14 2003
+ copyright : (C) 2003 by Micha? Rudolf
+ email : mrudolf@kdewebdev.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "knowitchooser.h"
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qvbox.h>
+
+#include <kcombobox.h>
+#include <klocale.h>
+
+
+KnowitChooser::KnowitChooser(int flags)
+ : KDialogBase(Plain, i18n("Export"), Ok|Cancel, Ok)
+{
+ QLabel* l1;
+ QLabel* l2;
+ QVBoxLayout* layout = new QVBoxLayout(plainPage());
+ layout->addWidget(l1 = new QLabel(i18n("&Exported notes:"), plainPage()));
+ layout->addWidget(notes = new KComboBox(plainPage(), "Notes"));
+ l1->setBuddy(notes);
+ notes->insertItem(i18n("All"));
+ notes->insertItem(i18n("Current with children"));
+ notes->insertItem(i18n("Current only"));
+
+ layout->addWidget(l2 = new QLabel(i18n("&Encoding:"), plainPage()));
+ layout->addWidget(charset = new KComboBox(plainPage(), "Encoding"));
+ l2->setBuddy(charset);
+ charset->insertItem(i18n("Local (8-bit)"));
+ charset->insertItem(i18n("UTF-8"));
+
+ layout->addItem(new QSpacerItem(0, 10));
+ layout->addWidget(enumerate = new QCheckBox(i18n("Numbered titles"),
+ plainPage(), "Numbered"));
+ layout->addWidget(toc = new QCheckBox(i18n("Table of contents"),
+ plainPage(), "TOC"));
+ layout->addWidget(rule = new QCheckBox(i18n("Rule betweeen notes"),
+ plainPage(), "Rule"));
+ layout->addWidget(style = new QCheckBox(i18n("Use editor font and colors"),
+ plainPage(), "Style"));
+ setChoice(flags);
+}
+
+KnowitChooser::~KnowitChooser()
+{
+}
+
+int KnowitChooser::getChoice() const
+{
+ int flags = 2 - notes->currentItem();
+ if (charset->currentItem() == 1) flags = flags | UseUTF8;
+ if (enumerate->isChecked()) flags = flags | Enumerate;
+ if (toc->isChecked()) flags = flags | TOC;
+ if (rule->isChecked()) flags = flags | AddRule;
+ if (style->isChecked()) flags = flags | Style;
+ return flags;
+}
+
+void KnowitChooser::setChoice(int flags)
+{
+ if (flags & SaveAll) notes->setCurrentItem(0);
+ else if (flags & SaveSubnotes) notes->setCurrentItem(1);
+ else notes->setCurrentItem(2);
+ charset->setCurrentItem((flags & UseUTF8) != 0);
+ enumerate->setChecked(flags & Enumerate);
+ toc->setChecked(flags & TOC);
+ rule->setChecked(flags & AddRule);
+ style->setChecked(flags & Style);
+}