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

messageviewer

  • sources
  • kde-4.14
  • kdepim
  • messageviewer
  • widgets
openattachmentfolderwidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "openattachmentfolderwidget.h"
19 
20 #include <KLocalizedString>
21 
22 #include <KRun>
23 
24 #include <QTimer>
25 #include <QDebug>
26 #include <QAction>
27 
28 using namespace MessageViewer;
29 
30 OpenAttachmentFolderWidget::OpenAttachmentFolderWidget(QWidget *parent)
31  : KMessageWidget(parent)
32 {
33  mTimer = new QTimer(this);
34  mTimer->setSingleShot(true);
35  mTimer->setInterval(5000); // 5 seconds
36  connect(mTimer, SIGNAL(timeout()), this, SLOT(slotTimeOut()));
37  setVisible(false);
38  setCloseButtonVisible(true);
39  setMessageType(Positive);
40  setWordWrap(true);
41  QAction *action = this->findChild<QAction *>(); // should give us the close action...
42  if ( action ) {
43  connect( action, SIGNAL(triggered(bool)), SLOT(slotExplicitlyClosed()) );
44  }
45 
46  action = new QAction( i18n( "Open folder where attachment was saved" ), this );
47  connect( action, SIGNAL(triggered(bool)), SLOT(slotOpenAttachmentFolder()) );
48  addAction( action );
49 }
50 
51 OpenAttachmentFolderWidget::~OpenAttachmentFolderWidget()
52 {
53 
54 }
55 
56 void OpenAttachmentFolderWidget::slotExplicitlyClosed()
57 {
58  if (mTimer->isActive())
59  mTimer->stop();
60 }
61 
62 void OpenAttachmentFolderWidget::setFolder(const KUrl &url)
63 {
64  mUrl = url;
65 }
66 
67 void OpenAttachmentFolderWidget::slotOpenAttachmentFolder()
68 {
69  if (!mUrl.isEmpty()) {
70  new KRun( mUrl, this );
71  slotHideWarning();
72  }
73 }
74 
75 void OpenAttachmentFolderWidget::slotHideWarning()
76 {
77  if (mTimer->isActive())
78  mTimer->stop();
79  animatedHide();
80 }
81 
82 
83 void OpenAttachmentFolderWidget::slotShowWarning()
84 {
85  if (mTimer->isActive())
86  mTimer->stop();
87  mTimer->start();
88  animatedShow();
89 }
90 
91 void OpenAttachmentFolderWidget::slotTimeOut()
92 {
93  animatedHide();
94 }
QTimer::setInterval
void setInterval(int msec)
MessageViewer::OpenAttachmentFolderWidget::setFolder
void setFolder(const KUrl &url)
Definition: openattachmentfolderwidget.cpp:62
QWidget
MessageViewer::OpenAttachmentFolderWidget::slotHideWarning
void slotHideWarning()
Definition: openattachmentfolderwidget.cpp:75
MessageViewer::OpenAttachmentFolderWidget::OpenAttachmentFolderWidget
OpenAttachmentFolderWidget(QWidget *parent=0)
Definition: openattachmentfolderwidget.cpp:30
QTimer
openattachmentfolderwidget.h
QTimer::stop
void stop()
QAction
QTimer::start
void start(int msec)
KMessageWidget
QTimer::isActive
bool isActive() const
MessageViewer::OpenAttachmentFolderWidget::~OpenAttachmentFolderWidget
~OpenAttachmentFolderWidget()
Definition: openattachmentfolderwidget.cpp:51
MessageViewer::OpenAttachmentFolderWidget::slotShowWarning
void slotShowWarning()
Definition: openattachmentfolderwidget.cpp:83
QTimer::setSingleShot
void setSingleShot(bool singleShot)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:45 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

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
  • pimprint

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