LauncherApplet::LauncherApplet(SessionAppletDef * appletDef, const QString & id, LauncherPlugin * plugin) : SessionApplet(appletDef, id), _plugin(plugin), _fileItem(0) { _button = new LauncherButton(); _button->popupMenu()->insertItem( i18n("&Preferences"), this, SLOT(slotShowPreferences())); _button->popupMenu()->insertItem( i18n("&Remove"), this, SLOT(slotRemove())); connect(_plugin, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged())); connect(_button, SIGNAL(clicked()), this, SLOT(slotButtonClicked())); _icon = _button; slotSettingsChanged(); }
LauncherApplet::LauncherApplet(SessionAppletDef * appletDef, const QString & id, LauncherPlugin * plugin) : SessionApplet(appletDef, id), _plugin(plugin), _fileItem(0) { _button = new LauncherButton(); addContextAction(new KAction(i18n("&Preferences"), KShortcut(), this, SLOT(slotShowPreferences()), this, "clockPreferences")); // The second last argument of KAction passes an owner applet which gives auto deletion // Removing Launcher applets is now handled generally though a slot on the host connect(_plugin, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged())); connect(_button, SIGNAL(clicked()), this, SLOT(slotButtonClicked())); setIcon(_button); slotSettingsChanged(); }
#include "kopetecontactlist.h" #include "kopetegroup.h" #include "kopeteuiglobal.h" KSettings::Dialog *KopetePreferencesAction::s_settingsDialog = 0L; KopetePreferencesAction::KopetePreferencesAction( KActionCollection *parent, const char *name ) #if KDE_IS_VERSION( 3, 3, 90 ) : KAction( KStdGuiItem::configure(), 0, 0, 0, parent, name ) #else : KAction( KGuiItem( i18n( "&Configure Kopete..." ), QString::fromLatin1( "configure" ) ), 0, 0, 0, parent, name ) #endif { connect( this, SIGNAL( activated() ), this, SLOT( slotShowPreferences() ) ); } KopetePreferencesAction::~KopetePreferencesAction() { } void KopetePreferencesAction::slotShowPreferences() { // FIXME: Use static deleter - Martijn if ( !s_settingsDialog ) s_settingsDialog = new KSettings::Dialog( KSettings::Dialog::Static, Kopete::UI::Global::mainWidget() ); s_settingsDialog->show(); s_settingsDialog->dialog()->raise();