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

parley

  • sources
  • kde-4.12
  • 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  {
35  ";", // 0
36  "#", // 1
37  "!", // 2
38  "|", // 3
39  ",", // 4
40  "\t", // 5
41  " ", // 6
42  ":", // 7
43  "::", // 8
44  0
45  };
46 
47 GeneralOptions::GeneralOptions(QWidget* parent) : QWidget(parent)
48 {
49  setupUi(this);
50  connect(kcfg_AutoBackup, SIGNAL(toggled(bool)), kcfg_BackupTime, SLOT(setEnabled(bool)));
51 
52  fillWidgets();
53  updateWidgets();
54  kcfg_BackupTime->setEnabled(kcfg_AutoBackup->isChecked());
55 }
56 
57 
58 void GeneralOptions::fillWidgets()
59 {
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", ","));
65  kcfg_SeparatorCombo->addItem(i18nc("CSV separator: tabulator", "TAB"));
66  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", ">= 2 SPACES"));
67  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", " : "));
68  kcfg_SeparatorCombo->addItem(i18nc("CSV separator", " :: "));
69 }
70 
71 void GeneralOptions::updateWidgets()
72 {
73  for (int i = 0; i < 9; ++i) {
74  if (separator_id[i] == Prefs::separator()) {
75  kcfg_SeparatorCombo->setCurrentIndex(i);
76  break;
77  }
78  }
79 
80 }
81 
82 
83 bool GeneralOptions::hasChanged()
84 {
85  if (kcfg_SeparatorCombo->currentIndex() < 0)
86  return false;
87 
88  return (separator_id[kcfg_SeparatorCombo->currentIndex()] != Prefs::separator());
89 }
90 
91 
92 bool GeneralOptions::isDefault()
93 {
94  if (kcfg_SeparatorCombo->currentIndex() < 0)
95  return false;
96  return !strcmp(separator_id[kcfg_SeparatorCombo->currentIndex()], "\t");
97 }
98 
99 
100 void GeneralOptions::updateSettings()
101 {
102  if (kcfg_SeparatorCombo->currentIndex() < 0)
103  return;
104  Prefs::setSeparator((separator_id[kcfg_SeparatorCombo->currentIndex()]));
105 }
106 
107 #include "generaloptions.moc"
GeneralOptions::updateWidgets
void updateWidgets()
Definition: generaloptions.cpp:71
GeneralOptions::updateSettings
void updateSettings()
Definition: generaloptions.cpp:100
Prefs::setSeparator
static void setSeparator(const QString &v)
Set This sets the separator used when copying/pasting text, default is Tab.
Definition: prefs.h:93
QWidget
prefs.h
GeneralOptions::hasChanged
bool hasChanged()
Definition: generaloptions.cpp:83
generaloptions.h
GeneralOptions::isDefault
bool isDefault()
Definition: generaloptions.cpp:92
GeneralOptions::GeneralOptions
GeneralOptions(QWidget *parent=0)
Definition: generaloptions.cpp:47
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:103
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:05 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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