• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
  • ui
kopetestdaction.cpp
Go to the documentation of this file.
1 /*
2  kopetestdaction.cpp - Kopete Standard Actionds
3 
4  Copyright (c) 2001-2002 by Ryan Cumming <ryan@kde.org>
5  Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
6 
7  Kopete (c) 2001-2003 by the Kopete developers <kopete-devel@kde.org>
8 
9  *************************************************************************
10  * *
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. *
15  * *
16  *************************************************************************
17 */
18 
19 #include "kopetestdaction.h"
20 
21 #include <qapplication.h>
22 
23 #include <kdebug.h>
24 #include <kdeversion.h>
25 #include <kguiitem.h>
26 #include <klocale.h>
27 #include <ksettings/dialog.h>
28 #include <kstandardaction.h>
29 #include <KStandardGuiItem>
30 #include <kwindowsystem.h>
31 #include <kcmultidialog.h>
32 #include <kicon.h>
33 
34 #include "kopetecontactlist.h"
35 #include "kopetegroup.h"
36 #include "kopeteuiglobal.h"
37 #include <kactioncollection.h>
38 
39 KSettings::Dialog *KopetePreferencesAction::s_settingsDialog = 0L;
40 
41 KopetePreferencesAction::KopetePreferencesAction( KActionCollection *parent, const char *name )
42 : KAction( KIcon(KStandardGuiItem::configure().iconName()), KStandardGuiItem::configure().text(), parent )
43 {
44  connect( this, SIGNAL(triggered(bool)), this, SLOT(slotShowPreferences()) );
45  parent->addAction( name, this );
46 }
47 
48 KopetePreferencesAction::~KopetePreferencesAction()
49 {
50 }
51 
52 void KopetePreferencesAction::slotShowPreferences()
53 {
54  // No need of static deleter since when the parent is deleted, the settings dialog is deleted (ereslibre)
55  if ( !s_settingsDialog )
56  {
57  s_settingsDialog = new KSettings::Dialog( Kopete::UI::Global::mainWidget() );
58  }
59 
60  s_settingsDialog->show();
61 
62  s_settingsDialog->raise();
63  KWindowSystem::activateWindow( s_settingsDialog->winId() );
64 }
65 
66 KAction * KopeteStdAction::preferences( KActionCollection *parent, const char *name )
67 {
68  return new KopetePreferencesAction( parent, name );
69 }
70 
71 KAction * KopeteStdAction::createAction(const QString &text, const KIcon &icon, const QObject *receiver, const char *slot, QObject* parent)
72 {
73  KAction *newAction = new KAction(icon, text, parent);
74  if(receiver && slot)
75  {
76  QObject::connect(newAction, SIGNAL(triggered(bool)), receiver, slot);
77  }
78  return newAction;
79 }
80 
81 KAction * KopeteStdAction::chat( const QObject *recvr, const char *slot, QObject* parent )
82 {
83  return createAction( i18n( "Start &Chat..." ), KIcon("mail-message-new"), recvr, slot, parent );
84 }
85 
86 KAction * KopeteStdAction::sendMessage( const QObject *recvr, const char *slot, QObject* parent )
87 {
88  return createAction( i18n( "&Send Single Message..." ), KIcon( "mail-message-new" ), recvr, slot, parent );
89 }
90 
91 KAction * KopeteStdAction::contactInfo( const QObject *recvr, const char *slot, QObject* parent )
92 {
93  return createAction( i18n( "User &Info" ), KIcon( "dialog-information" ), recvr, slot, parent );
94 }
95 
96 KAction * KopeteStdAction::sendFile( const QObject *recvr, const char *slot, QObject* parent )
97 {
98  return createAction( i18n( "Send &File..." ), KIcon( "mail-attachment" ), recvr, slot, parent );
99 }
100 
101 KAction * KopeteStdAction::viewHistory( const QObject *recvr, const char *slot, QObject* parent )
102 {
103  return createAction( i18n( "View &History..." ), KIcon( "view-history" ), recvr, slot, parent );
104 }
105 
106 KAction * KopeteStdAction::addGroup( const QObject *recvr, const char *slot, QObject* parent )
107 {
108  return createAction( i18n( "&Create Group..." ), KIcon( "folder-new" ), recvr, slot, parent );
109 }
110 
111 KAction * KopeteStdAction::toggleAlwaysVisible( const QObject *recvr, const char *slot, QObject* parent )
112 {
113  return createAction( i18n( "Visible when offline" ), KIcon(), recvr, slot, parent );
114 }
115 
116 KAction * KopeteStdAction::changeMetaContact( const QObject *recvr, const char *slot, QObject* parent )
117 {
118  return createAction( i18n( "Cha&nge Meta Contact..." ), KIcon( "transform-move" ), recvr, slot, parent );
119 }
120 
121 KAction * KopeteStdAction::deleteContact( const QObject *recvr, const char *slot, QObject* parent )
122 {
123  KAction *deleteAction = createAction( i18n( "&Delete Contact" ), KIcon( "list-remove-user" ), recvr, slot, parent );
124  deleteAction->setShortcut( KShortcut(Qt::Key_Delete) );
125 
126  return deleteAction;
127 }
128 
129 KAction * KopeteStdAction::changeAlias( const QObject *recvr, const char *slot, QObject* parent )
130 {
131  return createAction( i18n( "Change A&lias..." ), KIcon( "edit-rename" ), recvr, slot, parent );
132 }
133 
134 KAction * KopeteStdAction::blockContact( const QObject *recvr, const char *slot, QObject* parent )
135 {
136  return createAction( i18n( "&Block Contact" ), KIcon( "media-playback-pause" ), recvr, slot, parent );
137 }
138 
139 KAction * KopeteStdAction::unblockContact( const QObject *recvr, const char *slot, QObject* parent )
140 {
141  return createAction( i18n( "Un&block Contact" ), KIcon( "media-playback-start" ), recvr, slot, parent );
142 }
143 
144 #include "kopetestdaction.moc"
145 
146 // vim: set noet ts=4 sts=4 sw=4:
147 
KopeteStdAction::addGroup
static KAction * addGroup(const QObject *recvr, const char *slot, QObject *parent)
Standard action to add a group.
Definition: kopetestdaction.cpp:106
KopeteStdAction::changeMetaContact
static KAction * changeMetaContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to change a contacts Kopete::MetaContact.
Definition: kopetestdaction.cpp:116
KopetePreferencesAction::slotShowPreferences
void slotShowPreferences()
Definition: kopetestdaction.cpp:52
KopeteStdAction::viewHistory
static KAction * viewHistory(const QObject *recvr, const char *slot, QObject *parent)
Standard action to open a history dialog or something similar.
Definition: kopetestdaction.cpp:101
KopeteStdAction::unblockContact
static KAction * unblockContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to unblock a contact.
Definition: kopetestdaction.cpp:139
kopetegroup.h
kopeteuiglobal.h
KopeteStdAction::sendFile
static KAction * sendFile(const QObject *recvr, const char *slot, QObject *parent)
Standard action to initiate sending a file to a contact.
Definition: kopetestdaction.cpp:96
QObject
KopeteStdAction::toggleAlwaysVisible
static KAction * toggleAlwaysVisible(const QObject *recvr, const char *slot, QObject *parent)
Standard action to toggle is the contact is visible even when offline.
Definition: kopetestdaction.cpp:111
KopeteStdAction::sendMessage
static KAction * sendMessage(const QObject *recvr, const char *slot, QObject *parent)
Standard action to send a single message.
Definition: kopetestdaction.cpp:86
KopeteStdAction::blockContact
static KAction * blockContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to block a contact.
Definition: kopetestdaction.cpp:134
kopetecontactlist.h
KopetePreferencesAction::KopetePreferencesAction
KopetePreferencesAction(KActionCollection *parent, const char *name=0)
Definition: kopetestdaction.cpp:41
KopeteStdAction::contactInfo
static KAction * contactInfo(const QObject *recvr, const char *slot, QObject *parent)
Standard action to open a user info dialog.
Definition: kopetestdaction.cpp:91
KopetePreferencesAction::~KopetePreferencesAction
~KopetePreferencesAction()
Definition: kopetestdaction.cpp:48
QString
KopeteStdAction::chat
static KAction * chat(const QObject *recvr, const char *slot, QObject *parent)
Standard action to start a chat.
Definition: kopetestdaction.cpp:81
KopetePreferencesAction
Definition: kopetestdaction.h:105
Kopete::UI::Global::mainWidget
KOPETE_EXPORT QWidget * mainWidget()
Returns the main widget - this is the widget that message boxes and KNotify stuff should use as a par...
Definition: kopeteuiglobal.cpp:37
KAction
KopeteStdAction::changeAlias
static KAction * changeAlias(const QObject *recvr, const char *slot, QObject *parent)
Standard action to change a contact alias/nickname in your contact list.
Definition: kopetestdaction.cpp:129
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KopeteStdAction::preferences
static KAction * preferences(KActionCollection *parent, const char *name=0)
Return an action to change the Kopete preferences.
Definition: kopetestdaction.cpp:66
kopetestdaction.h
name
const char * name
Definition: kopeteonlinestatus.cpp:104
KopeteStdAction::deleteContact
static KAction * deleteContact(const QObject *recvr, const char *slot, QObject *parent)
Standard action to delete a contact.
Definition: kopetestdaction.cpp:121
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal