french -> French
[kdepim.git] / kaddressbook / mainwindow.cpp
blobc3e5f105f745d75797eccebd13a2294d32f70403
1 /*
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"
22 #include "mainwidget.h"
23 #include "xxportmanager.h"
25 #include <KAction>
26 #include <KActionCollection>
27 #include <KEditToolBar>
28 #include <KShortcutsDialog>
29 #include <KStandardAction>
30 #include <KToolBar>
31 #include <KLocale>
33 MainWindow::MainWindow()
34 : KXmlGuiWindow( 0 )
36 mMainWidget = new MainWidget( this, this );
38 setCentralWidget( mMainWidget );
40 initActions();
42 setStandardToolBarMenuEnabled( true );
44 toolBar()->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
46 setupGUI( Keys | Save | Create, QLatin1String("kaddressbookui.rc") );
48 setAutoSaveSettings();
51 MainWindow::~MainWindow()
55 MainWidget *MainWindow::mainWidget() const
57 return mMainWidget;
60 void MainWindow::initActions()
62 KStandardAction::quit( this, SLOT(close()), actionCollection() );
64 KAction *action =
65 KStandardAction::keyBindings( this, SLOT(configureKeyBindings()), actionCollection() );
66 action->setWhatsThis(
67 i18nc( "@info:whatsthis",
68 "You will be presented with a dialog where you can configure "
69 "the application-wide shortcuts." ) );
71 KStandardAction::configureToolbars( this, SLOT(configureToolbars()), actionCollection() );
72 KStandardAction::preferences( this, SLOT(configure()), actionCollection() );
75 void MainWindow::configure()
77 mMainWidget->configure();
80 void MainWindow::configureKeyBindings()
82 KShortcutsDialog::configure( actionCollection(), KShortcutsEditor::LetterShortcutsAllowed, this );
85 void MainWindow::configureToolbars()
87 saveMainWindowSettings( KGlobal::config()->group( "MainWindow" ) );
89 KEditToolBar dlg( factory() );
90 connect( &dlg, SIGNAL(newToolBarConfig()), this, SLOT(newToolbarConfig()) );
91 dlg.exec();
94 void MainWindow::newToolbarConfig()
96 createGUI( QLatin1String("kaddressbookui.rc") );
98 applyMainWindowSettings( KGlobal::config()->group( "MainWindow" ) );