summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-30 17:55:57 (UTC)
committer zautrix <zautrix>2005-03-30 17:55:57 (UTC)
commit0d8be3961052dc4396aa7db1c5f50db3ec1ac194 (patch) (side-by-side diff)
treef823a8b81413f16f861c9c91ef753d3627577cb2
parent95ec57b2f9df64dc40067c3a2278438029517f4c (diff)
downloadkdepimpi-0d8be3961052dc4396aa7db1c5f50db3ec1ac194.zip
kdepimpi-0d8be3961052dc4396aa7db1c5f50db3ec1ac194.tar.gz
kdepimpi-0d8be3961052dc4396aa7db1c5f50db3ec1ac194.tar.bz2
MENU CLEANUP
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/extensionmanager.cpp4
-rw-r--r--kaddressbook/kabcore.cpp28
-rw-r--r--kaddressbook/viewmanager.cpp2
3 files changed, 17 insertions, 17 deletions
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp
index efbdf17..46defa1 100644
--- a/kaddressbook/extensionmanager.cpp
+++ b/kaddressbook/extensionmanager.cpp
@@ -1,248 +1,248 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qapplication.h>
#include <kactionclasses.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
#ifndef KAB_EMBEDDED
#include <ktrader.h>
#else //KAB_EMBEDDED
#include <features/mergewidget.h>
#include <features/distributionlistwidget.h>
#endif //KAB_EMBEDDED
#include "addresseeeditorwidget.h"
#include "kabcore.h"
#include "kabprefs.h"
#include "extensionmanager.h"
ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent,
const char *name )
: QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 )
{
#ifdef KAB_EMBEDDED
//US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
- QWidget *settingsmenu = (QWidget*)mCore->getSettingsMenu();
+ QWidget *settingsmenu = (QWidget*)mCore->getViewMenu();
#endif //KAB_EMBEDDED
mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0,
mCore->actionCollection(),
"options_show_extensions" );
- mActionExtensions->plug( settingsmenu );
+ mActionExtensions->plug( settingsmenu ,0);
connect( mActionExtensions, SIGNAL( activated( int ) ),
SLOT( setActiveExtension( int ) ) );
mWidgetBox = new QWidget( viewport() );
new QHBoxLayout (mWidgetBox );
addChild( mWidgetBox );
setResizePolicy(AutoOneFit);
createExtensionWidgets();
hide();
}
ExtensionManager::~ExtensionManager()
{
}
void ExtensionManager::restoreSettings()
{
mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension );
int i = 1;
mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 );
while ( mCurrentExtensionWidget ) {
if( i != KABPrefs::instance()->mCurrentExtension )
mCurrentExtensionWidget->hide();
mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 );
}
setActiveExtension( mActionExtensions->currentItem() );
}
void ExtensionManager::saveSettings()
{
KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem();
}
void ExtensionManager::reconfigure()
{
saveSettings();
createExtensionWidgets();
restoreSettings();
}
bool ExtensionManager::isQuickEditVisible() const
{
return ( mCurrentExtensionWidget &&
mCurrentExtensionWidget->identifier() == "contact_editor" );
}
void ExtensionManager::setSelectionChanged()
{
if ( mCurrentExtensionWidget )
mCurrentExtensionWidget->contactsSelectionChanged();
}
void ExtensionManager::setActiveExtension( int id )
{
//qDebug("+++++++++++++++++++ExtensionManager::setActiveExtension %d ", id);
if ( id == 0 ) {
hide();
mCurrentExtensionWidget = 0;
#ifndef DESKTOP_VERSION
//US our screen is so small, that we better hide the detailscreen, just in case.
//US mCore->setDetailsToState( );
#endif //KAB_EMBEDDED
} else if ( id > 0 ) {
if ( mCurrentExtensionWidget )
mCurrentExtensionWidget->hide();
mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 );
if ( mCurrentExtensionWidget ) {
#ifndef DESKTOP_VERSION
//US our screen is so small, that we better hide the detailscreen, just in case.
//US mCore->setDetailsVisible( false );
#endif //KAB_EMBEDDED
show();
mWidgetBox->show();
mCurrentExtensionWidget->show();
} else {
hide();
mCurrentExtensionWidget = 0;
#ifndef DESKTOP_VERSION
//US our screen is so small, that we better hide the detailscreen, just in case.
//US mCore->setDetailsToState( );
#endif //KAB_EMBEDDED
}
}
emit changedActiveExtension( id );
}
void ExtensionManager::createExtensionWidgets()
{
// clear extension widget list
mExtensionWidgetList.setAutoDelete( true );
QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList );
ExtensionWidget *wdg = 0;
while ( ( wdg = wdgIt.current() ) != 0 )
mExtensionWidgetList.remove( wdg );
mExtensionWidgetList.setAutoDelete( false );
QStringList extensionNames( i18n( "None" ) );
// add addressee editor as default
QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();;
wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox );
hbl->addWidget( wdg );
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
// load the other extensions
QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
#ifndef KAB_EMBEDDED
KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
continue;
KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
if ( !factory ) {
//kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl;
continue;
}
ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
if ( !extensionFactory ) {
//kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl;
continue;
}
if ( !activeExtensions.contains( extensionFactory->identifier() ) )
continue;
wdg = extensionFactory->extension( mCore, this );
if ( wdg ) {
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
}
}
#else //KAB_EMBEDDED
//load Mergefactory/extension
ExtensionFactory *extensionFactory = new MergeFactory();
if ( activeExtensions.contains( extensionFactory->identifier() ) )
{
wdg = extensionFactory->extension( mCore, mWidgetBox );
if ( wdg ) {
hbl->addWidget( wdg );
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
}
}
//load DistributionListfactory/extension
extensionFactory = new DistributionListFactory();
if (activeExtensions.contains( extensionFactory->identifier() ) )
{
wdg = extensionFactory->extension( mCore, mWidgetBox );
if ( wdg ) {
hbl->addWidget( wdg );
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
}
}
hbl->addStretch();
#endif //KAB_EMBEDDED
mActionExtensions->setItems( extensionNames );
mCurrentExtensionWidget = 0;
}
#ifndef KAB_EMBEDDED
#include "extensionmanager.moc"
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 1433568..5ef61b1 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1941,523 +1941,523 @@ void KABCore::initActions()
mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
SLOT( export2phone() ), actionCollection(),
"kaddressbook_ex2phone" );
mActionBeamVCard = 0;
mActionBeam = 0;
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) {
mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
SLOT( beamVCard() ), actionCollection(),
"kaddressbook_beam_vcard" );
mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
SLOT( beamMySelf() ), actionCollection(),
"kaddressbook_beam_myself" );
}
#endif
mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
this, SLOT( editContact2() ),
actionCollection(), "file_properties" );
#ifdef KAB_EMBEDDED
// mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
mMainWindow, SLOT( exit() ),
actionCollection(), "quit" );
#endif //KAB_EMBEDDED
// edit menu
if ( mIsPart ) {
mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
SLOT( copyContacts() ), actionCollection(),
"kaddressbook_copy" );
mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
SLOT( cutContacts() ), actionCollection(),
"kaddressbook_cut" );
mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
SLOT( pasteContacts() ), actionCollection(),
"kaddressbook_paste" );
mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
SLOT( selectAllContacts() ), actionCollection(),
"kaddressbook_select_all" );
mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
SLOT( undo() ), actionCollection(),
"kaddressbook_undo" );
mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
this, SLOT( redo() ), actionCollection(),
"kaddressbook_redo" );
} else {
mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
}
mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
Key_Delete, this, SLOT( deleteContacts() ),
actionCollection(), "edit_delete" );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
// settings menu
#ifdef KAB_EMBEDDED
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
SLOT( configureResources() ), actionCollection(),
"kaddressbook_configure_resources" );
#endif //KAB_EMBEDDED
if ( mIsPart ) {
mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
SLOT( openConfigDialog() ), actionCollection(),
"kaddressbook_configure" );
//US not implemented yet
//mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
// this, SLOT( configureKeyBindings() ), actionCollection(),
// "kaddressbook_configure_shortcuts" );
#ifdef KAB_EMBEDDED
mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
mActionConfigureToolbars->setEnabled( false );
#endif //KAB_EMBEDDED
} else {
mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
//US not implemented yet
//mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
}
mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
actionCollection(), "options_show_jump_bar" );
connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) );
mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
actionCollection(), "options_show_details" );
connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
SLOT( toggleBeamReceive() ), actionCollection(),
"kaddressbook_beam_rec" );
// misc
// only enable LDAP lookup if we can handle the protocol
#ifndef KAB_EMBEDDED
if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
this, SLOT( openLDAPDialog() ), actionCollection(),
"ldap_lookup" );
}
#else //KAB_EMBEDDED
//qDebug("KABCore::initActions() LDAP has to be implemented");
#endif //KAB_EMBEDDED
mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
SLOT( setWhoAmI() ), actionCollection(),
"set_personal" );
mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this,
SLOT( setCategories() ), actionCollection(),
"edit_set_categories" );
mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this,
SLOT( editCategories() ), actionCollection(),
"edit__categories" );
mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
SLOT( removeVoice() ), actionCollection(),
"remove_voice" );
mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
SLOT( setFormattedName() ), actionCollection(),
"set_formatted" );
mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
SLOT( manageCategories() ), actionCollection(),
"remove_voice" );
mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
SLOT( importFromOL() ), actionCollection(),
"import_OL" );
#ifdef KAB_EMBEDDED
mActionLicence = new KAction( i18n( "Licence" ), 0,
this, SLOT( showLicence() ), actionCollection(),
"licence_about_data" );
mActionFaq = new KAction( i18n( "Faq" ), 0,
this, SLOT( faq() ), actionCollection(),
"faq_about_data" );
mActionWN = new KAction( i18n( "What's New?" ), 0,
this, SLOT( whatsnew() ), actionCollection(),
"wn" );
mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
this, SLOT( synchowto() ), actionCollection(),
"sync" );
mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
this, SLOT( kdesynchowto() ), actionCollection(),
"kdesync" );
mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
this, SLOT( multisynchowto() ), actionCollection(),
"multisync" );
mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
this, SLOT( createAboutData() ), actionCollection(),
"kaddressbook_about_data" );
#endif //KAB_EMBEDDED
clipboardDataChanged();
connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
}
//US we need this function, to plug all actions into the correct menues.
// KDE uses a XML format to plug the actions, but we work her without this overhead.
void KABCore::addActionsManually()
{
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
#ifdef KAB_EMBEDDED
QPopupMenu *fileMenu = new QPopupMenu( this );
QPopupMenu *editMenu = new QPopupMenu( this );
QPopupMenu *helpMenu = new QPopupMenu( this );
KToolBar* tb = mMainWindow->toolBar();
-
+ mMainWindow->setToolBarsMovable (false );
#ifndef DESKTOP_VERSION
if ( KABPrefs::instance()->mFullMenuBarVisible ) {
#endif
QMenuBar* mb = mMainWindow->menuBar();
//US setup menubar.
//Disable the following block if you do not want to have a menubar.
mb->insertItem( i18n("&File"), fileMenu );
mb->insertItem( i18n("&Edit"), editMenu );
mb->insertItem( i18n("&View"), viewMenu );
mb->insertItem( i18n("&Settings"), settingsMenu );
#ifdef DESKTOP_VERSION
mb->insertItem( i18n("Synchronize"), syncMenu );
#else
mb->insertItem( i18n("Sync"), syncMenu );
#endif
//mb->insertItem( i18n("&Change"), changeMenu );
mb->insertItem( i18n("&Help"), helpMenu );
mIncSearchWidget = new IncSearchWidget( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget);
#ifndef DESKTOP_VERSION
} else {
//US setup toolbar
QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
QPopupMenu *popupBarTB = new QPopupMenu( this );
menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
tb->insertWidget(-1, 0, menuBarTB);
mIncSearchWidget = new IncSearchWidget( tb );
tb->enableMoving(false);
popupBarTB->insertItem( i18n("&File"), fileMenu );
popupBarTB->insertItem( i18n("&Edit"), editMenu );
popupBarTB->insertItem( i18n("&View"), viewMenu );
popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
mViewManager->getFilterAction()->plug ( popupBarTB);
//popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
popupBarTB->insertItem( i18n("&Help"), helpMenu );
if (QApplication::desktop()->width() > 320 ) {
// mViewManager->getFilterAction()->plug ( tb);
}
}
#endif
// mActionQuit->plug ( mMainWindow->toolBar());
//US Now connect the actions with the menue entries.
#ifdef DESKTOP_VERSION
mActionPrint->plug( fileMenu );
mActionPrintDetails->plug( fileMenu );
fileMenu->insertSeparator();
#endif
mActionMail->plug( fileMenu );
fileMenu->insertSeparator();
- mActionNewContact->plug( fileMenu );
+ mActionNewContact->plug( editMenu );
mActionNewContact->plug( tb );
- mActionEditAddressee->plug( fileMenu );
+ mActionEditAddressee->plug( editMenu );
+ editMenu->insertSeparator();
// if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
// (!KABPrefs::instance()->mMultipleViewsAtOnce ))
mActionEditAddressee->plug( tb );
- fileMenu->insertSeparator();
+ // fileMenu->insertSeparator();
mActionSave->plug( fileMenu );
fileMenu->insertItem( "&Import", ImportMenu );
fileMenu->insertItem( "&Export", ExportMenu );
- fileMenu->insertItem( i18n("&Change"), changeMenu );
+ editMenu->insertItem( i18n("&Change"), changeMenu );
+ editMenu->insertSeparator();
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
#endif
#if 0
// PENDING fix MailVCard
fileMenu->insertSeparator();
mActionMailVCard->plug( fileMenu );
#endif
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBR->plug( beamMenu );
if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
if ( Ir::supported() ) mActionBeam->plug( beamMenu );
#endif
fileMenu->insertSeparator();
mActionQuit->plug( fileMenu );
#ifdef _OL_IMPORT_
mActionImportOL->plug( ImportMenu );
#endif
// edit menu
mActionUndo->plug( editMenu );
mActionRedo->plug( editMenu );
editMenu->insertSeparator();
mActionCut->plug( editMenu );
mActionCopy->plug( editMenu );
mActionPaste->plug( editMenu );
mActionDelete->plug( editMenu );
editMenu->insertSeparator();
mActionSelectAll->plug( editMenu );
mActionSetFormattedName->plug( changeMenu );
mActionRemoveVoice->plug( changeMenu );
// settingsmings menu
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
// settingsMenu->insertSeparator();
mActionConfigKAddressbook->plug( settingsMenu, 0 );
mActionConfigResources->plug( settingsMenu,1 );
settingsMenu->insertSeparator(2);
if ( mIsPart ) {
//US not implemented yet
//mActionConfigShortcuts->plug( settingsMenu );
//mActionConfigureToolbars->plug( settingsMenu );
} else {
//US not implemented yet
//mActionKeyBindings->plug( settingsMenu );
}
- settingsMenu->insertSeparator();
-
- mActionJumpBar->plug( settingsMenu );
- mActionDetails->plug( settingsMenu );
+ mActionEditCategories->plug( settingsMenu );
+ mActionManageCategories->plug( settingsMenu );
+ mActionJumpBar->plug( viewMenu,0 );
+ mActionDetails->plug( viewMenu,0 );
//if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
mActionDetails->plug( tb );
settingsMenu->insertSeparator();
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBR->plug(settingsMenu );
settingsMenu->insertSeparator();
#endif
mActionWhoAmI->plug( settingsMenu );
- mActionEditCategories->plug( settingsMenu );
- mActionEditCategories->plug( changeMenu );
+ //mActionEditCategories->plug( changeMenu );
mActionCategories->plug( changeMenu );
- mActionManageCategories->plug( changeMenu );
+ //mActionManageCategories->plug( changeMenu );
- mActionCategories->plug( settingsMenu );
- mActionManageCategories->plug( settingsMenu );
+ //mActionCategories->plug( settingsMenu );
mActionWN->plug( helpMenu );
mActionSyncHowto->plug( helpMenu );
mActionKdeSyncHowto->plug( helpMenu );
mActionMultiSyncHowto->plug( helpMenu );
mActionFaq->plug( helpMenu );
mActionLicence->plug( helpMenu );
mActionAboutKAddressbook->plug( helpMenu );
if (KGlobal::getDesktopSize() > KGlobal::Small ) {
mActionSave->plug( tb );
mViewManager->getFilterAction()->plug ( tb);
//LR hide filteraction on started in 480x640
if (QApplication::desktop()->width() == 480 ) {
mViewManager->getFilterAction()->setComboWidth( 0 );
}
mActionUndo->plug( tb );
mActionDelete->plug( tb );
mActionRedo->plug( tb );
} else {
mActionSave->plug( tb );
tb->enableMoving(false);
}
//mActionQuit->plug ( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget, 6);
//US link the searchwidget first to this.
// The real linkage to the toolbar happens later.
//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
//US tb->insertItem( mIncSearchWidget );
/*US
mIncSearchWidget = new IncSearchWidget( tb );
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mJumpButtonBar = new JumpButtonBar( this, this );
//US topLayout->addWidget( mJumpButtonBar );
this->layout()->add( mJumpButtonBar );
*/
#endif //KAB_EMBEDDED
mActionExport2phone->plug( ExportMenu );
connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
}
void KABCore::showLicence()
{
KApplication::showLicence();
}
void KABCore::manageCategories( )
{
KABCatPrefs* cp = new KABCatPrefs();
cp->show();
int w =cp->sizeHint().width() ;
int h = cp->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
delete cp;
return;
}
int count = 0;
int cc = 0;
message( i18n("Please wait, processing categories..."));
if ( cp->addCat() ) {
KABC::AddressBook::Iterator it;
QStringList catList = KABPrefs::instance()->mCustomCategories;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
++cc;
if ( cc %10 == 0)
message(i18n("Processing contact #%1").arg(cc));
QStringList catIncList = (*it).categories();
int i;
for( i = 0; i< catIncList.count(); ++i ) {
if ( !catList.contains (catIncList[i])) {
catList.append( catIncList[i] );
//qDebug("add cat %s ", catIncList[i].latin1());
++count;
}
}
}
catList.sort();
KABPrefs::instance()->mCustomCategories = catList;
KABPrefs::instance()->writeConfig();
message(QString::number( count )+ i18n(" categories added to list! "));
} else {
QStringList catList = KABPrefs::instance()->mCustomCategories;
QStringList catIncList;
QStringList newCatList;
KABC::AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
++cc;
if ( cc %10 == 0)
message(i18n("Processing contact #%1").arg(cc));
QStringList catIncList = (*it).categories();
int i;
if ( catIncList.count() ) {
newCatList.clear();
for( i = 0; i< catIncList.count(); ++i ) {
if ( catList.contains (catIncList[i])) {
newCatList.append( catIncList[i] );
}
}
newCatList.sort();
(*it).setCategories( newCatList );
mAddressBook->insertAddressee( (*it) );
}
}
setModified( true );
mViewManager->refreshView();
message( i18n("Removing categories done!"));
}
delete cp;
}
void KABCore::removeVoice()
{
if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
return;
XXPortSelectDialog dlg( this, false, this );
if ( !dlg.exec() )
return;
mAddressBook->setUntagged();
dlg.tagSelected();
message(i18n("Removing voice..."), false );
KABC::AddressBook::Iterator it;
for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).tagged() ) {
(*it).removeVoice();
}
}
message(i18n("Refreshing view...") );
qApp->processEvents();
mViewManager->refreshView( "" );
Addressee add;
mDetails->setAddressee( add );
message(i18n("Remove voice completed!") );
}
void KABCore::setFormattedName()
{
KABFormatPrefs setpref;
if ( !setpref.exec() ) {
return;
}
XXPortSelectDialog dlg( this, false, this );
if ( !dlg.exec() )
return;
mAddressBook->setUntagged();
dlg.tagSelected();
int count = 0;
KABC::AddressBook::Iterator it;
for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).tagged() ) {
++count;
if ( count %10 == 0 )
message(i18n("Changing contact #%1").arg( count ) );
qApp->processEvents();
QString fName;
if ( setpref.simple->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
else if ( setpref.full->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
else if ( setpref.reverse->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
else
fName = (*it).organization();
if ( setpref.setCompany->isChecked() )
if ( fName.isEmpty() || fName =="," )
fName = (*it).organization();
(*it).setFormattedName( fName );
}
}
message(i18n("Refreshing view...") );
qApp->processEvents();
mViewManager->refreshView( "" );
Addressee add;
mDetails->setAddressee( add );
message(i18n("Setting formatted name completed!") );
}
void KABCore::clipboardDataChanged()
{
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index c2b1bb0..86f0f3d 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -531,207 +531,207 @@ void ViewManager::dropped( QDropEvent *e )
qDebug("ViewManager::dropped() has to be changed!!" );
#endif //KAB_EMBEDDED
}
void ViewManager::startDrag()
{
kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
#ifndef KAB_EMBEDDED
// Get the list of all the selected addressees
KABC::Addressee::List addrList;
QStringList uidList = selectedUids();
QStringList::Iterator iter;
for ( iter = uidList.begin(); iter != uidList.end(); ++iter )
addrList.append( mCore->addressBook()->findByUid( *iter ) );
KMultipleDrag *drag = new KMultipleDrag( this );
drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
KABC::Addressee::List::Iterator it;
QStringList vcards;
for ( it = addrList.begin(); it != addrList.end(); ++it ) {
QString vcard = QString::null;
KABC::VCardConverter converter;
if ( converter.addresseeToVCard( *it, vcard ) )
vcards.append( vcard );
}
drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
drag->dragCopy();
#else //KAB_EMBEDDED
qDebug("ViewManager::startDrag() has to be changed!!" );
#endif //KAB_EMBEDDED
}
void ViewManager::doSearch( const QString& s,KABC::Field *field )
{
if ( mActiveView )
mActiveView->doSearch( s, field );
}
void ViewManager::setActiveFilter( int index )
{
Filter currentFilter;
if ( ( index - 1 ) < 0 )
currentFilter = Filter();
else
currentFilter = mFilterList[ index - 1 ];
// Check if we have a view. Since the filter combo is created before
// the view, this slot could be called before there is a valid view.
if ( mActiveView ) {
mActiveView->setFilter( currentFilter );
mActiveView->refresh();
emit selected( QString::null );
}
}
void ViewManager::configureFilters()
{
FilterDialog dlg( this );
dlg.setFilters( mFilterList );
if ( dlg.exec() )
mFilterList = dlg.filters();
uint pos = mActionSelectFilter->currentItem();
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
int cw = 150;
if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch)
cw = 0;
mActionSelectFilter->setComboWidth( cw );
saveSettings();
}
QStringList ViewManager::filterNames() const
{
QStringList names( i18n( "No Filter" ) );
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
names.append( (*it).name() );
return names;
}
Filter ViewManager::getFilterByName( const QString &name ) const
{
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
if ( name == (*it).name() )
return (*it);
return Filter();
}
int ViewManager::filterPosition( const QString &name ) const
{
int pos = 0;
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
if ( name == (*it).name() )
return pos + 1;
return 0;
}
void ViewManager::initActions()
{
//US <ActionList name="view_loadedviews"/>
//US <Separator/>
#ifdef KAB_EMBEDDED
QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
#endif //KAB_EMBEDDED
mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
#if KDE_VERSION >= 309
mActionSelectView->setMenuAccelsEnabled( false );
#endif
connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
SLOT( selectView( const QString& ) ) );
#ifdef KAB_EMBEDDED
mActionSelectView->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
KAction *action;
action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
SLOT( editView() ), mCore->actionCollection(), "view_modify" );
#ifndef KAB_EMBEDDED
action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) );
#else //KAB_EMBEDDED
action->plug(viewmenu);
#endif //KAB_EMBEDDED
action = new KAction( i18n( "Add View..." ), "window_new", 0, this,
SLOT( addView() ), mCore->actionCollection(), "view_add" );
#ifndef KAB_EMBEDDED
action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) );
#else //KAB_EMBEDDED
action->plug(viewmenu);
#endif //KAB_EMBEDDED
mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0,
this, SLOT( deleteView() ),
mCore->actionCollection(), "view_delete" );
#ifndef KAB_EMBEDDED
mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) );
#else //KAB_EMBEDDED
mActionDeleteView->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
#ifndef KAB_EMBEDDED
action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
SLOT( refreshView(const QString &) ), mCore->actionCollection(),
"view_refresh" );
action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) );
#else //KAB_EMBEDDED
action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
SLOT( refreshView()), mCore->actionCollection(),
"view_refresh" );
action->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
SLOT( configureFilters() ), mCore->actionCollection(),
"options_edit_filters" );
mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" );
#if KDE_VERSION >= 309
mActionSelectFilter->setMenuAccelsEnabled( false );
#endif
connect( mActionSelectFilter, SIGNAL( activated( int ) ),
SLOT( setActiveFilter( int ) ) );
#ifdef KAB_EMBEDDED
action->plug(settingsmenu);
- mActionSelectFilter->plug(viewmenu);
+ mActionSelectFilter->plug(viewmenu,0);
#endif //KAB_EMBEDDED
}
void ViewManager::initGUI()
{
QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 );
mViewWidgetStack = new QWidgetStack( this );
layout->addWidget( mViewWidgetStack );
}
#ifndef KAB_EMBEDDED
#include "viewmanager.moc"
#endif //KAB_EMBEDDED