2012-12-01 07:50:31 +01:00
|
|
|
/* ============================================================
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2012-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
|
|
|
|
* This file is part of QupZilla - WebKit based browser 2010-2014
|
2012-12-01 07:50:31 +01:00
|
|
|
* by David Rosca <nowrep@gmail.com>
|
|
|
|
*
|
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#ifndef REGISTERQAPPASSOCIATION_H
|
|
|
|
#define REGISTERQAPPASSOCIATION_H
|
|
|
|
|
2012-12-20 14:45:35 +01:00
|
|
|
#include <QObject>
|
2012-12-01 07:50:31 +01:00
|
|
|
#include <QHash>
|
|
|
|
#include <QPair>
|
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2012-12-01 07:50:31 +01:00
|
|
|
|
2014-02-19 22:12:32 +01:00
|
|
|
class QUPZILLA_EXPORT RegisterQAppAssociation : public QObject
|
2012-12-01 07:50:31 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit RegisterQAppAssociation(QObject* parent = 0);
|
|
|
|
explicit RegisterQAppAssociation(const QString &appRegisteredName, const QString &appPath,
|
2014-01-01 23:15:50 +01:00
|
|
|
const QString &appIcon = QString(), const QString &appDesc = QString(), QObject* parent = 0);
|
2012-12-01 07:50:31 +01:00
|
|
|
~RegisterQAppAssociation();
|
|
|
|
|
|
|
|
enum AssociationType {
|
|
|
|
FileAssociation,
|
|
|
|
UrlAssociation
|
|
|
|
};
|
|
|
|
|
|
|
|
void addCapability(const QString &assocName, const QString &progId,
|
|
|
|
const QString &desc, const QString &iconPath, AssociationType type);
|
|
|
|
void removeCapability(const QString &assocName);
|
|
|
|
|
|
|
|
void setAppInfo(const QString &appRegisteredName, const QString &appPath,
|
2014-01-01 23:15:50 +01:00
|
|
|
const QString &appIcon = QString(), const QString &appDesc = QString());
|
2012-12-01 07:50:31 +01:00
|
|
|
|
|
|
|
bool isPerMachineRegisteration();
|
|
|
|
void setPerMachineRegisteration(bool enable);
|
|
|
|
bool registerAppCapabilities();
|
|
|
|
bool isVistaOrNewer();
|
|
|
|
void registerAssociation(const QString &assocName, AssociationType type);
|
|
|
|
void createProgId(const QString &progId);
|
|
|
|
|
|
|
|
bool isDefaultApp(const QString &assocName, AssociationType type);
|
|
|
|
bool isDefaultForAllCapabilities();
|
|
|
|
void registerAllAssociation();
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString _appRegisteredName;
|
|
|
|
QString _appPath;
|
|
|
|
QString _appIcon;
|
|
|
|
QString _appDesc;
|
|
|
|
QString _UserRootKey;
|
|
|
|
|
|
|
|
QHash<QString, QString> _fileAssocHash; // (extention, progId)
|
|
|
|
QHash<QString, QString> _urlAssocHash; // (protocol, progId)
|
|
|
|
QHash<QString, QPair<QString, QString> > _assocDescHash; // (progId, (desc, icon))
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // REGISTERQAPPASSOCIATION_H
|