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

akregator

  • sources
  • kde-4.12
  • kdepim
  • akregator
  • src
actionmanagerimpl.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2005 Frank Osterfeld <osterfeld@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "actionmanagerimpl.h"
26 #include "akregatorconfig.h"
27 #include "akregator_part.h"
28 #include "articlelistview.h"
29 #include "articleviewer.h"
30 #include "feed.h"
31 #include "fetchqueue.h"
32 #include "folder.h"
33 #include "framemanager.h"
34 #include "kernel.h"
35 #include "mainwidget.h"
36 #include "speechclient.h"
37 #include "subscriptionlistview.h"
38 #include "tabwidget.h"
39 #include "trayicon.h"
40 #include "treenode.h"
41 #include "treenodevisitor.h"
42 
43 #include <kactionmenu.h>
44 #include <ktoolbarpopupaction.h>
45 #include <kaction.h>
46 #include <KToggleAction>
47 #include <kactioncollection.h>
48 #include <kdebug.h>
49 #include <klocale.h>
50 #include <kmenu.h>
51 #include <kshortcut.h>
52 #include <kstandardshortcut.h>
53 #include <kstandardaction.h>
54 #include <kxmlguifactory.h>
55 #include <kicon.h>
56 
57 #include <QApplication>
58 #include <QHash>
59 #include <QWidget>
60 
61 namespace Akregator
62 {
63 
64 class ActionManagerImpl::NodeSelectVisitor : public TreeNodeVisitor
65 {
66  public:
67  NodeSelectVisitor(ActionManagerImpl* manager) : m_manager(manager) {}
68 
69  virtual bool visitFeed(Feed* node)
70  {
71  QAction* remove = m_manager->action("feed_remove");
72  if (remove)
73  remove->setEnabled(true);
74  QAction* hp = m_manager->action("feed_homepage");
75  if (hp)
76  hp->setEnabled(!node->htmlUrl().isEmpty());
77  m_manager->action("feed_fetch")->setText(i18n("&Fetch Feed"));
78  m_manager->action("feed_remove")->setText(i18n("&Delete Feed"));
79  m_manager->action("feed_modify")->setText(i18n("&Edit Feed..."));
80  m_manager->action("feed_mark_all_as_read")->setText(i18n("&Mark Feed as Read"));
81 
82  return true;
83  }
84 
85  virtual bool visitFolder(Folder* node)
86  {
87  QAction* remove = m_manager->action("feed_remove");
88  if (remove)
89  remove->setEnabled(node->parent()); // root nodes must not be deleted
90  QAction* hp = m_manager->action("feed_homepage");
91  if (hp)
92  hp->setEnabled(false);
93 
94  m_manager->action("feed_fetch")->setText(i18n("&Fetch Feeds"));
95  m_manager->action("feed_remove")->setText(i18n("&Delete Folder"));
96  m_manager->action("feed_modify")->setText(i18n("&Rename Folder"));
97  m_manager->action("feed_mark_all_as_read")->setText(i18n("&Mark Feeds as Read"));
98 
99  return true;
100  }
101 
102  private:
103  ActionManagerImpl* m_manager;
104 };
105 
106 class ActionManagerImpl::ActionManagerImplPrivate
107 {
108 public:
109 
110  NodeSelectVisitor* nodeSelectVisitor;
111  ArticleListView* articleList;
112  SubscriptionListView* subscriptionListView;
113  MainWidget* mainWidget;
114  ArticleViewer* articleViewer;
115  Part* part;
116  TrayIcon* trayIcon;
117  KActionMenu* tagMenu;
118  KActionCollection* actionCollection;
119  TabWidget* tabWidget;
120  KAction* speakSelectedArticlesAction;
121  FrameManager* frameManager;
122 };
123 
124 
125 void ActionManagerImpl::slotNodeSelected(TreeNode* node)
126 {
127  if (node != 0)
128  d->nodeSelectVisitor->visit(node);
129 }
130 
131 ActionManagerImpl::ActionManagerImpl(Part* part, QObject* parent ) : ActionManager(parent), d(new ActionManagerImplPrivate)
132 {
133  d->nodeSelectVisitor = new NodeSelectVisitor(this);
134  d->part = part;
135  d->subscriptionListView = 0;
136  d->articleList = 0;
137  d->trayIcon = 0;
138  d->articleViewer = 0;
139  d->mainWidget = 0;
140  d->tabWidget = 0;
141  d->tagMenu = 0;
142  d->frameManager = 0;
143  d->speakSelectedArticlesAction = 0;
144  d->actionCollection = part->actionCollection();
145  initPart();
146 }
147 
148 ActionManagerImpl::~ActionManagerImpl()
149 {
150  delete d->nodeSelectVisitor;
151  delete d;
152  d = 0;
153 }
154 
155 void ActionManagerImpl::setTrayIcon(TrayIcon* trayIcon)
156 {
157  if (trayIcon == 0)
158  {
159  d->trayIcon = 0;
160  return;
161  }
162  if (d->trayIcon)
163  return;
164  else d->trayIcon = trayIcon;
165 
166  QMenu* traypop = trayIcon->contextMenu();
167 
168  if (actionCollection()->action("feed_fetch_all"))
169  traypop->addAction(actionCollection()->action("feed_fetch_all"));
170  if (actionCollection()->action("options_configure"))
171  traypop->addAction(actionCollection()->action("options_configure"));
172 }
173 
174 void ActionManagerImpl::initPart()
175 {
176  KAction *action = d->actionCollection->addAction("file_import");
177  action->setText(i18n("&Import Feeds..."));
178  action->setIcon(KIcon("document-import"));
179  connect(action, SIGNAL(triggered(bool)), d->part, SLOT(fileImport()));
180  action = d->actionCollection->addAction("file_export");
181  action->setText(i18n("&Export Feeds..." ));
182  action->setIcon(KIcon("document-export"));
183  connect(action, SIGNAL(triggered(bool)), d->part, SLOT(fileExport()));
184 
185  KAction *configure = d->actionCollection->addAction("options_configure");
186  configure->setText(i18n("&Configure Akregator..."));
187  configure->setIcon(KIcon("configure"));
188  connect(configure, SIGNAL(triggered()), d->part, SLOT(showOptions()));
189 
190  KStandardAction::configureNotifications(d->part, SLOT(showNotificationOptions()), d->actionCollection); // options_configure_notifications
191 
192  /*action = d->actionCollection->addAction("akregator_configure_akregator");
193  action->setIcon(KIcon("configure"));
194  action->setText(i18n("Configure &Akregator..."));
195  connect(action, SIGNAL(triggered(bool)), d->part, SLOT(showOptions()));*/
196 }
197 
198 void ActionManagerImpl::initMainWidget(MainWidget* mainWidget)
199 {
200  if (d->mainWidget)
201  return;
202 
203  d->mainWidget = mainWidget;
204 
205  KActionCollection* coll = actionCollection();
206 
207  // Feed/Feed Group popup menu
208  KAction* action = coll->addAction("feed_homepage");
209  action->setText(i18n("&Open Homepage"));
210  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenHomepage()));
211  action->setShortcuts(KShortcut( "Ctrl+H" ));
212 
213  action = coll->addAction("reload_all_tabs");
214  action->setIcon(KIcon("view-refresh"));
215  action->setText(i18n("Reload All Tabs"));
216  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotReloadAllTabs()));
217  action->setShortcuts(KShortcut( "Shift+F5" ));
218 
219 
220  action = coll->addAction("feed_add");
221  action->setIcon(KIcon("feed-subscribe"));
222  action->setText(i18n("&Add Feed..."));
223  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAdd()));
224  action->setShortcuts(KShortcut( "Insert" ));
225 
226  action = coll->addAction("feed_add_group");
227  action->setIcon(KIcon("folder-new"));
228  action->setText(i18n("Ne&w Folder..."));
229  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAddGroup()));
230  action->setShortcuts(KShortcut( "Shift+Insert" ));
231 
232  action = coll->addAction("feed_remove");
233  action->setIcon(KIcon("edit-delete"));
234  action->setText(i18n("&Delete Feed"));
235  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedRemove()));
236  action->setShortcuts(KShortcut( "Alt+Delete" ));
237 
238  action = coll->addAction("feed_modify");
239  action->setIcon(KIcon("document-properties"));
240  action->setText(i18n("&Edit Feed..."));
241  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedModify()));
242  action->setShortcuts(KShortcut( "F2" ));
243 
244  // toolbar / View
245  action = coll->addAction("normal_view");
246  action->setIcon(KIcon("view-split-top-bottom"));
247  action->setText(i18n("&Normal View"));
248  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotNormalView()));
249  action->setShortcuts(KShortcut( "Ctrl+Shift+1" ));
250 
251  action = coll->addAction("widescreen_view");
252  action->setIcon(KIcon("view-split-left-right"));
253  action->setText(i18n("&Widescreen View"));
254  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotWidescreenView()));
255  action->setShortcuts(KShortcut( "Ctrl+Shift+2" ));
256 
257  action = coll->addAction("combined_view");
258  action->setIcon(KIcon("view-list-text"));
259  action->setText(i18n("C&ombined View"));
260  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotCombinedView()));
261  action->setShortcuts(KShortcut( "Ctrl+Shift+3" ));
262 
263  // toolbar / feed menu
264  action = coll->addAction("feed_fetch");
265  action->setIcon(KIcon("go-down"));
266  action->setText(i18n("&Fetch Feed"));
267  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchCurrentFeed()));
268  action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Reload));
269 
270  action = coll->addAction("feed_fetch_all");
271  action->setIcon(KIcon("go-bottom"));
272  action->setText(i18n("Fe&tch All Feeds"));
273  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchAllFeeds()));
274  action->setShortcuts(KShortcut( "Ctrl+L" ));
275 
276  KAction *stopAction = coll->addAction("feed_stop");
277  stopAction->setIcon(KIcon("process-stop"));
278  stopAction->setText(i18n("C&ancel Feed Fetches"));
279  connect(stopAction, SIGNAL(triggered(bool)), Kernel::self()->fetchQueue(), SLOT(slotAbort()));
280  stopAction->setShortcut(QKeySequence(Qt::Key_Escape));
281  stopAction->setEnabled(false);
282 
283  action = coll->addAction("feed_mark_all_as_read");
284  action->setIcon(KIcon("mail-mark-read"));
285  action->setText(i18n("&Mark Feed as Read"));
286  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllRead()));
287  action->setShortcuts(KShortcut( "Ctrl+R" ));
288 
289  action = coll->addAction("feed_mark_all_feeds_as_read");
290  action->setIcon(KIcon("mail-mark-read"));
291  action->setText(i18n("Ma&rk All Feeds as Read"));
292  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllFeedsRead()));
293  action->setShortcuts(KShortcut( "Ctrl+Shift+R" ));
294 
295  // Settings menu
296  KToggleAction *sqf = coll->add<KToggleAction>("show_quick_filter");
297  sqf->setText(i18n("Show Quick Filter"));
298  connect(sqf, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotToggleShowQuickFilter()));
299  sqf->setChecked( Settings::showQuickFilter() );
300 
301  action = coll->addAction("article_open" );
302  action->setIcon(KIcon("tab-new"));
303  action->setText(i18n("Open in Tab"));
304  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenSelectedArticles()));
305  action->setShortcuts(KShortcut( "Shift+Return" ));
306 
307  action = coll->addAction("article_open_in_background" );
308  action->setIcon(KIcon("tab-new"));
309  action->setText(i18n("Open in Background Tab"));
310  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenSelectedArticlesInBackground()));
311  action->setShortcuts(KShortcut( "Return" ));
312 
313  action = coll->addAction("article_open_external" );
314  action->setIcon(KIcon("window-new"));
315  action->setText(i18n("Open in External Browser"));
316  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenSelectedArticlesInBrowser()));
317  action->setShortcuts(KShortcut( "Ctrl+Shift+Return" ));
318 
319  action = coll->addAction("article_copy_link_address" );
320  action->setText(i18n("Copy Link Address"));
321  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotCopyLinkAddress()));
322 
323  action = coll->addAction("go_prev_unread_article");
324  action->setIcon(KIcon("go-previous"));
325  action->setText(i18n("Pre&vious Unread Article"));
326  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotPrevUnreadArticle()));
327  action->setShortcut(QKeySequence(Qt::Key_Minus));
328 
329  action = coll->addAction("go_next_unread_article");
330  action->setIcon(KIcon("go-next"));
331  action->setText(i18n("Ne&xt Unread Article"));
332  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotNextUnreadArticle()));
333  action->setShortcuts(KShortcut(Qt::Key_Plus, Qt::Key_Equal));
334 
335  action = coll->addAction("article_delete");
336  action->setIcon(KIcon("edit-delete"));
337  action->setText(i18n("&Delete"));
338  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotArticleDelete()));
339  action->setShortcuts(KShortcut( "Delete" ));
340 
341  KActionMenu* statusMenu = coll->add<KActionMenu>("article_set_status");
342  statusMenu->setText(i18n("&Mark As"));
343  statusMenu->setEnabled( false );
344 
345  d->speakSelectedArticlesAction = coll->addAction("akr_texttospeech");
346  d->speakSelectedArticlesAction->setIcon(KIcon("media-playback-start"));
347  d->speakSelectedArticlesAction->setText(i18n("&Speak Selected Articles"));
348  connect(d->speakSelectedArticlesAction, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotTextToSpeechRequest()));
349 
350 
351  action = coll->addAction("akr_aborttexttospeech");
352  action->setText(i18n( "&Stop Speaking" ));
353  action->setIcon(KIcon("media-playback-stop"));
354  connect(action, SIGNAL(triggered(bool)),SpeechClient::self(), SLOT(slotAbortJobs()));
355  //action->setShortcuts(Qt::Key_Escape);
356  action->setEnabled(false);
357 
358  connect(SpeechClient::self(), SIGNAL(signalActivated(bool)), action, SLOT(setEnabled(bool)));
359 
360  action = coll->addAction("article_set_status_read");
361  action->setText(i18nc("as in: mark as read","&Read"));
362  action->setIcon(KIcon("mail-mark-read"));
363  action->setToolTip(i18n("Mark selected article as read"));
364  action->setShortcuts(KShortcut( "Ctrl+E" ));
365  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotSetSelectedArticleRead()));
366  statusMenu->addAction(action);
367 
368  action = coll->addAction("article_set_status_new");
369  action->setText(i18nc("as in: mark as new", "&New"));
370  action->setIcon(KIcon("mail-mark-unread-new"));
371  action->setShortcuts(KShortcut( "Ctrl+N" ));
372  action->setToolTip(i18n("Mark selected article as new"));
373  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotSetSelectedArticleNew()));
374  statusMenu->addAction(action);
375 
376 
377  action = coll->addAction("article_set_status_unread");
378  action->setText(i18nc("as in: mark as unread", "&Unread"));
379  action->setIcon(KIcon("mail-mark-unread"));
380  action->setToolTip(i18n("Mark selected article as unread"));
381  action->setShortcuts(KShortcut( "Ctrl+U" ));
382  connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotSetSelectedArticleUnread()));
383  statusMenu->addAction(action);
384 
385  KToggleAction* importantAction = coll->add<KToggleAction>("article_set_status_important");
386  importantAction->setText(i18n("&Mark as Important"));
387  importantAction->setIcon(KIcon("mail-mark-important"));
388  KShortcut importantSC( "Ctrl+I" );
389  importantSC.setAlternate( Qt::Key_I );
390  importantAction->setShortcuts( importantSC );
391  importantAction->setCheckedState(KGuiItem(i18n("Remove &Important Mark")));
392  connect(importantAction, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotArticleToggleKeepFlag(bool)));
393 
394  action = coll->addAction("feedstree_move_up");
395  action->setText(i18n("Move Node Up"));
396  connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeUp()));
397  action->setShortcuts(KShortcut( "Shift+Alt+Up" ));
398 
399  action = coll->addAction("feedstree_move_down");
400  action->setText(i18n("Move Node Down"));
401  connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeDown()));
402  action->setShortcuts(KShortcut( "Shift+Alt+Down" ));
403 
404  action = coll->addAction(i18n("Move Node Left"));
405  action->setText(i18n("Move Node Left"));
406  connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeLeft()));
407  action->setShortcuts(KShortcut( "Shift+Alt+Left" ));
408 
409  action = coll->addAction("feedstree_move_right");
410  action->setText(i18n("Move Node Right"));
411  connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeRight()));
412  action->setShortcuts(KShortcut( "Shift+Alt+Right" ));
413 
414  action = coll->addAction("file_sendlink");
415  action->setIcon(KIcon("mail-message-new"));
416  action->setText(i18n("Send &Link Address..."));
417  connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotSendLink()));
418 
419  action = coll->addAction("file_sendfile");
420  action->setIcon(KIcon("mail-message-new"));
421  action->setText(i18n("Send &File..."));
422  connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotSendFile()));
423 
424  setArticleActionsEnabled( false );
425 }
426 
427 void ActionManagerImpl::initArticleViewer(ArticleViewer* articleViewer)
428 {
429  if (d->articleViewer)
430  return;
431  else
432  d->articleViewer = articleViewer;
433 
434  KActionCollection* coll = actionCollection();
435  KAction* action = 0;
436 
437  action = KStandardAction::print(articleViewer, SLOT(slotPrint()), actionCollection());
438  coll->addAction("viewer_print", action);
439 
440  action = KStandardAction::copy(articleViewer, SLOT(slotCopy()), coll);
441  coll->addAction("viewer_copy", action);
442 
443  connect(d->tabWidget, SIGNAL(signalZoomInFrame(int)), d->articleViewer, SLOT(slotZoomIn(int)));
444  connect(d->tabWidget, SIGNAL(signalZoomOutFrame(int)), d->articleViewer, SLOT(slotZoomOut(int)));
445 }
446 
447 void ActionManagerImpl::initArticleListView(ArticleListView* articleList)
448 {
449  if (d->articleList)
450  return;
451  else
452  d->articleList = articleList;
453 
454  KAction *action = actionCollection()->addAction("go_previous_article");
455  action->setText(i18n("&Previous Article"));
456  connect(action, SIGNAL(triggered(bool)), articleList, SLOT(slotPreviousArticle()));
457  action->setShortcuts(KShortcut( "Left" ));
458  action = actionCollection()->addAction("go_next_article");
459  action->setText(i18n("&Next Article"));
460  connect(action, SIGNAL(triggered(bool)), articleList, SLOT(slotNextArticle()));
461  action->setShortcuts(KShortcut( "Right" ));
462 }
463 
464 void ActionManagerImpl::initSubscriptionListView(SubscriptionListView* subscriptionListView)
465 {
466  if (d->subscriptionListView)
467  return;
468  else
469  d->subscriptionListView = subscriptionListView;
470 
471  KActionCollection *coll = actionCollection();
472 
473  KAction *action = coll->addAction("go_prev_feed");
474  action->setText(i18n("&Previous Feed"));
475  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotPrevFeed()));
476  action->setShortcuts(KShortcut( "P" ));
477 
478  action = coll->addAction("go_next_feed");
479  action->setText(i18n("&Next Feed"));
480  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotNextFeed()));
481  action->setShortcuts(KShortcut( "N" ));
482 
483  action = coll->addAction("go_next_unread_feed");
484  action->setIcon(KIcon("go-down"));
485  action->setText(i18n("N&ext Unread Feed"));
486  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotNextUnreadFeed()));
487  action->setShortcut( QKeySequence(Qt::ALT+Qt::Key_Plus) );
488 
489  action = coll->addAction("go_prev_unread_feed");
490  action->setIcon(KIcon("go-up"));
491  action->setText(i18n("Prev&ious Unread Feed"));
492  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotPrevUnreadFeed()));
493  action->setShortcut( QKeySequence(Qt::ALT+Qt::Key_Minus) );
494 
495  action = coll->addAction("feedstree_home");
496  action->setText(i18n("Go to Top of Tree"));
497  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemBegin()));
498  action->setShortcuts(KShortcut( "Ctrl+Home" ));
499 
500  action = coll->addAction("feedstree_end");
501  action->setText(i18n("Go to Bottom of Tree"));
502  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemEnd()));
503  action->setShortcuts(KShortcut( "Ctrl+End" ));
504 
505  action = coll->addAction("feedstree_left");
506  action->setText(i18n("Go Left in Tree"));
507  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemLeft()));
508  action->setShortcuts(KShortcut( "Ctrl+Left" ));
509 
510  action = coll->addAction("feedstree_right");
511  action->setText(i18n("Go Right in Tree"));
512  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemRight()));
513  action->setShortcuts(KShortcut( "Ctrl+Right" ));
514 
515  action = coll->addAction("feedstree_up");
516  action->setText(i18n("Go Up in Tree"));
517  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemUp()));
518  action->setShortcuts(KShortcut( "Ctrl+Up" ));
519 
520  action = coll->addAction("feedstree_down" );
521  action->setText(i18n("Go Down in Tree"));
522  connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemDown()));
523  action->setShortcuts(KShortcut( "Ctrl+Down" ));
524 }
525 
526 void ActionManagerImpl::initTabWidget(TabWidget* tabWidget)
527 {
528  if (d->tabWidget)
529  return;
530  else
531  d->tabWidget = tabWidget;
532 
533  KActionCollection *coll = actionCollection();
534 
535  KAction *action = coll->addAction("select_next_tab");
536  action->setText(i18n("Select Next Tab"));
537  connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotNextTab()));
538  action->setShortcuts(KShortcut( "Ctrl+Period" ));
539 
540  action = coll->addAction("select_previous_tab");
541  action->setText(i18n("Select Previous Tab"));
542  connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotPreviousTab()));
543  action->setShortcuts(KShortcut( "Ctrl+Comma" ));
544 
545  action = coll->addAction("tab_detach");
546  action->setIcon(KIcon("tab-detach"));
547  action->setText(i18n("Detach Tab"));
548  connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotDetachTab()));
549  action->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_B));
550 
551  action = coll->addAction("tab_copylinkaddress");
552  action->setText(i18n("Copy Link Address"));
553  connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCopyLinkAddress()));
554 
555  action = coll->addAction("tab_remove");
556  action->setIcon(KIcon("tab-close"));
557  action->setText(i18n("Close Tab"));
558  connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCloseTab()));
559  action->setShortcuts(KStandardShortcut::close());
560 
561  action = coll->addAction("inc_font_sizes");
562  action->setIcon(KIcon("format-font-size-more"));
563  action->setText(i18n("Enlarge Font"));
564  connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomIn()));
565  action->setShortcut( QKeySequence::ZoomIn );
566 
567  action = coll->addAction("dec_font_sizes");
568  action->setIcon(KIcon("format-font-size-less"));
569  action->setText(i18n("Shrink Font"));
570  connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomOut()));
571  action->setShortcut( QKeySequence::ZoomOut );
572 
573  QString actionname;
574  for (int i=1;i<10;++i) {
575  actionname.sprintf("activate_tab_%02d", i);
576  action = new KAction( i18n("Activate Tab %1", i),this );
577  action->setShortcut( QKeySequence( QString::fromLatin1( "Alt+%1" ).arg( i ) ) );
578  coll->addAction( actionname, action );
579  connect( action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotActivateTab()) );
580  }
581 
582 
583 }
584 
585 void ActionManagerImpl::initFrameManager(FrameManager* frameManager)
586 {
587  if (d->frameManager)
588  return;
589 
590  d->frameManager = frameManager;
591 
592  bool isRTL = QApplication::isRightToLeft();
593 
594  KToolBarPopupAction* forward = new KToolBarPopupAction(KIcon(isRTL ? "go-previous" : "go-next"), i18nc("Go forward in browser history", "Forward"), this);
595  d->actionCollection->addAction("browser_forward", forward);
596  forward->setShortcuts(KShortcut(isRTL ? "Alt+Left" : "Alt+Right"));
597  connect(forward, SIGNAL(triggered()), frameManager, SLOT(slotBrowserForward()));
598 
599  connect(forward->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserForwardAboutToShow()));
600 
601  KToolBarPopupAction* back = new KToolBarPopupAction(KIcon(isRTL ? "go-next" : "go-previous"), i18nc("Go back in browser history", "Back"), this);
602  d->actionCollection->addAction("browser_back", back);
603  back->setShortcuts(KShortcut(isRTL ? "Alt+Right" : "Alt+Left"));
604  connect(back, SIGNAL(triggered()), frameManager, SLOT(slotBrowserBack()));
605 
606  connect(back->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserBackAboutToShow()));
607 
608  KAction *action = d->actionCollection->addAction("browser_reload");
609  action->setIcon(KIcon("view-refresh"));
610  action->setText(i18nc("Reload current page", "Reload"));
611  connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserReload()));
612 
613  action = d->actionCollection->addAction("browser_stop");
614  action->setIcon(KIcon("process-stop"));
615  action->setText(i18n("Stop"));
616  connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserStop()));
617 }
618 
619 QWidget* ActionManagerImpl::container(const char* name)
620 {
621  if ( d->part->factory() ) {
622  return d->part->factory()->container(name, d->part);
623  } else {
624  return 0;
625  }
626 }
627 
628 
629 KActionCollection* ActionManagerImpl::actionCollection()
630 {
631  return d->actionCollection;
632 }
633 
634 QAction* ActionManagerImpl::action(const char* name)
635 {
636  return d->actionCollection != 0 ? d->actionCollection->action(name) : 0;
637 }
638 
639 void ActionManagerImpl::setArticleActionsEnabled( bool enabled ) {
640 #undef setActionEnabled
641 #define setActionEnabled(name) { QAction* const a = action( name ); if ( a ) a->setEnabled( enabled ); }
642  setActionEnabled("article_open")
643  setActionEnabled("article_open_external")
644  setActionEnabled("article_set_status_important")
645  setActionEnabled("article_set_status")
646  setActionEnabled("article_delete")
647  setActionEnabled("file_sendlink")
648  setActionEnabled("file_sendfile")
649  setActionEnabled("article_open_in_background")
650 #undef setActionEnabled
651 }
652 
653 } // namespace Akregator
654 
655 #include "actionmanagerimpl.moc"
treenode.h
Akregator::ActionManagerImpl::~ActionManagerImpl
virtual ~ActionManagerImpl()
Definition: actionmanagerimpl.cpp:148
Akregator::ArticleViewer
Definition: articleviewer.h:55
Akregator::ActionManagerImpl::initTabWidget
void initTabWidget(TabWidget *tabWidget)
Definition: actionmanagerimpl.cpp:526
Akregator::ActionManagerImpl::actionCollection
KActionCollection * actionCollection()
Definition: actionmanagerimpl.cpp:629
Akregator::ActionManagerImpl::container
virtual QWidget * container(const char *name)
Definition: actionmanagerimpl.cpp:619
speechclient.h
Akregator::TrayIcon
Definition: trayicon.h:39
articlelistview.h
Akregator::MainWidget
This is the main widget of the view, containing tree view, article list, viewer etc.
Definition: mainwidget.h:68
articleviewer.h
kernel.h
QWidget
Akregator::ActionManagerImpl::initMainWidget
void initMainWidget(MainWidget *mainWidget)
Definition: actionmanagerimpl.cpp:198
Akregator::SpeechClient::self
static SpeechClient * self()
Definition: speechclient.cpp:53
Akregator::ActionManagerImpl::slotNodeSelected
void slotNodeSelected(Akregator::TreeNode *node)
Definition: actionmanagerimpl.cpp:125
Akregator::Part
This is a RSS Aggregator "Part".
Definition: akregator_part.h:76
Akregator::ActionManagerImpl::initFrameManager
void initFrameManager(FrameManager *frameManager)
Definition: actionmanagerimpl.cpp:585
QObject
Akregator::ActionManager
interface for accessing actions, popup menus etc.
Definition: actionmanager.h:44
feed.h
Akregator::ActionManagerImpl::setTrayIcon
void setTrayIcon(TrayIcon *trayIcon)
Definition: actionmanagerimpl.cpp:155
Akregator::SubscriptionListView
Definition: subscriptionlistview.h:39
treenodevisitor.h
Akregator::ArticleListView
Definition: articlelistview.h:90
tabwidget.h
Akregator::ActionManagerImpl::setArticleActionsEnabled
void setArticleActionsEnabled(bool enabled)
Definition: actionmanagerimpl.cpp:639
akregatorconfig.h
Akregator::ActionManagerImpl::action
virtual QAction * action(const char *name)
Definition: actionmanagerimpl.cpp:634
akregator_part.h
Akregator::Kernel::self
static Kernel * self()
Definition: kernel.cpp:40
Akregator::ActionManagerImpl::initArticleListView
void initArticleListView(ArticleListView *articleList)
Definition: actionmanagerimpl.cpp:447
subscriptionlistview.h
fetchqueue.h
Akregator::Settings::showQuickFilter
static bool showQuickFilter()
Get Show Quick Filter.
Definition: akregatorconfig.h:49
Akregator::TabWidget
Definition: tabwidget.h:38
trayicon.h
Akregator::FrameManager
Definition: framemanager.h:43
folder.h
mainwidget.h
actionmanagerimpl.h
Akregator::ActionManagerImpl::initArticleViewer
void initArticleViewer(ArticleViewer *articleViewer)
Definition: actionmanagerimpl.cpp:427
Akregator::ActionManagerImpl::NodeSelectVisitor
friend class NodeSelectVisitor
Definition: actionmanagerimpl.h:84
setActionEnabled
#define setActionEnabled(name)
framemanager.h
Akregator::TreeNode
Abstract base class for all kind of elements in the feed tree, like feeds and feed groups (and search...
Definition: treenode.h:59
Akregator::ActionManagerImpl::initSubscriptionListView
void initSubscriptionListView(SubscriptionListView *subscriptionListView)
Definition: actionmanagerimpl.cpp:464
QAction
Akregator::ActionManagerImpl::ActionManagerImpl
ActionManagerImpl(Part *part, QObject *parent=0)
Definition: actionmanagerimpl.cpp:131
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akregator

Skip menu "akregator"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

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