~ubuntu-branches/ubuntu/warty/kdebase/warty

« back to all changes in this revision

Viewing changes to kdeprint/kdeprintfax/confgeneral.cpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-09-16 04:51:45 UTC
  • Revision ID: james.westby@ubuntu.com-20040916045145-9vr63kith3k1cpza
Tags: upstream-3.2.2
ImportĀ upstreamĀ versionĀ 3.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   kdeprintfax - a small fax utility
 
3
 *   Copyright (C) 2001  Michael Goffioul
 
4
 *
 
5
 *   This program is free software; you can redistribute it and/or modify
 
6
 *   it under the terms of the GNU General Public License as published by
 
7
 *   the Free Software Foundation; either version 2 of the License, or
 
8
 *   (at your option) any later version.
 
9
 *
 
10
 *   This program is distributed in the hope that it will be useful,
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *   GNU General Public License for more details.
 
14
 *
 
15
 *   You should have received a copy of the GNU General Public License
 
16
 *   along with this program; if not, write to the Free Software
 
17
 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
18
 *
 
19
 */
 
20
 
 
21
#include "confgeneral.h"
 
22
 
 
23
#include <qlineedit.h>
 
24
#include <qlabel.h>
 
25
#include <qlayout.h>
 
26
 
 
27
#include <kglobal.h>
 
28
#include <kconfig.h>
 
29
#include <klocale.h>
 
30
 
 
31
#include <stdlib.h>
 
32
 
 
33
ConfGeneral::ConfGeneral(QWidget *parent, const char *name)
 
34
: QWidget(parent, name)
 
35
{
 
36
        m_name = new QLineEdit(this);
 
37
        m_company = new QLineEdit(this);
 
38
        m_number = new QLineEdit(this);
 
39
        QLabel  *m_namelabel = new QLabel(i18n("&Name:"), this);
 
40
        m_namelabel->setBuddy(m_name);
 
41
        QLabel  *m_companylabel = new QLabel(i18n("&Company:"), this);
 
42
        m_companylabel->setBuddy(m_company);
 
43
        QLabel  *m_numberlabel = new QLabel(i18n("N&umber:"), this);
 
44
        m_numberlabel->setBuddy(m_number);
 
45
 
 
46
        QGridLayout     *l0 = new QGridLayout(this, 4, 2, 10, 10);
 
47
        l0->setColStretch(1, 1);
 
48
        l0->setRowStretch(3, 1);
 
49
        l0->addWidget(m_namelabel, 0, 0);
 
50
        l0->addWidget(m_companylabel, 1, 0);
 
51
        l0->addWidget(m_numberlabel, 2, 0);
 
52
        l0->addWidget(m_name, 0, 1);
 
53
        l0->addWidget(m_company, 1, 1);
 
54
        l0->addWidget(m_number, 2, 1);
 
55
}
 
56
 
 
57
void ConfGeneral::load()
 
58
{
 
59
        KConfig *conf = KGlobal::config();
 
60
        conf->setGroup("Personal");
 
61
        m_name->setText(conf->readEntry("Name", getenv("USER")));
 
62
        m_number->setText(conf->readEntry("Number"));
 
63
        m_company->setText(conf->readEntry("Company"));
 
64
}
 
65
 
 
66
void ConfGeneral::save()
 
67
{
 
68
        KConfig *conf = KGlobal::config();
 
69
        conf->setGroup("Personal");
 
70
        conf->writeEntry("Name", m_name->text());
 
71
        conf->writeEntry("Number", m_number->text());
 
72
        conf->writeEntry("Company", m_company->text());
 
73
}