summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs/settings/ksettingsregister.cpp
blob: d60d8cf7463c1be37dfeb060a550919f741ca64a (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
/***************************************************************************
                             ksettingsregister.cpp
                             --------------------
    copyright            : (C) 2005 by Thomas Baumgart
    email                : ipwizard@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// ----------------------------------------------------------------------------
// QT Includes

// ----------------------------------------------------------------------------
// KDE Includes

#include <ktextedit.h>

// ----------------------------------------------------------------------------
// Project Includes

#include "ksettingsregister.h"
#include <kmymoney/transactionsortoption.h>

KSettingsRegister::KSettingsRegister(TQWidget* parent, const char* name) :
  KSettingsRegisterDecl(parent, name)
{
  // hide the internally used text fields
  kcfg_sortNormalView->hide();
  kcfg_sortReconcileView->hide();
  kcfg_sortSearchView->hide();

  // setup connections, so that the sort optios get loaded once the edit fields are filled
  connect(kcfg_sortNormalView, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotLoadNormal()));
  connect(kcfg_sortReconcileView, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotLoadReconcile()));
  connect(kcfg_sortSearchView, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotLoadSearch()));

  // setup connections, so that changes by the user are forwarded to the (hidden) edit fields
  connect(m_sortNormalView, TQT_SIGNAL(settingsChanged(const TQString&)), kcfg_sortNormalView, TQT_SLOT(setText(const TQString&)));
  connect(m_sortReconcileView, TQT_SIGNAL(settingsChanged(const TQString&)), kcfg_sortReconcileView, TQT_SLOT(setText(const TQString&)));
  connect(m_sortSearchView, TQT_SIGNAL(settingsChanged(const TQString&)), kcfg_sortSearchView, TQT_SLOT(setText(const TQString&)));
}

KSettingsRegister::~KSettingsRegister()
{
}

void KSettingsRegister::slotLoadNormal(void)
{
  // only need this once
  disconnect(kcfg_sortNormalView, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotLoadNormal()));
  m_sortNormalView->setSettings(kcfg_sortNormalView->text());
}

void KSettingsRegister::slotLoadReconcile(void)
{
  // only need this once
  disconnect(kcfg_sortReconcileView, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotLoadReconcile()));
  m_sortReconcileView->setSettings(kcfg_sortReconcileView->text());
}

void KSettingsRegister::slotLoadSearch(void)
{
  // only need this once
  disconnect(kcfg_sortSearchView, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotLoadSearch()));
  m_sortSearchView->setSettings(kcfg_sortSearchView->text());
}

#include "ksettingsregister.moc"