1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/***************************************************************************
knowitchooser.cpp - description
-------------------
begin : pi? lut 14 2003
copyright : (C) 2003 by Micha? Rudolf
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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 <tqcheckbox.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqvbox.h>
#include <kcombobox.h>
#include <tdelocale.h>
KnowitChooser::KnowitChooser(int flags)
: KDialogBase(Plain, i18n("Export"), Ok|Cancel, Ok)
{
TQLabel* l1;
TQLabel* l2;
TQVBoxLayout* layout = new TQVBoxLayout(plainPage());
layout->addWidget(l1 = new TQLabel(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 TQLabel(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 TQSpacerItem(0, 10));
layout->addWidget(enumerate = new TQCheckBox(i18n("Numbered titles"),
plainPage(), "Numbered"));
layout->addWidget(toc = new TQCheckBox(i18n("Table of contents"),
plainPage(), "TOC"));
layout->addWidget(rule = new TQCheckBox(i18n("Rule betweeen notes"),
plainPage(), "Rule"));
layout->addWidget(style = new TQCheckBox(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);
}
|