kitchensync

mainwindow.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002,2003 Holger Freyther <zecke@handhelds.org>
00005     Copyright (c) 2002,2003 Maximilian Reiß <harlekin@handhelds.org>
00006     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, USA.
00022 */
00023 
00024 #include <qwidgetstack.h>
00025 
00026 #include <klocale.h>
00027 #include <kstatusbar.h>
00028 #include <kfiledialog.h>
00029 #include <kdebug.h>
00030 #include <kiconloader.h>
00031 #include <kcmultidialog.h>
00032 
00033 #include <kparts/componentfactory.h>
00034 #include <kparts/mainwindow.h>
00035 #include <kpopupmenu.h>
00036 
00037 #include <syncer.h>
00038 #include <syncuikde.h>
00039 
00040 #include <konnectormanager.h>
00041 #include <konnector.h>
00042 
00043 #include "syncconfig.h"
00044 #include "configuredialog.h"
00045 #include "partbar.h"
00046 #include "profiledialog.h"
00047 
00048 #include "konnectorbar.h"
00049 #include "kitchensync.h"
00050 #include "actionmanager.h"
00051 
00052 #include "mainwindow.h"
00053 
00054 using namespace KSync;
00055 
00056 MainWindow::MainWindow( QWidget *widget, const char *name )
00057   : KParts::MainWindow( widget, name )
00058 {
00059   mActionManager = new ActionManager( actionCollection() );
00060 
00061   mView = new KitchenSync( mActionManager, this );
00062   setCentralWidget( mView );
00063 
00064   mActionManager->setView( mView );
00065   mActionManager->initActions();
00066   KStdAction::quit( this, SLOT( close() ), actionCollection() );
00067   setXMLFile( "ksyncgui.rc" );
00068   createGUI( 0 );
00069 
00070   mView->initProfiles();
00071   mActionManager->readConfig();
00072   mView->activateProfile();
00073 
00074   m_konBar = new KonnectorBar( statusBar() );
00075   connect( m_konBar, SIGNAL( toggled( bool ) ),
00076            mView, SLOT( slotKonnectorBar( bool ) ) );
00077   statusBar()->addWidget( m_konBar, 0, true );
00078   statusBar()->show();
00079 
00080   setAutoSaveSettings();
00081 }
00082 
00083 MainWindow::~MainWindow()
00084 {
00085   delete mActionManager;
00086 }
00087 
00088 int MainWindow::currentProfile()
00089 {
00090   return m_profAct->currentItem();
00091 }
00092 
00093 void MainWindow::setProfiles( const QStringList &profiles )
00094 {
00095   m_profAct->setItems( profiles );
00096 }
00097 
00098 #include "mainwindow.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys