diff options
Diffstat (limited to 'src/panels/information')
| -rw-r--r-- | src/panels/information/informationpanel.cpp | 24 | ||||
| -rw-r--r-- | src/panels/information/informationpanel.h | 23 | ||||
| -rw-r--r-- | src/panels/information/informationpanelcontent.cpp | 55 | ||||
| -rw-r--r-- | src/panels/information/informationpanelcontent.h | 29 | ||||
| -rw-r--r-- | src/panels/information/phononwidget.cpp | 20 | ||||
| -rw-r--r-- | src/panels/information/phononwidget.h | 20 | ||||
| -rw-r--r-- | src/panels/information/pixmapviewer.cpp | 23 | ||||
| -rw-r--r-- | src/panels/information/pixmapviewer.h | 23 |
8 files changed, 75 insertions, 142 deletions
diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index 4f0e4e5eb..f843e7f46 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2006-2009 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2006-2009 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "informationpanel.h" @@ -418,6 +405,7 @@ void InformationPanel::init() m_content = new InformationPanelContent(this); connect(m_content, &InformationPanelContent::urlActivated, this, &InformationPanel::urlActivated); connect(m_content, &InformationPanelContent::configurationFinished, this, [this]() { m_inConfigurationMode = false; }); + connect(m_content, &InformationPanelContent::contextMenuRequested, this, &InformationPanel::showContextMenu); QVBoxLayout* layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); diff --git a/src/panels/information/informationpanel.h b/src/panels/information/informationpanel.h index 321827c5b..31a48332b 100644 --- a/src/panels/information/informationpanel.h +++ b/src/panels/information/informationpanel.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2006-2009 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2006-2009 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef INFORMATIONPANEL_H #define INFORMATIONPANEL_H diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 9db7f8bb7..ded88bd96 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2009 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "informationpanelcontent.h" @@ -46,11 +33,13 @@ #include <QTextLayout> #include <QTimer> #include <QVBoxLayout> +#include <QScroller> #include <QStyle> #include <QPainter> #include <QBitmap> #include <QLinearGradient> #include <QPolygon> +#include <QGesture> #include "dolphin_informationpanelsettings.h" #include "phononwidget.h" @@ -147,6 +136,7 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : m_metaDataArea->setFrameShape(QFrame::NoFrame); QWidget* viewport = m_metaDataArea->viewport(); + QScroller::grabGesture(viewport, QScroller::TouchGesture); viewport->installEventFilter(this); layout->addWidget(m_preview); @@ -157,6 +147,8 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : layout->addWidget(m_metaDataArea); layout->addWidget(m_configureButtons); + grabGesture(Qt::TapAndHoldGesture); + m_placesItemModel = new PlacesItemModel(this); } @@ -351,6 +343,33 @@ bool InformationPanelContent::eventFilter(QObject* obj, QEvent* event) return QWidget::eventFilter(obj, event); } +bool InformationPanelContent::event(QEvent* event) +{ + if (event->type() == QEvent::Gesture) { + gestureEvent(static_cast<QGestureEvent*>(event)); + return true; + } + return QWidget::event(event); +} + +bool InformationPanelContent::gestureEvent(QGestureEvent* event) +{ + if (!underMouse()) { + return false; + } + + QTapAndHoldGesture* tap = static_cast<QTapAndHoldGesture*>(event->gesture(Qt::TapAndHoldGesture)); + + if (tap) { + if (tap->state() == Qt::GestureFinished) { + emit contextMenuRequested(tap->position().toPoint()); + } + event->accept(); + return true; + } + return false; +} + void InformationPanelContent::showIcon(const KFileItem& item) { m_outdatedPreviewTimer->stop(); diff --git a/src/panels/information/informationpanelcontent.h b/src/panels/information/informationpanelcontent.h index 8daeb95b0..abdfdeb35 100644 --- a/src/panels/information/informationpanelcontent.h +++ b/src/panels/information/informationpanelcontent.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2009-2010 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2009-2010 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef INFORMATIONPANELCONTENT_H #define INFORMATIONPANELCONTENT_H @@ -36,6 +23,7 @@ class QDialogButtonBox; class QString; class QLabel; class QScrollArea; +class QGestureEvent; namespace KIO { class PreviewJob; @@ -91,6 +79,7 @@ public: signals: void urlActivated( const QUrl& url ); void configurationFinished(); + void contextMenuRequested(const QPoint& pos); public slots: /** @@ -103,6 +92,8 @@ protected: /** @see QObject::eventFilter() */ bool eventFilter(QObject* obj, QEvent* event) override; + bool event(QEvent * event) override; + private slots: /** * Is invoked if no preview is available for the item. In this @@ -144,6 +135,8 @@ private: */ void refreshPixmapView(); + bool gestureEvent(QGestureEvent* event); + private: KFileItem m_item; diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index f815b4bd0..fa4b9e226 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -1,21 +1,7 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz <[email protected]> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. +/* + SPDX-FileCopyrightText: 2007 Matthias Kretz <[email protected]> + SPDX-License-Identifier: GPL-2.0-or-later */ #include "phononwidget.h" diff --git a/src/panels/information/phononwidget.h b/src/panels/information/phononwidget.h index 961443d2e..b21b0cdc7 100644 --- a/src/panels/information/phononwidget.h +++ b/src/panels/information/phononwidget.h @@ -1,21 +1,7 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz <[email protected]> - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. +/* + SPDX-FileCopyrightText: 2007 Matthias Kretz <[email protected]> + SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef PHONONWIDGET_H diff --git a/src/panels/information/pixmapviewer.cpp b/src/panels/information/pixmapviewer.cpp index 39fedb1a1..ddf264982 100644 --- a/src/panels/information/pixmapviewer.cpp +++ b/src/panels/information/pixmapviewer.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2006 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "pixmapviewer.h" diff --git a/src/panels/information/pixmapviewer.h b/src/panels/information/pixmapviewer.h index c231b590d..6e0fa3e67 100644 --- a/src/panels/information/pixmapviewer.h +++ b/src/panels/information/pixmapviewer.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2006 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2006 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef PIXMAPVIEWER_H #define PIXMAPVIEWER_H |
