summaryrefslogtreecommitdiffstats
path: root/quanta/dialogs/settings/parseroptions.cpp
blob: c38e2875c599650e3624c202ab2aa332af61c772 (plain)
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
86
/***************************************************************************
                          parseroptions.cpp  -  description
                             -------------------
    begin                : Fri Aug 23 2002
    copyright            : (C) 2002 by Andras Mantia <amantia@kde.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; version 2 of the License.               *
 *                                                                         *
 ***************************************************************************/

#include "parseroptions.h"
#include "parseroptions.moc"
#include <tqcombobox.h>
#include <tqspinbox.h>

#include <klocale.h>
#include <kconfig.h>

/*
 *  Constructs a ParserOptions which is a child of 'tqparent', with the
 *  name 'name' and widget flags set to 'f'
 */
ParserOptions::ParserOptions( KConfig *a_config, TQWidget* tqparent,  const char* name )
    : ParserOptionsUI( tqparent, name )
{
    config = a_config;
    config->setGroup("Parser options");

    TQString handleLBM = config->readEntry("LBM", i18n("Find Tag & Open Tree"));
    TQString handleMBM = config->readEntry("MBM", i18n("Nothing"));
    TQString handleRBM = config->readEntry("RBM", i18n("Popup Menu"));
    TQString handleDoubleClick = config->readEntry("Double click", i18n("Select Tag Area"));


    if ( !name )
      setName( "ParserOptions" );

    if ( handleLBM == i18n("Find Tag & Open Tree") )
    {
      comboLBM->setCurrentItem(1);
    }
    else
    {
      comboLBM->setCurrentItem(0);
    }

    if ( handleMBM == i18n("Find Tag & Open Tree") ) comboMBM->setCurrentItem(0);
    if ( handleMBM == i18n("Find Tag") ) comboMBM->setCurrentItem(1);
    if ( handleMBM == i18n("Go to End of Tag") ) comboMBM->setCurrentItem(2);
    if ( handleMBM == i18n("Select Tag Area") ) comboMBM->setCurrentItem(3);
    if ( handleMBM == i18n("Nothing")) comboMBM->setCurrentItem(4);

    if ( handleDoubleClick == i18n("Select Tag Area") )
    {
      comboDoubleClick->setCurrentItem(0);
    }
    else
    {
      comboDoubleClick->setCurrentItem(1);
    }
}

/*
 *  Destroys the object and frees any allocated resources
 */
ParserOptions::~ParserOptions()
{
    // no need to delete child widgets, TQt does it all for us
}


void ParserOptions::updateConfig()
{

    config->setGroup("Parser options");

    config->writeEntry("MBM",comboMBM->currentText());
    config->writeEntry("LBM",comboLBM->currentText());
    config->writeEntry("RBM",comboRBM->currentText());
    config->writeEntry("Double click",comboDoubleClick->currentText());
}