Falkon Develop
Cross-platform Qt-based web browser
PIM_handler.h
Go to the documentation of this file.
1/* ============================================================
2* Personal Information Manager plugin for Falkon
3* Copyright (C) 2012-2014 David Rosca <nowrep@gmail.com>
4* Copyright (C) 2012-2014 Mladen Pejaković <pejakm@autistici.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 3 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, see <http://www.gnu.org/licenses/>.
18* ============================================================ */
19#ifndef PIM_HANDLER_H
20#define PIM_HANDLER_H
21
22#include <QObject>
23#include <QMessageBox>
24#include <QMenu>
25#include <QPointer>
26#include <QHash>
27
28class WebView;
29class WebPage;
31
32class PIM_Settings;
33
34class PIM_Handler : public QObject
35{
36 Q_OBJECT
37public:
38 explicit PIM_Handler(const QString &sPath, QObject* parent = nullptr);
39
40 void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &hitTest);
41 bool keyPress(WebView* view, QKeyEvent* event);
42
43 void unloadPlugin();
44
45public Q_SLOTS:
46 void webPageCreated(WebPage* page);
47 void showSettings(QWidget* parent = nullptr);
48
49private Q_SLOTS:
50 void loadSettings();
51 void pimInsert();
52
53 void pageLoadFinished();
54
55private:
56 enum PI_Type {
57 PI_LastName = 0,
58 PI_FirstName = 1,
59 PI_Email = 2,
60 PI_Mobile = 3,
61 PI_Phone = 4,
62 PI_Address = 5,
63 PI_City = 6,
64 PI_Zip = 7,
65 PI_State = 8,
66 PI_Country = 9,
67 PI_HomePage = 10,
68 PI_Special1 = 11,
69 PI_Special2 = 12,
70 PI_Special3 = 13,
71 PI_Max = 14,
72 PI_Invalid = 128
73 };
74
75 QString matchingJsTable() const;
76
77 QHash<PI_Type, QString> m_allInfo;
78 QHash<PI_Type, QStringList> m_infoMatches;
79 QHash<PI_Type, QString> m_translations;
80
81 QPointer<PIM_Settings> m_settings;
82 QPointer<WebView> m_view;
83 QPoint m_clickedPos;
84
85 QString m_settingsFile;
86 bool m_loaded;
87};
88
89#endif // PIM_HANDLER_H
bool keyPress(WebView *view, QKeyEvent *event)
void webPageCreated(WebPage *page)
PIM_Handler(const QString &sPath, QObject *parent=nullptr)
Definition: PIM_handler.cpp:31
void showSettings(QWidget *parent=nullptr)
Definition: PIM_handler.cpp:89
void unloadPlugin()
void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &hitTest)