File: kaddstringdlg.cpp

package info (click to toggle)
kdewebdev 1%3A3.3.2-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 33,200 kB
  • ctags: 13,047
  • sloc: cpp: 165,029; sh: 9,033; perl: 3,315; makefile: 1,618; xml: 497; ansic: 83
file content (83 lines) | stat: -rw-r--r-- 2,506 bytes parent folder | download
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
/***************************************************************************
                          KAddStringDlg.cpp  -  description
                             -------------------
    begin                : Sat Oct 16 1999
    copyright            : (C) 1999 by Franois Dupoux
                           (C) 2004 Emiliano Gulmini <emi_barbarossa@yahoo.it>
    email                : dupoux@dupoux.com
 ***************************************************************************/

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

#include "kaddstringdlg.h"

#include <kmessagebox.h>
#include <klocale.h>

#include <qtextedit.h>
#include <qlabel.h>
#include <qpushbutton.h>

KAddStringDlg::KAddStringDlg(QWidget *parent, const char *name) : KAddStringDlgS(parent,name,true)
{
  connect(pbOK,SIGNAL(clicked()),this,SLOT(slotOK()));
  connect(m_editSearch,SIGNAL(textChanged()), this, SLOT(changeSearchText()));
  connect(m_editReplace,SIGNAL(textChanged()), this, SLOT(changeReplaceText()));

}

KAddStringDlg::~KAddStringDlg()
{

}

void KAddStringDlg::slotOK()
{
  // Check the Search text is not empty
  if (m_editSearch->text().isEmpty())
    {
      KMessageBox::error(this, i18n("You must fill the text to find (and Replace) before clicking on 'OK'."));
      return;
    }

  // Copy text into variables
  m_strSearch = m_editSearch->text();
  m_strReplace = m_editReplace->text();

  accept();
}

void KAddStringDlg::changeSearchText()
{
 m_strSearch = m_editSearch->text();
}
void KAddStringDlg::changeReplaceText()
{
 m_strReplace = m_editReplace->text();
}

void KAddStringDlg::setSearchText(const QString &strText)
{
 m_editSearch->setText(strText);
}
void KAddStringDlg::setReplaceText(const QString &strText)
{
 m_editReplace->setText(strText);
}
QString KAddStringDlg::searchText() const
 {
  return m_strSearch;
 }
QString KAddStringDlg::replaceText() const
 {
  return m_strReplace;
 }
#include "kaddstringdlg.moc"