You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
3.2 KiB
86 lines
3.2 KiB
/***************************************************************************
|
|
knowitchooser.cpp - description
|
|
-------------------
|
|
begin : pi? lut 14 2003
|
|
copyright : (C) 2003 by Micha? Rudolf
|
|
email : mrudolf@tdewebdev.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 <tqcheckbox.h>
|
|
#include <tqlabel.h>
|
|
#include <tqlayout.h>
|
|
#include <tqvbox.h>
|
|
|
|
#include <kcombobox.h>
|
|
#include <klocale.h>
|
|
|
|
|
|
KnowitChooser::KnowitChooser(int flags)
|
|
: KDialogBase(Plain, i18n("Export"), Ok|Cancel, Ok)
|
|
{
|
|
TQLabel* l1;
|
|
TQLabel* l2;
|
|
TQVBoxLayout* tqlayout = new TQVBoxLayout(plainPage());
|
|
tqlayout->addWidget(l1 = new TQLabel(i18n("&Exported notes:"), plainPage()));
|
|
tqlayout->addWidget(notes = new KComboBox(plainPage(), "Notes"));
|
|
l1->setBuddy(notes);
|
|
notes->insertItem(i18n("All"));
|
|
notes->insertItem(i18n("Current with tqchildren"));
|
|
notes->insertItem(i18n("Current only"));
|
|
|
|
tqlayout->addWidget(l2 = new TQLabel(i18n("&Encoding:"), plainPage()));
|
|
tqlayout->addWidget(charset = new KComboBox(plainPage(), "Encoding"));
|
|
l2->setBuddy(charset);
|
|
charset->insertItem(i18n("Local (8-bit)"));
|
|
charset->insertItem(i18n("UTF-8"));
|
|
|
|
tqlayout->addItem(new TQSpacerItem(0, 10));
|
|
tqlayout->addWidget(enumerate = new TQCheckBox(i18n("Numbered titles"),
|
|
plainPage(), "Numbered"));
|
|
tqlayout->addWidget(toc = new TQCheckBox(i18n("Table of contents"),
|
|
plainPage(), "TOC"));
|
|
tqlayout->addWidget(rule = new TQCheckBox(i18n("Rule betweeen notes"),
|
|
plainPage(), "Rule"));
|
|
tqlayout->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);
|
|
}
|