~ubuntu-branches/ubuntu/wily/kbibtex/wily

« back to all changes in this revision

Viewing changes to src/settingsdlg.cpp

  • Committer: Package Import Robot
  • Author(s): Michael Hanke
  • Date: 2011-07-18 09:29:48 UTC
  • mfrom: (1.1.6) (2.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20110718092948-ksxjmg7kdfamolmg
Tags: 0.3-1
* First upstream release for KDE4 (Closes: #634255). A number of search
  engines are still missing, in comparison to the 0.2 series.
* Bumped Standards-Version to 3.9.2, no changes necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
*   Copyright (C) 2004-2009 by Thomas Fischer                             *
3
 
*   fischer@unix-ag.uni-kl.de                                             *
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                         *
17
 
*   Free Software Foundation, Inc.,                                       *
18
 
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 
***************************************************************************/
20
 
 
21
 
#include <qlayout.h>
22
 
 
23
 
#include <klocale.h>
24
 
#include <kiconloader.h>
25
 
 
26
 
#include <settingsfileio.h>
27
 
#include <settingsediting.h>
28
 
#include <settingssearchurl.h>
29
 
#include <settingsidsuggestions.h>
30
 
#include <settingskeyword.h>
31
 
#include <settingsuserdefinedinput.h>
32
 
#ifdef HAVE_YAZ
33
 
#include <settingsz3950.h>
34
 
#endif // HAVE_YAZ
35
 
#include "settingsdlg.h"
36
 
 
37
 
namespace KBibTeX
38
 
{
39
 
    SettingsDlg::SettingsDlg( QWidget *parent, const char *name )
40
 
            : KDialogBase( Tabbed, i18n( "Configure" ), Ok | Apply | Cancel, Ok, parent, name, true )
41
 
    {
42
 
        QFrame * page = addPage( i18n( "&Editing" ) );
43
 
        QVBoxLayout *layout = new QVBoxLayout( page, 0, spacingHint() );
44
 
        m_editing = new SettingsEditing( page );
45
 
        layout->addWidget( m_editing );
46
 
        connect( m_editing, SIGNAL( configChanged() ), this, SLOT( slotConfigChanged() ) );
47
 
 
48
 
        page = addPage( i18n( "&File Open&&Save" ) );
49
 
        layout = new QVBoxLayout( page, 0, spacingHint() );
50
 
        m_fileIO = new SettingsFileIO( page );
51
 
        layout->addWidget( m_fileIO );
52
 
        connect( m_fileIO, SIGNAL( configChanged() ), this, SLOT( slotConfigChanged() ) );
53
 
 
54
 
        page = addPage( i18n( "&Search URLs" ) );
55
 
        layout = new QVBoxLayout( page, 0, spacingHint() );
56
 
        m_searchURL = new SettingsSearchURL( page );
57
 
        layout->addWidget( m_searchURL );
58
 
        connect( m_searchURL, SIGNAL( configChanged() ), this, SLOT( slotConfigChanged() ) );
59
 
 
60
 
        page = addPage( i18n( "Global &Keywords" ), QString::null, SmallIcon( "package" ) );
61
 
        layout = new QVBoxLayout( page, 0, spacingHint() );
62
 
        m_keyword = new SettingsKeyword( page );
63
 
        layout->addWidget( m_keyword );
64
 
        connect( m_keyword, SIGNAL( configChanged() ), this, SLOT( slotConfigChanged() ) );
65
 
 
66
 
        page = addPage( i18n( "Id Suggestions" ) );
67
 
        layout = new QVBoxLayout( page, 0, spacingHint() );
68
 
        m_idSuggestions = new SettingsIdSuggestions( page );
69
 
        layout->addWidget( m_idSuggestions );
70
 
        connect( m_idSuggestions, SIGNAL( configChanged() ), this, SLOT( slotConfigChanged() ) );
71
 
 
72
 
        page = addPage( i18n( "User Defined Fields" ) );
73
 
        layout = new QVBoxLayout( page, 0, spacingHint() );
74
 
        m_userDefinedInput = new SettingsUserDefinedInput( page );
75
 
        layout->addWidget( m_userDefinedInput );
76
 
        connect( m_userDefinedInput, SIGNAL( configChanged() ), this, SLOT( slotConfigChanged() ) );
77
 
 
78
 
#ifdef HAVE_YAZ
79
 
        page = addPage( i18n( "Z39.50" ) );
80
 
        layout = new QVBoxLayout( page, 0, spacingHint() );
81
 
        m_z3950config = new SettingsZ3950( page );
82
 
        layout->addWidget( m_z3950config );
83
 
        connect( m_z3950config, SIGNAL( configChanged() ), this, SLOT( slotConfigChanged() ) );
84
 
#endif // HAVE_YAZ
85
 
 
86
 
        connect( this, SIGNAL( applyClicked() ), SLOT( slotApplySettings() ) );
87
 
    }
88
 
 
89
 
 
90
 
    SettingsDlg::~SettingsDlg()
91
 
    {
92
 
        // nothing
93
 
    }
94
 
 
95
 
    int SettingsDlg::exec()
96
 
    {
97
 
        m_fileIO->readData();
98
 
        m_editing->readData();
99
 
        m_searchURL->readData();
100
 
        m_keyword->readData();
101
 
        m_idSuggestions->readData();
102
 
        m_userDefinedInput->readData();
103
 
#ifdef HAVE_YAZ
104
 
        m_z3950config->readData();
105
 
#endif // HAVE_YAZ
106
 
        enableButton( Apply, FALSE );
107
 
 
108
 
        return KDialogBase::exec();
109
 
    }
110
 
 
111
 
    void SettingsDlg::slotConfigChanged()
112
 
    {
113
 
        enableButton( Apply, TRUE );
114
 
    }
115
 
 
116
 
    void SettingsDlg::slotApplySettings()
117
 
    {
118
 
        m_fileIO->applyData();
119
 
        m_editing->applyData();
120
 
        m_searchURL->applyData();
121
 
        m_keyword->applyData();
122
 
        m_idSuggestions->applyData();
123
 
        m_userDefinedInput->applyData();
124
 
#ifdef HAVE_YAZ
125
 
        m_z3950config->applyData();
126
 
#endif // HAVE_YAZ
127
 
        enableButton( Apply, FALSE );
128
 
    }
129
 
 
130
 
    void SettingsDlg::accept()
131
 
    {
132
 
        slotApplySettings();
133
 
        KDialogBase::accept();
134
 
    }
135
 
}
136
 
 
137
 
#include "settingsdlg.moc"