source: terepaima/terepaima-0.4.16/sources/mainwindow.h @ 9840ac5

stretch
Last change on this file since 9840ac5 was 9840ac5, checked in by pbuitrago@…>, 6 years ago

se bloqueo el boton aceptar de la venta donde se muestra los certificado disponible para firmar, el boton se activa cuando el usuario selecciona el certificado

  • Property mode set to 100644
File size: 17.7 KB
Line 
1/*
2
3Copyright 2014 S. Razi Alavizadeh
4Copyright 2012-2015 Adam Reichold
5Copyright 2012 Michał Trybus
6Copyright 2012 Alexander Volkov
7
8This file is part of qpdfview.
9
10qpdfview is free software: you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation, either version 2 of the License, or
13(at your option) any later version.
14
15qpdfview is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
22
23*/
24
25#ifndef MAINWINDOW_H
26#define MAINWINDOW_H
27
28#include <QMainWindow>
29
30#include <QPointer>
31
32#ifdef WITH_DBUS
33
34#include <QDBusAbstractAdaptor>
35#include <QListWidget>
36#include <QStandardItemModel>
37
38//__________________________________
39#include <QHBoxLayout>
40#include <QVBoxLayout>
41#include <QLabel>
42#include <QLineEdit>
43#include <QPushButton>
44#include <QDialog>
45#include "cryptotoken.h"
46//__________________________________
47
48#endif // WITH_DBUS
49
50class QCheckBox;
51class QDateTime;
52class QGraphicsView;
53class QFileInfo;
54class QModelIndex;
55class QShortcut;
56class QTableView;
57class QTreeView;
58class QWidgetAction;
59
60#include "renderparam.h"
61
62namespace qpdfview
63{
64
65class Settings;
66class DocumentView;
67class TabWidget;
68class TreeView;
69class ComboBox;
70class MappingSpinBox;
71class SearchLineEdit;
72class SearchableMenu;
73class RecentlyUsedMenu;
74class RecentlyClosedMenu;
75class BookmarkModel;
76class Database;
77class ShortcutHandler;
78class HelpDialog;
79
80class MainWindow : public QMainWindow
81{
82    Q_OBJECT
83
84    friend class MainWindowAdaptor;
85
86public:
87    explicit MainWindow(QWidget* parent = 0);
88
89    QSize sizeHint() const;
90    QMenu* createPopupMenu();
91
92public slots:
93    void show();
94
95    bool open(const QString& filePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
96    bool openInNewTab(const QString& filePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
97
98    bool jumpToPageOrOpenInNewTab(const QString& filePath, int page = -1, bool refreshBeforeJump = false, const QRectF& highlight = QRectF(), bool quiet = false);
99
100    void startSearch(const QString& text);
101
102    //void on_gestionar_PIN();
103
104    //void closeDialog(QDialog *ventana);
105
106protected slots:
107
108    void on_tabWidget_currentChanged(int index);
109    void on_tabWidget_tabCloseRequested(int index);
110    void on_tabWidget_tabContextMenuRequested(const QPoint& globalPos, int index);
111
112    void on_currentTab_documentChanged();
113    void on_currentTab_documentModified();
114
115    void on_currentTab_numberOfPagesChaned(int numberOfPages);
116    void on_currentTab_currentPageChanged(int currentPage);
117
118    void on_currentTab_canJumpChanged(bool backward, bool forward);
119
120    void on_currentTab_continuousModeChanged(bool continuousMode);
121    void on_currentTab_layoutModeChanged(LayoutMode layoutMode);
122    void on_currentTab_rightToLeftModeChanged(bool rightToLeftMode);
123    void on_currentTab_scaleModeChanged(ScaleMode scaleMode);
124    void on_currentTab_scaleFactorChanged(qreal scaleFactor);
125    void on_currentTab_rotationChanged(Rotation rotation);
126
127    void on_currentTab_linkClicked(int page);
128    void on_currentTab_linkClicked(bool newTab, const QString& filePath, int page);
129
130    void on_currentTab_renderFlagsChanged(qpdfview::RenderFlags renderFlags);
131
132    void on_currentTab_invertColorsChanged(bool invertColors);
133    void on_currentTab_convertToGrayscaleChanged(bool convertToGrayscale);
134    void on_currentTab_trimMarginsChanged(bool trimMargins);
135
136    void on_currentTab_compositionModeChanged(CompositionMode compositionMode);
137
138    void on_currentTab_highlightAllChanged(bool highlightAll);
139    void on_currentTab_rubberBandModeChanged(RubberBandMode rubberBandMode);
140
141    void on_currentTab_searchFinished();
142    void on_currentTab_searchProgressChanged(int progress);
143
144    void on_currentTab_customContextMenuRequested(const QPoint& pos);
145
146    void on_currentPage_editingFinished();
147    void on_currentPage_returnPressed();
148
149    void on_scaleFactor_activated(int index);
150    void on_scaleFactor_editingFinished();
151    void on_scaleFactor_returnPressed();
152
153    void on_open_triggered();
154    void on_openInNewTab_triggered();
155    void on_openCopyInNewTab_triggered();
156    void on_openContainingFolder_triggered();
157    void on_refresh_triggered();
158    void on_saveCopy_triggered();
159    void on_saveAs_triggered();
160    void on_print_triggered();
161
162    void on_recentlyUsed_openTriggered(const QString& filePath);
163
164    void on_previousPage_triggered();
165    void on_nextPage_triggered();
166    void on_firstPage_triggered();
167    void on_lastPage_triggered();
168
169    void on_setFirstPage_triggered();
170
171    void on_jumpToPage_triggered();
172
173    void on_jumpBackward_triggered();
174    void on_jumpForward_triggered();
175
176    void on_search_triggered();
177    void on_findPrevious_triggered();
178    void on_findNext_triggered();
179    void on_cancelSearch_triggered();
180
181    void on_copyToClipboardMode_triggered(bool checked);
182    void on_addAnnotationMode_triggered(bool checked);
183
184    void on_settings_triggered();
185
186    void on_continuousMode_triggered(bool checked);
187    void on_twoPagesMode_triggered(bool checked);
188    void on_twoPagesWithCoverPageMode_triggered(bool checked);
189    void on_multiplePagesMode_triggered(bool checked);
190
191    void on_rightToLeftMode_triggered(bool checked);
192
193    void on_zoomIn_triggered();
194    void on_zoomOut_triggered();
195    void on_originalSize_triggered();
196
197    void on_fitToPageWidthMode_triggered(bool checked);
198    void on_fitToPageSizeMode_triggered(bool checked);
199
200    void on_rotateLeft_triggered();
201    void on_rotateRight_triggered();
202
203    void on_invertColors_triggered(bool checked);
204    void on_convertToGrayscale_triggered(bool checked);
205    void on_trimMargins_triggered(bool checked);
206    void on_darkenWithPaperColor_triggered(bool checked);
207    void on_lightenWithPaperColor_triggered(bool checked);
208
209    void on_fonts_triggered();
210
211    void on_fullscreen_triggered(bool checked);
212    void on_presentation_triggered();
213
214    void on_previousTab_triggered();
215    void on_nextTab_triggered();
216    void on_closeTab_triggered();
217    void on_closeAllTabs_triggered();
218    void on_closeAllTabsButCurrentTab_triggered();
219
220    void on_restoreMostRecentlyClosedTab_triggered();
221
222    void on_recentlyClosed_tabActionTriggered(QAction* tabAction);
223
224    void on_tabAction_triggered();
225    void on_tabShortcut_activated();
226
227    void on_previousBookmark_triggered();
228    void on_nextBookmark_triggered();
229    void on_addBookmark_triggered();
230    void on_removeBookmark_triggered();
231    void on_removeAllBookmarks_triggered();
232
233    void on_bookmarksMenu_aboutToShow();
234
235    void on_bookmark_openTriggered(const QString& absoluteFilePath);
236    void on_bookmark_openInNewTabTriggered(const QString& absoluteFilePath);
237    void on_bookmark_jumpToPageTriggered(const QString& absoluteFilePath, int page);
238    void on_bookmark_removeBookmarkTriggered(const QString& absoluteFilePath);
239
240    void on_contents_triggered();
241    void on_about_triggered();
242
243    void on_focusCurrentPage_activated();
244    void on_focusScaleFactor_activated();
245
246    void on_toggleToolBars_triggered(bool checked);
247    void on_toggleMenuBar_triggered(bool checked);
248
249    void on_searchInitiated(const QString& text, bool modified);
250    void on_highlightAll_clicked(bool checked);
251
252    void on_dock_dockLocationChanged(Qt::DockWidgetArea area);
253
254    void on_outline_sectionCountChanged();
255    void on_outline_clicked(const QModelIndex& index);
256
257    void on_properties_sectionCountChanged();
258    void on_detailsSignatureView_sectionCountChanged();
259
260    void on_thumbnails_dockLocationChanged(Qt::DockWidgetArea area);
261    void on_thumbnails_verticalScrollBar_valueChanged(int value);
262
263    void on_bookmarks_sectionCountChanged();
264    void on_bookmarks_clicked(const QModelIndex& index);
265    void on_bookmarks_contextMenuRequested(const QPoint& pos);
266
267    void on_search_sectionCountChanged();
268    void on_search_visibilityChanged(bool visible);
269    void on_search_clicked(const QModelIndex& index);
270
271    void on_saveDatabase_timeout();
272//_______________________________________________________________________________________________
273    void on_verify_signature();
274    void on_signature();
275    void on_windowCertificate();
276    void on_selectCertificate();
277    void on_activateButtonCertificate();
278
279    void on_managePIN();
280    void on_windowPIN(int x);
281    void on_currentChanged_selection();
282    void on_close_windowCertificate();
283    void on_close_windowPIN();
284    //QString verify_signature();
285    //QStringList verify_signature();
286    QStandardItemModel* verify_signature();
287    QStandardItemModel* view_table_verify_signature();
288    //QList<QStringList> certificateInformationListN;
289//_______________________________________________________________________________________________
290
291protected:
292    bool eventFilter(QObject* target, QEvent* event);
293
294    void closeEvent(QCloseEvent* event);
295
296    void dragEnterEvent(QDragEnterEvent* event);
297    void dropEvent(QDropEvent* event);
298
299private:
300    Q_DISABLE_COPY(MainWindow)
301
302    static Settings* s_settings;
303    static Database* s_database;
304    static ShortcutHandler* s_shortcutHandler;
305
306    void prepareStyle();
307
308    TabWidget* m_tabWidget;
309
310    DocumentView* currentTab() const;
311    DocumentView* tab(int index) const;
312    QList< DocumentView* > tabs() const;
313
314    bool senderIsCurrentTab() const;
315
316    int addTab(DocumentView* tab);
317    void closeTab(DocumentView* tab);
318
319    bool saveModifications(DocumentView* tab);
320
321    void disconnectCurrentTabChanged();
322    void reconnectCurrentTabChanged();
323
324    void setWindowTitleForCurrentTab();
325    void setCurrentPageSuffixForCurrentTab();
326
327    BookmarkModel* bookmarkModelForCurrentTab(bool create = false);
328
329    QAction* sourceLinkActionForCurrentTab(QObject* parent, const QPoint& pos);
330
331    class RestoreTab;
332
333    QTimer* m_saveDatabaseTimer;
334
335    void prepareDatabase();
336
337    void scheduleSaveDatabase();
338    void scheduleSaveTabs();
339    void scheduleSaveBookmarks();
340    void scheduleSavePerFileSettings();
341
342    class TextValueMapper;
343
344    MappingSpinBox* m_currentPageSpinBox;
345    QWidgetAction* m_currentPageAction;
346
347    ComboBox* m_scaleFactorComboBox;
348    QWidgetAction* m_scaleFactorAction;
349
350    SearchLineEdit* m_searchLineEdit;
351    QCheckBox* m_matchCaseCheckBox;
352    QCheckBox* m_wholeWordsCheckBox;
353    QCheckBox* m_highlightAllCheckBox;
354
355    void createWidgets();
356
357    QAction* m_openAction;
358    QAction* m_openInNewTabAction;
359    QAction* m_openCopyInNewTabAction;
360    QAction* m_openContainingFolderAction;
361    QAction* m_refreshAction;
362    QAction* m_saveCopyAction;
363    QAction* m_saveAsAction;
364    QAction* m_printAction;
365    QAction* m_exitAction;
366    QAction* m_verify_signature;
367
368    QAction* m_previousPageAction;
369    QAction* m_nextPageAction;
370    QAction* m_firstPageAction;
371    QAction* m_lastPageAction;
372
373    QAction* m_setFirstPageAction;
374
375    QAction* m_jumpToPageAction;
376
377    QAction* m_jumpBackwardAction;
378    QAction* m_jumpForwardAction;
379
380    QAction* m_searchAction;
381    QAction* m_findPreviousAction;
382    QAction* m_findNextAction;
383    QAction* m_cancelSearchAction;
384
385    QAction* m_copyToClipboardModeAction;
386    QAction* m_addAnnotationModeAction;
387
388    QAction* m_settingsAction;
389
390    QAction* m_continuousModeAction;
391    QAction* m_twoPagesModeAction;
392    QAction* m_twoPagesWithCoverPageModeAction;
393    QAction* m_multiplePagesModeAction;
394
395    QAction* m_rightToLeftModeAction;
396
397    QAction* m_zoomInAction;
398    QAction* m_zoomOutAction;
399    QAction* m_originalSizeAction;
400
401    QAction* m_fitToPageWidthModeAction;
402    QAction* m_fitToPageSizeModeAction;
403
404    QAction* m_rotateLeftAction;
405    QAction* m_rotateRightAction;
406
407    QAction* m_invertColorsAction;
408    QAction* m_convertToGrayscaleAction;
409    QAction* m_trimMarginsAction;
410    QAction* m_darkenWithPaperColorAction;
411    QAction* m_lightenWithPaperColorAction;
412
413    QAction* m_fontsAction;
414
415    QAction* m_fullscreenAction;
416    QAction* m_presentationAction;
417
418    QAction* m_previousTabAction;
419    QAction* m_nextTabAction;
420
421    QAction* m_closeTabAction;
422    QAction* m_closeAllTabsAction;
423    QAction* m_closeAllTabsButCurrentTabAction;
424
425    QAction* m_restoreMostRecentlyClosedTabAction;
426
427    QShortcut* m_tabShortcuts[9];
428
429    QAction* m_previousBookmarkAction;
430    QAction* m_nextBookmarkAction;
431
432    QAction* m_addBookmarkAction;
433    QAction* m_removeBookmarkAction;
434    QAction* m_removeAllBookmarksAction;
435
436    QAction* m_contentsAction;
437    QAction* m_aboutAction;
438
439    QAction* createAction(const QString& text, const QString& objectName, const QIcon& icon, const QList< QKeySequence >& shortcuts, const char* member, bool checkable = false, bool checked = false);
440    QAction* createAction(const QString& text, const QString& objectName, const QIcon& icon, const QKeySequence& shortcut, const char* member, bool checkable = false, bool checked = false);
441    QAction* createAction(const QString& text, const QString& objectName, const QString& iconName, const QList< QKeySequence >& shortcuts, const char* member, bool checkable = false, bool checked = false);
442    QAction* createAction(const QString& text, const QString& objectName, const QString& iconName, const QKeySequence& shortcut, const char* member, bool checkable = false, bool checked = false);
443
444    void createActions();
445
446    QToolBar* m_fileToolBar;
447    QToolBar* m_editToolBar;
448    QToolBar* m_viewToolBar;
449
450    QShortcut* m_focusCurrentPageShortcut;
451    QShortcut* m_focusScaleFactorShortcut;
452
453    QToolBar* createToolBar(const QString& text, const QString& objectName, const QStringList& actionNames, const QList< QAction* >& actions);
454
455    void createToolBars();
456
457    QDockWidget* m_outlineDock;
458    TreeView* m_outlineView;
459
460    QDockWidget* m_propertiesDock;
461    QDockWidget* m_detailsSignatureDock;
462    QTableView* m_propertiesView;
463    QTableView* m_detailsSignatureView;
464    //QListWidget* m_detailsSignatureView;
465    QTableView* m_tableVerifySign;
466
467    QDockWidget* m_thumbnailsDock;
468    QGraphicsView* m_thumbnailsView;
469
470    QDockWidget* m_bookmarksDock;
471    QTableView* m_bookmarksView;
472
473    QDockWidget* m_searchDock;
474    QTreeView* m_searchView;
475    QWidget* m_searchWidget;
476
477    QDockWidget* createDock(const QString& text, const QString& objectName, const QKeySequence& toggleViewShortcut);
478
479
480
481    void createSearchDock();
482
483    void createDocks();
484
485    QMenu* m_fileMenu;
486    RecentlyUsedMenu* m_recentlyUsedMenu;
487    QMenu* m_editMenu;
488    QMenu* m_viewMenu;
489    QMenu* m_compositionModeMenu;
490    SearchableMenu* m_tabsMenu;
491    RecentlyClosedMenu* m_recentlyClosedMenu;
492    SearchableMenu* m_bookmarksMenu;
493    QMenu* m_helpMenu;
494
495    //_______________________________________________________________________
496
497    QMenu* m_security;
498    QAction* m_signature;
499    QDialog* m_pin;
500    QHBoxLayout* m_layoutContrasenia;
501    QHBoxLayout* m_layoutBotones;
502    QVBoxLayout* m_layoutPrincipal;
503    QVBoxLayout* m_layoutmesage;
504    QLabel* m_mesage;
505    QLabel* m_etiquetaContrasenia;
506    QLineEdit* m_campoContrasenia;
507    QPushButton* m_botonAceptar;
508    QPushButton* m_botonCancelar;
509
510    QDialog* m_certificate;
511    QHBoxLayout* m_layoutmensaje;
512    QHBoxLayout* m_ClayoutBotones;
513    QHBoxLayout* m_layoutTableView;
514    QVBoxLayout* m_ClayoutPrincipal;
515
516    QLabel* m_mensaje;
517
518    QTableView* m_listCertificate;
519    QStandardItemModel* m_model;
520
521    QPushButton* m_CbotonAceptar;
522    QPushButton* m_CbotonCancelar;
523    CryptoToken* m_nct;
524    int certSelect; //indice del certificado seleccionado
525    QList<QStringList> certificateInformationListN;
526    QString close_windowCertificate;
527    QString close_PIN;
528
529    //_______________________________________________________________________
530    bool m_bookmarksMenuIsDirty;
531
532    void createMenus();
533
534    int m_tabBarHadPolicy;
535
536    bool m_fileToolBarWasVisible;
537    bool m_editToolBarWasVisible;
538    bool m_viewToolBarWasVisible;
539
540    QAction* m_toggleToolBarsAction;
541    QAction* m_toggleMenuBarAction;
542
543    QPointer< HelpDialog > m_helpDialog;
544
545};
546
547#ifdef WITH_DBUS
548
549class MainWindowAdaptor : public QDBusAbstractAdaptor
550{
551    Q_OBJECT
552    Q_CLASSINFO("D-Bus Interface", "local.qpdfview.MainWindow")
553
554public:
555    explicit MainWindowAdaptor(MainWindow* mainWindow);
556
557public slots:
558    Q_NOREPLY void raiseAndActivate();
559
560    bool open(const QString& absoluteFilePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
561    bool openInNewTab(const QString& absoluteFilePath, int page = -1, const QRectF& highlight = QRectF(), bool quiet = false);
562
563    bool jumpToPageOrOpenInNewTab(const QString& absoluteFilePath, int page = -1, bool refreshBeforeJump = false, const QRectF& highlight = QRectF(), bool quiet = false);
564
565    Q_NOREPLY void startSearch(const QString& text);
566
567
568    Q_NOREPLY void previousPage();
569    Q_NOREPLY void nextPage();
570    Q_NOREPLY void firstPage();
571    Q_NOREPLY void lastPage();
572
573    Q_NOREPLY void previousBookmark();
574    Q_NOREPLY void nextBookmark();
575
576    bool jumpToBookmark(const QString& label);
577
578
579    Q_NOREPLY void continuousModeAction(bool checked);
580    Q_NOREPLY void twoPagesModeAction(bool checked);
581    Q_NOREPLY void twoPagesWithCoverPageModeAction(bool checked);
582    Q_NOREPLY void multiplePagesModeAction(bool checked);
583
584    Q_NOREPLY void fitToPageWidthModeAction(bool checked);
585    Q_NOREPLY void fitToPageSizeModeAction(bool checked);
586
587    Q_NOREPLY void convertToGrayscaleAction(bool checked);
588    Q_NOREPLY void invertColorsAction(bool checked);
589
590    Q_NOREPLY void fullscreenAction(bool checked);
591    Q_NOREPLY void presentationAction();
592
593
594    Q_NOREPLY void closeTab();
595    Q_NOREPLY void closeAllTabs();
596    Q_NOREPLY void closeAllTabsButCurrentTab();
597
598    bool closeTab(const QString& absoluteFilePath);
599
600private:
601    MainWindow* mainWindow() const;
602
603};
604
605#endif // WITH_DBUS
606
607} // qpdfview
608
609#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.