2 kopetestdaction.cpp - Kopete Standard Actionds
4 Copyright (c) 2001-2002 by Ryan Cumming <ryan@kde.org>
5 Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
7 Kopete (c) 2001-2003 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2 of the License, or (at your option) any later version. *
16 *************************************************************************
19 #include "kopetestdaction.h"
21 #include <qapplication.h>
24 #include <kdeversion.h>
27 #include <ksettings/dialog.h>
28 #include <kstandardaction.h>
29 #include <KStandardGuiItem>
30 #include <kwindowsystem.h>
31 #include <kcmultidialog.h>
34 #include "kopetecontactlist.h"
35 #include "kopetegroup.h"
36 #include "kopeteuiglobal.h"
37 #include <kactioncollection.h>
39 KSettings::Dialog
*KopetePreferencesAction::s_settingsDialog
= 0L;
41 KopetePreferencesAction::KopetePreferencesAction( KActionCollection
*parent
, const char *name
)
42 : KAction( KIcon(KStandardGuiItem::configure().iconName()), KStandardGuiItem::configure().text(), parent
)
44 connect( this, SIGNAL( triggered(bool) ), this, SLOT( slotShowPreferences() ) );
45 parent
->addAction( name
, this );
48 KopetePreferencesAction::~KopetePreferencesAction()
52 void KopetePreferencesAction::slotShowPreferences()
54 // No need of static deleter since when the parent is deleted, the settings dialog is deleted (ereslibre)
55 if ( !s_settingsDialog
)
57 s_settingsDialog
= new KSettings::Dialog( Kopete::UI::Global::mainWidget() );
60 s_settingsDialog
->show();
62 s_settingsDialog
->raise();
63 KWindowSystem::activateWindow( s_settingsDialog
->winId() );
66 KAction
* KopeteStdAction::preferences( KActionCollection
*parent
, const char *name
)
68 return new KopetePreferencesAction( parent
, name
);
71 KAction
* KopeteStdAction::createAction(const QString
&text
, const KIcon
&icon
, const QObject
*receiver
, const char *slot
, QObject
* parent
)
73 KAction
*newAction
= new KAction(icon
, text
, parent
);
76 QObject::connect(newAction
, SIGNAL(triggered(bool)), receiver
, slot
);
81 KAction
* KopeteStdAction::chat( const QObject
*recvr
, const char *slot
, QObject
* parent
)
83 return createAction( i18n( "Start &Chat..." ), KIcon("mail-message-new"), recvr
, slot
, parent
);
86 KAction
* KopeteStdAction::sendMessage( const QObject
*recvr
, const char *slot
, QObject
* parent
)
88 return createAction( i18n( "&Send Single Message..." ), KIcon( "mail-message-new" ), recvr
, slot
, parent
);
91 KAction
* KopeteStdAction::contactInfo( const QObject
*recvr
, const char *slot
, QObject
* parent
)
93 return createAction( i18n( "User &Info" ), KIcon( "dialog-information" ), recvr
, slot
, parent
);
96 KAction
* KopeteStdAction::sendFile( const QObject
*recvr
, const char *slot
, QObject
* parent
)
98 return createAction( i18n( "Send &File..." ), KIcon( "mail-attachment" ), recvr
, slot
, parent
);
101 KAction
* KopeteStdAction::viewHistory( const QObject
*recvr
, const char *slot
, QObject
* parent
)
103 return createAction( i18n( "View &History..." ), KIcon( "view-history" ), recvr
, slot
, parent
);
106 KAction
* KopeteStdAction::addGroup( const QObject
*recvr
, const char *slot
, QObject
* parent
)
108 return createAction( i18n( "&Create Group..." ), KIcon( "folder-new" ), recvr
, slot
, parent
);
111 KAction
* KopeteStdAction::changeMetaContact( const QObject
*recvr
, const char *slot
, QObject
* parent
)
113 return createAction( i18n( "Cha&nge Meta Contact..." ), KIcon( "transform-move" ), recvr
, slot
, parent
);
116 KAction
* KopeteStdAction::deleteContact( const QObject
*recvr
, const char *slot
, QObject
* parent
)
118 KAction
*deleteAction
= createAction( i18n( "&Delete Contact" ), KIcon( "list-remove-user" ), recvr
, slot
, parent
);
119 deleteAction
->setShortcut( KShortcut(Qt::Key_Delete
) );
124 KAction
* KopeteStdAction::changeAlias( const QObject
*recvr
, const char *slot
, QObject
* parent
)
126 return createAction( i18n( "Change A&lias..." ), KIcon( "edit-rename" ), recvr
, slot
, parent
);
129 KAction
* KopeteStdAction::blockContact( const QObject
*recvr
, const char *slot
, QObject
* parent
)
131 return createAction( i18n( "&Block Contact" ), KIcon( "media-playback-pause" ), recvr
, slot
, parent
);
134 KAction
* KopeteStdAction::unblockContact( const QObject
*recvr
, const char *slot
, QObject
* parent
)
136 return createAction( i18n( "Un&block Contact" ), KIcon( "media-playback-start" ), recvr
, slot
, parent
);
139 #include "kopetestdaction.moc"
141 // vim: set noet ts=4 sts=4 sw=4: