• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

parley

  • sources
  • kde-4.14
  • kdeedu
  • parley
  • src
  • settings
generaloptions.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 
3  general options for Parley
4 
5  -----------------------------------------------------------------------
6 
7  begin : Tue Mar 29 2005
8 
9  copyright : (C) 2005, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
10 
11  -----------------------------------------------------------------------
12 
13  ***************************************************************************/
14 
15 /***************************************************************************
16  * *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or *
20  * (at your option) any later version. *
21  * *
22  ***************************************************************************/
23 
24 #include "generaloptions.h"
25 
26 #include <QCheckBox>
27 
28 #include <knuminput.h>
29 #include <kfile.h>
30 
31 #include "prefs.h"
32 
33 static const char *separator_id[] = {
34  ";", // 0
35  "#", // 1
36  "!", // 2
37  "|", // 3
38  ",", // 4
39  "\t", // 5
40  " ", // 6
41  ":", // 7
42  "::", // 8
43  0
44 };
45 
46 GeneralOptions::GeneralOptions(QWidget* parent) : QWidget(parent)
47 {
48  setupUi(this);
49  connect(kcfg_AutoBackup, SIGNAL(toggled(bool)), kcfg_BackupTime, SLOT(setEnabled(bool)));
50 
51  fillWidgets();
52  updateWidgets();
53  kcfg_BackupTime->setEnabled(kcfg_AutoBackup->isChecked());
54 }
55 
56 
57 void GeneralOptions::fillWidgets()
58 {
59  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", ";"));
60  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", "#"));
61  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", "!"));
62  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", "|"));
63  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", ","));
64  kcfg_SeparatorCombo->addItem(i18nc("CSV separator: tabulator", "TAB"));
65  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", ">= 2 SPACES"));
66  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", " : "));
67  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", " :: "));
68 }
69 
70 void GeneralOptions::updateWidgets()
71 {
72  for (int i = 0; i < 9; ++i) {
73  if (separator_id[i] == Prefs::separator()) {
74  kcfg_SeparatorCombo->setCurrentIndex(i);
75  break;
76  }
77  }
78 
79 }
80 
81 
82 bool GeneralOptions::hasChanged()
83 {
84  if (kcfg_SeparatorCombo->currentIndex() < 0)
85  return false;
86 
87  return (separator_id[kcfg_SeparatorCombo->currentIndex()] != Prefs::separator());
88 }
89 
90 
91 bool GeneralOptions::isDefault()
92 {
93  if (kcfg_SeparatorCombo->currentIndex() < 0)
94  return false;
95  return !strcmp(separator_id[kcfg_SeparatorCombo->currentIndex()], "\t");
96 }
97 
98 
99 void GeneralOptions::updateSettings()
100 {
101  if (kcfg_SeparatorCombo->currentIndex() < 0)
102  return;
103  Prefs::setSeparator((separator_id[kcfg_SeparatorCombo->currentIndex()]));
104 }
105 
106 #include "generaloptions.moc"
QWidget
QWidget::setupUi
void setupUi(QWidget *widget)
GeneralOptions::updateWidgets
void updateWidgets()
Definition: generaloptions.cpp:70
GeneralOptions::updateSettings
void updateSettings()
Definition: generaloptions.cpp:99
Prefs::setSeparator
static void setSeparator(const QString &v)
Set This sets the separator used when copying/pasting text, default is Tab.
Definition: prefs.h:98
prefs.h
QWidget::setEnabled
void setEnabled(bool)
GeneralOptions::hasChanged
bool hasChanged()
Definition: generaloptions.cpp:82
generaloptions.h
GeneralOptions::isDefault
bool isDefault()
Definition: generaloptions.cpp:91
GeneralOptions::GeneralOptions
GeneralOptions(QWidget *parent=0)
Definition: generaloptions.cpp:46
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
separator_id
static const char * separator_id[]
Definition: generaloptions.cpp:33
Prefs::separator
static QString separator()
Get This sets the separator used when copying/pasting text, default is Tab.
Definition: prefs.h:108
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal