You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
4.6 KiB
193 lines
4.6 KiB
15 years ago
|
/*
|
||
|
This file is part of KAddressbook.
|
||
|
Copyright (c) 1999 Don Sanders <dsanders@kde.org>
|
||
|
|
||
|
This program is free software; you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation; either version 2 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program; if not, write to the Free Software
|
||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
|
||
|
As a special exception, permission is given to link this program
|
||
14 years ago
|
with any edition of TQt, and distribute the resulting executable,
|
||
|
without including the source code for TQt in the source distribution.
|
||
15 years ago
|
*/
|
||
|
|
||
|
#include <kedittoolbar.h>
|
||
|
#include <kkeydialog.h>
|
||
|
#include <klocale.h>
|
||
|
#include <kmessagebox.h>
|
||
|
#include <kstatusbar.h>
|
||
|
|
||
13 years ago
|
#include <libtdepim/statusbarprogresswidget.h>
|
||
|
#include <libtdepim/progressdialog.h>
|
||
15 years ago
|
|
||
|
#include "kabcore.h"
|
||
|
|
||
|
#include "kaddressbookmain.h"
|
||
|
|
||
15 years ago
|
KAddressBookMain::KAddressBookMain( const TQString &file )
|
||
12 years ago
|
: DCOPObject( "KAddressBookIface" ), TDEMainWindow( 0 )
|
||
15 years ago
|
{
|
||
|
// Set this to be the group leader for all subdialogs - this means
|
||
|
// modal subdialogs will only affect this dialog, not the other windows
|
||
|
setWFlags( getWFlags() | WGroupLeader );
|
||
|
|
||
|
setCaption( i18n( "Address Book Browser" ) );
|
||
|
|
||
|
mCore = new KABCore( this, true, this, file );
|
||
|
mCore->restoreSettings();
|
||
|
|
||
|
initActions();
|
||
|
|
||
|
setCentralWidget( mCore->widget() );
|
||
|
|
||
|
statusBar()->show();
|
||
|
statusBar()->insertItem( "", 1 );
|
||
|
|
||
|
KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(),
|
||
|
this );
|
||
|
progressDialog->hide();
|
||
|
|
||
|
KPIM::StatusbarProgressWidget *progressWidget;
|
||
|
progressWidget = new KPIM::StatusbarProgressWidget( progressDialog,
|
||
|
statusBar() );
|
||
|
progressWidget->show();
|
||
|
|
||
|
statusBar()->addWidget( progressWidget, 0, true );
|
||
|
|
||
13 years ago
|
mCore->setStatusBar( statusBar() );
|
||
15 years ago
|
|
||
|
setStandardToolBarMenuEnabled( true );
|
||
|
|
||
|
createGUI( "kaddressbookui.rc", false );
|
||
|
|
||
|
resize( 400, 300 ); // initial size
|
||
|
setAutoSaveSettings();
|
||
|
}
|
||
|
|
||
|
KAddressBookMain::~KAddressBookMain()
|
||
|
{
|
||
|
mCore->saveSettings();
|
||
|
}
|
||
|
|
||
15 years ago
|
void KAddressBookMain::addEmail( TQString addr )
|
||
15 years ago
|
{
|
||
|
mCore->addEmail( addr );
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::importVCard( const KURL& url )
|
||
|
{
|
||
|
mCore->importVCard( url );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KAddressBookMain::importVCardFromData( const TQString& vCard )
|
||
15 years ago
|
{
|
||
|
mCore->importVCardFromData( vCard );
|
||
|
}
|
||
|
|
||
15 years ago
|
ASYNC KAddressBookMain::showContactEditor( TQString uid )
|
||
15 years ago
|
{
|
||
|
mCore->editContact( uid );
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::newDistributionList()
|
||
|
{
|
||
|
mCore->newDistributionList();
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::newContact()
|
||
|
{
|
||
|
mCore->newContact();
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString KAddressBookMain::getNameByPhone( TQString phone )
|
||
15 years ago
|
{
|
||
|
return mCore->getNameByPhone( phone );
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::save()
|
||
|
{
|
||
|
mCore->save();
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::exit()
|
||
|
{
|
||
|
close();
|
||
|
}
|
||
|
|
||
|
bool KAddressBookMain::handleCommandLine()
|
||
|
{
|
||
|
return mCore->handleCommandLine( this );
|
||
|
}
|
||
|
|
||
14 years ago
|
void KAddressBookMain::syncAllResources()
|
||
|
{
|
||
|
mCore->save();
|
||
|
mCore->load();
|
||
|
}
|
||
|
|
||
12 years ago
|
void KAddressBookMain::saveProperties( TDEConfig* )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
12 years ago
|
void KAddressBookMain::readProperties( TDEConfig* )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
bool KAddressBookMain::queryClose()
|
||
|
{
|
||
|
return mCore->queryClose();
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::initActions()
|
||
|
{
|
||
14 years ago
|
KStdAction::quit( TQT_TQOBJECT(this), TQT_SLOT( close() ), actionCollection() );
|
||
15 years ago
|
|
||
12 years ago
|
TDEAction *action;
|
||
14 years ago
|
action = KStdAction::keyBindings( TQT_TQOBJECT(this), TQT_SLOT( configureKeyBindings() ), actionCollection() );
|
||
15 years ago
|
action->setWhatsThis( i18n( "You will be presented with a dialog, where you can configure the application wide shortcuts." ) );
|
||
|
|
||
14 years ago
|
KStdAction::configureToolbars( TQT_TQOBJECT(this), TQT_SLOT( configureToolbars() ), actionCollection() );
|
||
15 years ago
|
}
|
||
|
|
||
|
void KAddressBookMain::configureKeyBindings()
|
||
|
{
|
||
|
KKeyDialog::configure( actionCollection(), this );
|
||
|
}
|
||
|
|
||
15 years ago
|
void KAddressBookMain::loadProfile( const TQString& )
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
15 years ago
|
void KAddressBookMain::saveToProfile( const TQString& ) const
|
||
15 years ago
|
{
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::configureToolbars()
|
||
|
{
|
||
12 years ago
|
saveMainWindowSettings( TDEGlobal::config(), "MainWindow" );
|
||
15 years ago
|
|
||
|
KEditToolbar edit( factory() );
|
||
15 years ago
|
connect( &edit, TQT_SIGNAL( newToolbarConfig() ),
|
||
|
this, TQT_SLOT( newToolbarConfig() ) );
|
||
15 years ago
|
|
||
|
edit.exec();
|
||
|
}
|
||
|
|
||
|
void KAddressBookMain::newToolbarConfig()
|
||
|
{
|
||
|
createGUI( "kaddressbookui.rc", false );
|
||
12 years ago
|
applyMainWindowSettings( TDEGlobal::config(), "MainWindow" );
|
||
15 years ago
|
}
|
||
|
|
||
|
#include "kaddressbookmain.moc"
|