mirror of
https://invent.kde.org/graphics/okular
synced 2024-11-05 18:34:53 +00:00
19d5dd8ec7
Source files are no longer separated by UI and non-UI and similar, but only by their build target. * ui/ -> part/ * Move all source files from conf/ to part/ * Keep config skeleton definitions in conf/, needed for the mobile target too * Move editdrawingtooldialogtest.h from conf/autotests/ to autotests/ * ui/data/icons/ -> icons/ * Move /part.cpp, /part.rc and similar files to part/ * Adapt include paths in source files * Adapt CMakeLists.txt files (in / and in subdirectories) * Adapt /Messages.sh
87 lines
2.4 KiB
C++
87 lines
2.4 KiB
C++
/***************************************************************************
|
|
* Copyright (C) 2006 by Tobias Koenig <tokoe@kde.org> *
|
|
* *
|
|
* 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. *
|
|
***************************************************************************/
|
|
|
|
#ifndef ANNOTATIONPOPUP_H
|
|
#define ANNOTATIONPOPUP_H
|
|
|
|
#include <QList>
|
|
#include <QObject>
|
|
#include <QPair>
|
|
#include <QPoint>
|
|
|
|
class QMenu;
|
|
|
|
namespace Okular
|
|
{
|
|
class Annotation;
|
|
class Document;
|
|
}
|
|
|
|
class AnnotationPopup : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
/**
|
|
* Describes the structure of the popup menu.
|
|
*/
|
|
enum MenuMode {
|
|
SingleAnnotationMode, ///< The menu shows only entries to manipulate a single annotation, or multiple annotations as a group.
|
|
MultiAnnotationMode ///< The menu shows entries to manipulate multiple annotations.
|
|
};
|
|
|
|
AnnotationPopup(Okular::Document *document, MenuMode mode, QWidget *parent = nullptr);
|
|
|
|
void addAnnotation(Okular::Annotation *annotation, int pageNumber);
|
|
|
|
/* You only need to use this if you don't plan on using exec() */
|
|
void addActionsToMenu(QMenu *menu);
|
|
|
|
void exec(const QPoint point = QPoint());
|
|
|
|
Q_SIGNALS:
|
|
void openAnnotationWindow(Okular::Annotation *annotation, int pageNumber);
|
|
|
|
public:
|
|
struct AnnotPagePair {
|
|
AnnotPagePair()
|
|
: annotation(nullptr)
|
|
, pageNumber(-1)
|
|
{
|
|
}
|
|
|
|
AnnotPagePair(Okular::Annotation *a, int pn)
|
|
: annotation(a)
|
|
, pageNumber(pn)
|
|
{
|
|
}
|
|
|
|
bool operator==(const AnnotPagePair pair) const
|
|
{
|
|
return annotation == pair.annotation && pageNumber == pair.pageNumber;
|
|
}
|
|
|
|
Okular::Annotation *annotation;
|
|
int pageNumber;
|
|
};
|
|
|
|
private:
|
|
void doRemovePageAnnotation(AnnotPagePair pair);
|
|
void doOpenAnnotationWindow(AnnotPagePair pair);
|
|
void doOpenPropertiesDialog(AnnotPagePair pair);
|
|
void doSaveEmbeddedFile(AnnotPagePair pair);
|
|
|
|
QWidget *mParent;
|
|
|
|
QList<AnnotPagePair> mAnnotations;
|
|
Okular::Document *mDocument;
|
|
MenuMode mMenuMode;
|
|
};
|
|
|
|
#endif
|