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

lokalize

  • sources
  • kde-4.14
  • kdesdk
  • lokalize
  • src
  • tools
widgettextcaptureconfig.cpp
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2012 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 #include "widgettextcaptureconfig.h"
25 #include "ui_widgettextcaptureconfig.h"
26 
27 WidgetTextCaptureConfig::WidgetTextCaptureConfig(QWidget* parent)
28  : KDialog(parent)
29  , ui(new Ui_WidgetTextCapture)
30 {
31  setAttribute(Qt::WA_DeleteOnClose, true);
32  ui->setupUi(mainWidget());
33  setCaption(i18nc("@title","Widget Text Capture"));
34  setButtons(KDialog::Ok | KDialog::Cancel);
35 
36  KConfigGroup cg(KGlobal::config(), "Development");
37  bool copyWidgetText = cg.readEntry("CopyWidgetText", false);
38  QString copyWidgetTextCommand = cg.readEntry("CopyWidgetTextCommand", QString());
39  ui->none->setChecked(!copyWidgetText);
40  ui->clipboard->setChecked(copyWidgetText && copyWidgetTextCommand.isEmpty());
41  ui->search->setChecked(copyWidgetText && !copyWidgetTextCommand.isEmpty());
42 
43  connect(this,SIGNAL(accepted()),this,SLOT(writeConfig()));
44 }
45 
46 WidgetTextCaptureConfig::~WidgetTextCaptureConfig()
47 {
48  delete ui;
49 }
50 
51 void WidgetTextCaptureConfig::writeConfig()
52 {
53  KConfig konfig(QString::fromLatin1("kdeglobals"), KConfig::NoGlobals);
54  KConfigGroup cg=konfig.group("Development");
55  cg.writeEntry("CopyWidgetText", !ui->none->isChecked());
56  if (ui->clipboard->isChecked())
57  cg.writeEntry("CopyWidgetTextCommand", QString());
58  else if (ui->search->isChecked())
59  cg.writeEntry("CopyWidgetTextCommand", "/bin/sh `kde4-config --path data --locate lokalize/scripts/find-gui-text.sh` \"%1\" \"%2\"");
60 
61  konfig.sync();
62 }
QWidget
WidgetTextCaptureConfig::~WidgetTextCaptureConfig
~WidgetTextCaptureConfig()
Definition: widgettextcaptureconfig.cpp:46
widgettextcaptureconfig.h
WidgetTextCaptureConfig::WidgetTextCaptureConfig
WidgetTextCaptureConfig(QWidget *parent=0)
Definition: widgettextcaptureconfig.cpp:27
QString::isEmpty
bool isEmpty() const
QString
QString::fromLatin1
QString fromLatin1(const char *str, int size)
WidgetTextCaptureConfig::writeConfig
void writeConfig()
Definition: widgettextcaptureconfig.cpp:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

lokalize

Skip menu "lokalize"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

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