2 This file is part of KAddressBook.
4 Copyright (c) 2007 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "mainwindow.h"
24 #include <kactioncollection.h>
25 #include <kcmultidialog.h>
26 #include <kedittoolbar.h>
27 #include <kshortcutsdialog.h>
28 #include <kstandardaction.h>
31 #include "mainwidget.h"
33 MainWindow::MainWindow()
36 mMainWidget
= new MainWidget( this, this );
38 setCentralWidget( mMainWidget
);
42 setStandardToolBarMenuEnabled( true );
44 toolBar()->setToolButtonStyle( Qt::ToolButtonTextUnderIcon
);
46 setupGUI( Keys
| Save
| Create
, "kaddressbookui.rc" );
48 setAutoSaveSettings();
51 MainWindow::~MainWindow()
55 void MainWindow::initActions()
57 KStandardAction::quit( this, SLOT( close() ), actionCollection() );
59 KAction
*action
= KStandardAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
60 action
->setWhatsThis( i18n( "You will be presented with a dialog where you can configure the application-wide shortcuts." ) );
62 KStandardAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
63 KStandardAction::preferences( this, SLOT( configure() ), actionCollection() );
66 void MainWindow::configure()
68 KCMultiDialog
dlg( this );
69 dlg
.addModule( "akonadicontact_actions.desktop" );
70 dlg
.addModule( "kcmldap.desktop" );
75 void MainWindow::configureKeyBindings()
77 KShortcutsDialog::configure( actionCollection(), KShortcutsEditor::LetterShortcutsAllowed
, this );
80 void MainWindow::configureToolbars()
82 saveMainWindowSettings( KGlobal::config()->group( "MainWindow" ) );
84 KEditToolBar
dlg( factory() );
85 connect( &dlg
, SIGNAL( newToolbarConfig() ), this, SLOT( newToolbarConfig() ) );
89 void MainWindow::newToolbarConfig()
91 createGUI( "kaddressbookui.rc" );
93 applyMainWindowSettings( KGlobal::config()->group( "MainWindow" ) );
96 #include "mainwindow.moc"