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

kompare

  • sources
  • kde-4.14
  • kdesdk
  • kompare
  • komparepart
kompareprefdlg.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  kompareprefdlg.cpp
3  ------------------
4  begin : Sun Mar 4 2001
5  Copyright 2001-2009 Otto Bruggeman <bruggie@gmail.com>
6  Copyright 2001-2003 John Firebaugh <jfirebaugh@kde.org>
7  Copyright 2007 Kevin Kofler <kevin.kofler@chello.at>
8 ****************************************************************************/
9 
10 /***************************************************************************
11 **
12 ** This program is free software; you can redistribute it and/or modify
13 ** it under the terms of the GNU General Public License as published by
14 ** the Free Software Foundation; either version 2 of the License, or
15 ** (at your option) any later version.
16 **
17 ***************************************************************************/
18 
19 #include "kompareprefdlg.h"
20 
21 #include <kdebug.h>
22 #include <kiconloader.h>
23 #include <klocale.h>
24 #include <ktabwidget.h>
25 #include <ktoolinvocation.h>
26 
27 #include "diffpage.h"
28 #include "viewpage.h"
29 
30 // implementation
31 
32 KomparePrefDlg::KomparePrefDlg( ViewSettings* viewSets, DiffSettings* diffSets ) : KPageDialog( 0 )
33 {
34  setFaceType( KPageDialog::List );
35  setWindowTitle( i18n( "Preferences" ) );
36  setButtons( Help|Default|Ok|Apply|Cancel );
37  setDefaultButton( Ok );
38  setModal( true );
39  showButtonSeparator( true );
40 
41  // ok i need some stuff in that pref dlg...
42  //setIconListAllVisible(true);
43 
44  m_viewPage = new ViewPage();
45  KPageWidgetItem *item = addPage( m_viewPage, i18n( "View" ) );
46  item->setIcon( KIcon( "preferences-desktop-theme" ) );
47  item->setHeader( i18n( "View Settings" ) );
48  m_viewPage->setSettings( viewSets );
49 
50  m_diffPage = new DiffPage();
51  item = addPage( m_diffPage, i18n( "Diff" ) );
52  item->setIcon( KIcon( "text-x-patch" ) );
53  item->setHeader( i18n( "Diff Settings" ) );
54  m_diffPage->setSettings( diffSets );
55 
56 // frame = addVBoxPage( i18n( "" ), i18n( "" ), UserIcon( "" ) );
57 
58  connect( this, SIGNAL(defaultClicked()), SLOT(slotDefault()) );
59  connect( this, SIGNAL(helpClicked()), SLOT(slotHelp()) );
60  connect( this, SIGNAL(applyClicked()), SLOT(slotApply()) );
61  connect( this, SIGNAL(okClicked()), SLOT(slotOk()) );
62  connect( this, SIGNAL(cancelClicked()), SLOT(slotCancel()) );
63 
64  adjustSize();
65 }
66 
67 KomparePrefDlg::~KomparePrefDlg()
68 {
69 
70 }
71 
73 void KomparePrefDlg::slotDefault()
74 {
75  kDebug(8103) << "SlotDefault called -> Settings should be restored to defaults..." << endl;
76  // restore all defaults in the options...
77  m_viewPage->setDefaults();
78  m_diffPage->setDefaults();
79 }
80 
82 void KomparePrefDlg::slotHelp()
83 {
84  // figure out the current active page
85  QWidget* currentpage = currentPage()->widget();
86  if ( dynamic_cast<ViewPage*>(currentpage) )
87  {
88  // figure out the active tab
89  int currentTab = static_cast<ViewPage*>(currentpage)->m_tabWidget->currentIndex();
90  switch ( currentTab )
91  {
92  case 0:
93  KToolInvocation::invokeHelp( "appearance" );
94  break;
95  case 1:
96  KToolInvocation::invokeHelp( "fonts" );
97  break;
98  default:
99  KToolInvocation::invokeHelp( "view-settings" );
100  }
101  }
102  else if ( dynamic_cast<DiffPage*>(currentpage) )
103  {
104  // figure out the active tab
105  int currentTab = static_cast<DiffPage*>(currentpage)->m_tabWidget->currentIndex();
106  switch ( currentTab )
107  {
108  case 0:
109  KToolInvocation::invokeHelp( "diff" );
110  break;
111  case 1:
112  KToolInvocation::invokeHelp( "diff-format" );
113  break;
114  case 2:
115  KToolInvocation::invokeHelp( "options" );
116  break;
117  case 3:
118  KToolInvocation::invokeHelp( "exclude" );
119  break;
120  default:
121  KToolInvocation::invokeHelp( "diff-settings" );
122  }
123  }
124  else // Fallback since we had not added the code for the page/tab or forgotten about it
125  KToolInvocation::invokeHelp( "configure-preferences" );
126 }
127 
129 void KomparePrefDlg::slotApply()
130 {
131  kDebug(8103) << "SlotApply called -> Settings should be applied..." << endl;
132  // well apply the settings that are currently selected
133  m_viewPage->apply();
134  m_diffPage->apply();
135 
136  emit configChanged();
137 }
138 
140 void KomparePrefDlg::slotOk()
141 {
142  kDebug(8103) << "SlotOk called -> Settings should be applied..." << endl;
143  // Apply the settings that are currently selected
144  m_viewPage->apply();
145  m_diffPage->apply();
146 
147  //accept();
148 }
149 
151 void KomparePrefDlg::slotCancel()
152 {
153  // discard the current settings and use the present ones
154  m_viewPage->restore();
155  m_diffPage->restore();
156 
157  //reject();
158 }
159 
160 #include "kompareprefdlg.moc"
DiffPage::restore
virtual void restore()
No descriptions.
Definition: diffpage.cpp:106
QWidget
KPageDialog
DiffPage::setSettings
void setSettings(DiffSettings *)
Definition: diffpage.cpp:67
ViewPage
Definition: viewpage.h:33
DiffPage
Definition: diffpage.h:40
viewpage.h
DiffPage::setDefaults
virtual void setDefaults()
No descriptions.
Definition: diffpage.cpp:143
DiffPage::apply
virtual void apply()
No descriptions.
Definition: diffpage.cpp:111
KomparePrefDlg::slotCancel
virtual void slotCancel()
No descriptions.
Definition: kompareprefdlg.cpp:151
KomparePrefDlg::slotOk
virtual void slotOk()
No descriptions.
Definition: kompareprefdlg.cpp:140
KomparePrefDlg::configChanged
void configChanged()
ViewPage::setDefaults
virtual void setDefaults()
No descriptions.
Definition: viewpage.cpp:202
KomparePrefDlg::slotDefault
virtual void slotDefault()
No descriptions.
Definition: kompareprefdlg.cpp:73
KomparePrefDlg::slotHelp
virtual void slotHelp()
No descriptions.
Definition: kompareprefdlg.cpp:82
KomparePrefDlg::KomparePrefDlg
KomparePrefDlg(ViewSettings *, DiffSettings *)
Definition: kompareprefdlg.cpp:32
ViewPage::setSettings
void setSettings(ViewSettings *)
Definition: viewpage.cpp:163
kompareprefdlg.h
ViewPage::apply
virtual void apply()
No descriptions.
Definition: viewpage.cpp:187
ViewPage::restore
virtual void restore()
No descriptions.
Definition: viewpage.cpp:183
ViewSettings
Definition: viewsettings.h:29
KomparePrefDlg::~KomparePrefDlg
~KomparePrefDlg()
Definition: kompareprefdlg.cpp:67
KomparePrefDlg::slotApply
virtual void slotApply()
No descriptions.
Definition: kompareprefdlg.cpp:129
diffpage.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kompare

Skip menu "kompare"
  • Main Page
  • Namespace List
  • 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