1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Windows7 JumpList now also shows list of 6 most visited pages, added

variety of icons sizes, updated windows installer
This commit is contained in:
nowrep 2011-05-06 20:05:49 +02:00
parent 5fd9433d9c
commit 36dc77bea6
25 changed files with 494 additions and 445 deletions

View File

@ -30,6 +30,8 @@
#include <QWidget> #include <QWidget>
#include <QList> #include <QList>
#include <QPointer> #include <QPointer>
#include "historymodel.h"
#include "mainapplication.h"
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
#include <qt_windows.h> #include <qt_windows.h>
@ -132,7 +134,6 @@ bool QtWin::enableBlurBehindWindow(QWidget *widget, bool enable)
*/ */
bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom) bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom)
{ {
Q_ASSERT(widget); Q_ASSERT(widget);
Q_UNUSED(left); Q_UNUSED(left);
Q_UNUSED(top); Q_UNUSED(top);
@ -159,10 +160,9 @@ bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int ri
* *
* \a enable tells if the blur should be enabled or not * \a enable tells if the blur should be enabled or not
*/ */
QColor QtWin::colorizatinColor() QColor QtWin::colorizationColor()
{ {
QColor resultColor = QApplication::palette().window().color(); QColor resultColor = QApplication::palette().window().color();
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
DWORD color = 0; DWORD color = 0;
BOOL opaque = FALSE; BOOL opaque = FALSE;
@ -174,7 +174,7 @@ QColor QtWin::colorizatinColor()
return resultColor; return resultColor;
} }
#ifdef Q_WS_WIN #ifdef W7API
WindowNotifier *QtWin::windowNotifier() WindowNotifier *QtWin::windowNotifier()
{ {
static WindowNotifier *windowNotifierInstance = 0; static WindowNotifier *windowNotifierInstance = 0;
@ -251,6 +251,15 @@ IShellLink* QtWin::CreateShellLink(const QString &title, const QString &descript
return shell_link; return shell_link;
} }
void QtWin::populateFrequentSites(IObjectCollection* collection, const QString &appPath)
{
HistoryModel* historyModel = mApp->history();
QList<HistoryModel::HistoryEntry> mostList = historyModel->mostVisited(6);
foreach (HistoryModel::HistoryEntry entry, mostList)
collection->AddObject(CreateShellLink(entry.title, entry.url.toString(), appPath, " "+entry.url.toEncoded(), appPath, 1));
collection->AddObject(CreateShellLink("", "", "", "", "", 0)); //Spacer
}
void QtWin::AddTasksToList(ICustomDestinationList* destinationList) { void QtWin::AddTasksToList(ICustomDestinationList* destinationList) {
IObjectArray* object_array; IObjectArray* object_array;
@ -264,6 +273,8 @@ void QtWin::AddTasksToList(ICustomDestinationList* destinationList) {
QString icons_source = qApp->applicationFilePath(); QString icons_source = qApp->applicationFilePath();
QString app_path = qApp->applicationFilePath(); QString app_path = qApp->applicationFilePath();
populateFrequentSites(obj_collection, icons_source);
obj_collection->AddObject(CreateShellLink(tr("Open new tab"), tr("Opens a new tab if browser is running"), obj_collection->AddObject(CreateShellLink(tr("Open new tab"), tr("Opens a new tab if browser is running"),
app_path, "--new-tab", app_path, "--new-tab",
icons_source, 0)); icons_source, 0));
@ -284,7 +295,7 @@ void QtWin::AddTasksToList(ICustomDestinationList* destinationList) {
#endif #endif
void QtWin::setupJumpList() { void QtWin::setupJumpList() {
#ifdef Q_WS_WIN #ifdef W7API
if (!isRunningWindows7()) if (!isRunningWindows7())
return; return;

View File

@ -56,13 +56,15 @@ public:
int left = -1, int top = -1, int left = -1, int top = -1,
int right = -1, int bottom = -1); int right = -1, int bottom = -1);
static bool isCompositionEnabled(); static bool isCompositionEnabled();
static QColor colorizatinColor(); static QColor colorizationColor();
public slots:
static void setupJumpList(); static void setupJumpList();
private: private:
static WindowNotifier *windowNotifier(); static WindowNotifier *windowNotifier();
#ifdef Q_WS_WIN #ifdef W7API
static void populateFrequentSites(IObjectCollection* collection, const QString &appPath);
static void AddTasksToList(ICustomDestinationList* destinationList); static void AddTasksToList(ICustomDestinationList* destinationList);
static IShellLink* CreateShellLink(const QString &title, const QString &description, const QString &app_path, const QString &app_args, const QString &icon_path, int app_index); static IShellLink* CreateShellLink(const QString &title, const QString &description, const QString &app_path, const QString &app_args, const QString &icon_path, int app_index);
#endif #endif

View File

@ -157,8 +157,7 @@ MainApplication::MainApplication(int &argc, char **argv)
loadSettings(); loadSettings();
QTimer::singleShot(2000, this, SLOT(restoreCursor())); QTimer::singleShot(2000, this, SLOT(restoreCursor()));
QTimer::singleShot(10*1000, this, SLOT(setupJumpList()));
QtWin::setupJumpList();
} }
void MainApplication::loadSettings() void MainApplication::loadSettings()
@ -216,6 +215,11 @@ void MainApplication::loadSettings()
setWheelScrollLines(scrollingLines); setWheelScrollLines(scrollingLines);
} }
void MainApplication::setupJumpList()
{
QtWin::setupJumpList();
}
QupZilla* MainApplication::getWindow() QupZilla* MainApplication::getWindow()
{ {
for(int i=0; i<m_mainWindows.count(); i++) { for(int i=0; i<m_mainWindows.count(); i++) {

View File

@ -103,6 +103,7 @@ signals:
void message(MainApplication::MessageType mes, bool state); void message(MainApplication::MessageType mes, bool state);
private slots: private slots:
void setupJumpList();
void restoreCursor() { QApplication::restoreOverrideCursor(); } void restoreCursor() { QApplication::restoreOverrideCursor(); }
private: private:

View File

@ -19,7 +19,7 @@
#define QUPZILLA_H #define QUPZILLA_H
//Comment for release building //Comment for release building
#define DEVELOPING //#define DEVELOPING
#ifdef QT_NO_DEBUG #ifdef QT_NO_DEBUG
#ifdef DEVELOPING #ifdef DEVELOPING

View File

@ -1,6 +1,7 @@
#include "winver.h" #include "winver.h"
IDI_ICON1 ICON DISCARDABLE "icon.ico" IDI_ICON1 ICON DISCARDABLE "data\icons\exeicons\qupzilla.ico"
IDI_ICON2 ICON DISCARDABLE "data\icons\exeicons\page.ico"
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0 FILEVERSION 1,0,0,0

View File

@ -19,11 +19,13 @@
#include "qupzilla.h" #include "qupzilla.h"
#include "bookmarksmodel.h" #include "bookmarksmodel.h"
#include "iconprovider.h" #include "iconprovider.h"
#include "historymodel.h"
BookmarksToolbar::BookmarksToolbar(QupZilla* mainClass, QWidget* parent) : BookmarksToolbar::BookmarksToolbar(QupZilla* mainClass, QWidget* parent) :
QToolBar(parent) QToolBar(parent)
,p_QupZilla(mainClass) ,p_QupZilla(mainClass)
,m_bookmarksModel(0) ,m_bookmarksModel(mApp->bookmarksModel())
,m_historyModel(mApp->history())
{ {
setObjectName("bookmarksToolbar"); setObjectName("bookmarksToolbar");
setWindowTitle(tr("Bookmarks")); setWindowTitle(tr("Bookmarks"));
@ -31,8 +33,6 @@ BookmarksToolbar::BookmarksToolbar(QupZilla* mainClass, QWidget* parent) :
setMovable(false); setMovable(false);
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
m_bookmarksModel = mApp->bookmarksModel();
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint))); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark))); connect(m_bookmarksModel, SIGNAL(bookmarkAdded(BookmarksModel::Bookmark)), this, SLOT(addBookmark(BookmarksModel::Bookmark)));
@ -211,15 +211,24 @@ void BookmarksToolbar::refreshMostVisited()
{ {
m_menuMostVisited->clear(); m_menuMostVisited->clear();
QSqlQuery query; QList<HistoryModel::HistoryEntry> mostList = m_historyModel->mostVisited(10);
query.exec("SELECT title, url FROM history ORDER BY count DESC LIMIT 10"); foreach (HistoryModel::HistoryEntry entry, mostList) {
while(query.next()) { if (entry.title.length()>40) {
QUrl url = query.value(1).toUrl(); entry.title.truncate(40);
QString title = query.value(0).toString(); entry.title+="..";
if (title.length()>40) {
title.truncate(40);
title+="..";
} }
m_menuMostVisited->addAction(_iconForUrl(url), title, p_QupZilla, SLOT(loadActionUrl()))->setData(url); m_menuMostVisited->addAction(_iconForUrl(entry.url), entry.title, p_QupZilla, SLOT(loadActionUrl()))->setData(entry.url);
} }
// QSqlQuery query;
// query.exec("SELECT title, url FROM history ORDER BY count DESC LIMIT 10");
// while(query.next()) {
// QUrl url = query.value(1).toUrl();
// QString title = query.value(0).toString();
// if (title.length()>40) {
// title.truncate(40);
// title+="..";
// }
// m_menuMostVisited->addAction(_iconForUrl(url), title, p_QupZilla, SLOT(loadActionUrl()))->setData(url);
// }
} }

View File

@ -26,6 +26,7 @@
class QupZilla; class QupZilla;
class BookmarksModel; class BookmarksModel;
class HistoryModel;
class BookmarksToolbar : public QToolBar class BookmarksToolbar : public QToolBar
{ {
Q_OBJECT Q_OBJECT
@ -50,6 +51,7 @@ private slots:
private: private:
QupZilla* p_QupZilla; QupZilla* p_QupZilla;
BookmarksModel* m_bookmarksModel; BookmarksModel* m_bookmarksModel;
HistoryModel* m_historyModel;
QMenu* m_menuMostVisited; QMenu* m_menuMostVisited;
QToolButton* m_mostVis; QToolButton* m_mostVis;

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -121,6 +121,23 @@ bool HistoryModel::deleteHistoryEntry(const QString &url, const QString &title)
return false; return false;
} }
QList<HistoryModel::HistoryEntry> HistoryModel::mostVisited(int count)
{
QList<HistoryEntry> list;
QSqlQuery query;
query.exec(QString("SELECT count, date, id, title, url FROM history ORDER BY count DESC LIMIT %1").arg(count));
while(query.next()) {
HistoryEntry entry;
entry.count = query.value(0).toInt();
entry.date = query.value(1).toDateTime();
entry.id = query.value(2).toInt();
entry.title = query.value(3).toString();
entry.url = query.value(4).toUrl();
list.append(entry);
}
return list;
}
bool HistoryModel::optimizeHistory() bool HistoryModel::optimizeHistory()
{ {
QSqlQuery query; QSqlQuery query;

View File

@ -45,6 +45,8 @@ public:
bool deleteHistoryEntry(int index); bool deleteHistoryEntry(int index);
bool deleteHistoryEntry(const QString &url, const QString &title); bool deleteHistoryEntry(const QString &url, const QString &title);
QList<HistoryModel::HistoryEntry> mostVisited(int count);
bool clearHistory(); bool clearHistory();
bool optimizeHistory(); bool optimizeHistory();
bool isSaving(); bool isSaving();

View File

@ -638,12 +638,12 @@ p, li { white-space: pre-wrap; }
<context> <context>
<name>ClickToFlash</name> <name>ClickToFlash</name>
<message> <message>
<location filename="../src/plugins/clicktoflash.cpp" line="97"/> <location filename="../src/plugins/clicktoflash.cpp" line="95"/>
<source>Flash blocked by ClickToFlash</source> <source>Flash blocked by ClickToFlash</source>
<translation>Zablokováno pluginem ClickToFlash</translation> <translation>Zablokováno pluginem ClickToFlash</translation>
</message> </message>
<message> <message>
<location filename="../src/plugins/clicktoflash.cpp" line="99"/> <location filename="../src/plugins/clicktoflash.cpp" line="97"/>
<source>Add %1 to whitelist</source> <source>Add %1 to whitelist</source>
<translation>Přidat %1 na bílou listinu</translation> <translation>Přidat %1 na bílou listinu</translation>
</message> </message>
@ -2023,32 +2023,32 @@ nebyl nalezen!</translation>
<context> <context>
<name>QtWin</name> <name>QtWin</name>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="323"/> <location filename="../src/3rdparty/qtwin.cpp" line="267"/>
<source>Open new tab</source> <source>Open new tab</source>
<translation>Otevřít nový panel</translation> <translation>Otevřít nový panel</translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="323"/> <location filename="../src/3rdparty/qtwin.cpp" line="267"/>
<source>Opens a new tab if browser is running</source> <source>Opens a new tab if browser is running</source>
<translation>Otevře nový panel pokud je prohlížeč spuštěný</translation> <translation>Otevře nový panel pokud je prohlížeč spuštěný</translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="327"/> <location filename="../src/3rdparty/qtwin.cpp" line="271"/>
<source>Open new window</source> <source>Open new window</source>
<translation>Otevřít nové okno</translation> <translation>Otevřít nové okno</translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="327"/> <location filename="../src/3rdparty/qtwin.cpp" line="271"/>
<source>Opens a new window if browser is running</source> <source>Opens a new window if browser is running</source>
<translation>Otevře nové okno pokud je prohlížeč spuštěný</translation> <translation>Otevře nové okno pokud je prohlížeč spuštěný</translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="331"/> <location filename="../src/3rdparty/qtwin.cpp" line="275"/>
<source>Open download manager</source> <source>Open download manager</source>
<translation>Otevřít správce stahování</translation> <translation>Otevřít správce stahování</translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="331"/> <location filename="../src/3rdparty/qtwin.cpp" line="275"/>
<source>Opens a download manager if browser is running</source> <source>Opens a download manager if browser is running</source>
<translation>Otevře správce stahování pokud je prohlížeč spuštěný</translation> <translation>Otevře správce stahování pokud je prohlížeč spuštěný</translation>
</message> </message>

View File

@ -642,12 +642,12 @@ p, li { white-space: pre-wrap; }
<context> <context>
<name>ClickToFlash</name> <name>ClickToFlash</name>
<message> <message>
<location filename="../src/plugins/clicktoflash.cpp" line="97"/> <location filename="../src/plugins/clicktoflash.cpp" line="95"/>
<source>Flash blocked by ClickToFlash</source> <source>Flash blocked by ClickToFlash</source>
<translation>Zablokované pluginom ClickToFlash</translation> <translation>Zablokované pluginom ClickToFlash</translation>
</message> </message>
<message> <message>
<location filename="../src/plugins/clicktoflash.cpp" line="99"/> <location filename="../src/plugins/clicktoflash.cpp" line="97"/>
<source>Add %1 to whitelist</source> <source>Add %1 to whitelist</source>
<translation>Pridať %1 na bielu listinu</translation> <translation>Pridať %1 na bielu listinu</translation>
</message> </message>
@ -2025,32 +2025,32 @@ p, li { white-space: pre-wrap; }
<context> <context>
<name>QtWin</name> <name>QtWin</name>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="323"/> <location filename="../src/3rdparty/qtwin.cpp" line="267"/>
<source>Open new tab</source> <source>Open new tab</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="323"/> <location filename="../src/3rdparty/qtwin.cpp" line="267"/>
<source>Opens a new tab if browser is running</source> <source>Opens a new tab if browser is running</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="327"/> <location filename="../src/3rdparty/qtwin.cpp" line="271"/>
<source>Open new window</source> <source>Open new window</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="327"/> <location filename="../src/3rdparty/qtwin.cpp" line="271"/>
<source>Opens a new window if browser is running</source> <source>Opens a new window if browser is running</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="331"/> <location filename="../src/3rdparty/qtwin.cpp" line="275"/>
<source>Open download manager</source> <source>Open download manager</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/3rdparty/qtwin.cpp" line="331"/> <location filename="../src/3rdparty/qtwin.cpp" line="275"/>
<source>Opens a download manager if browser is running</source> <source>Opens a download manager if browser is running</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -1,190 +1,190 @@
/* /*
_____________________________________________________________________________ _____________________________________________________________________________
File Association File Association
_____________________________________________________________________________ _____________________________________________________________________________
Based on code taken from http://nsis.sourceforge.net/File_Association Based on code taken from http://nsis.sourceforge.net/File_Association
Usage in script: Usage in script:
1. !include "FileAssociation.nsh" 1. !include "FileAssociation.nsh"
2. [Section|Function] 2. [Section|Function]
${FileAssociationFunction} "Param1" "Param2" "..." $var ${FileAssociationFunction} "Param1" "Param2" "..." $var
[SectionEnd|FunctionEnd] [SectionEnd|FunctionEnd]
FileAssociationFunction=[RegisterExtension|UnRegisterExtension] FileAssociationFunction=[RegisterExtension|UnRegisterExtension]
_____________________________________________________________________________ _____________________________________________________________________________
${RegisterExtension} "[executable]" "[extension]" "[description]" ${RegisterExtension} "[executable]" "[extension]" "[description]"
"[executable]" ; executable which opens the file format "[executable]" ; executable which opens the file format
; ;
"[extension]" ; extension, which represents the file format to open "[extension]" ; extension, which represents the file format to open
; ;
"[description]" ; description for the extension. This will be display in Windows Explorer. "[description]" ; description for the extension. This will be display in Windows Explorer.
; ;
${UnRegisterExtension} "[extension]" "[description]" ${UnRegisterExtension} "[extension]" "[description]"
"[extension]" ; extension, which represents the file format to open "[extension]" ; extension, which represents the file format to open
; ;
"[description]" ; description for the extension. This will be display in Windows Explorer. "[description]" ; description for the extension. This will be display in Windows Explorer.
; ;
_____________________________________________________________________________ _____________________________________________________________________________
Macros Macros
_____________________________________________________________________________ _____________________________________________________________________________
Change log window verbosity (default: 3=no script) Change log window verbosity (default: 3=no script)
Example: Example:
!include "FileAssociation.nsh" !include "FileAssociation.nsh"
!insertmacro RegisterExtension !insertmacro RegisterExtension
${FileAssociation_VERBOSE} 4 # all verbosity ${FileAssociation_VERBOSE} 4 # all verbosity
!insertmacro UnRegisterExtension !insertmacro UnRegisterExtension
${FileAssociation_VERBOSE} 3 # no script ${FileAssociation_VERBOSE} 3 # no script
*/ */
!ifndef FileAssociation_INCLUDED !ifndef FileAssociation_INCLUDED
!define FileAssociation_INCLUDED !define FileAssociation_INCLUDED
!include Util.nsh !include Util.nsh
!verbose push !verbose push
!verbose 3 !verbose 3
!ifndef _FileAssociation_VERBOSE !ifndef _FileAssociation_VERBOSE
!define _FileAssociation_VERBOSE 3 !define _FileAssociation_VERBOSE 3
!endif !endif
!verbose ${_FileAssociation_VERBOSE} !verbose ${_FileAssociation_VERBOSE}
!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE` !define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE`
!verbose pop !verbose pop
!macro FileAssociation_VERBOSE _VERBOSE !macro FileAssociation_VERBOSE _VERBOSE
!verbose push !verbose push
!verbose 3 !verbose 3
!undef _FileAssociation_VERBOSE !undef _FileAssociation_VERBOSE
!define _FileAssociation_VERBOSE ${_VERBOSE} !define _FileAssociation_VERBOSE ${_VERBOSE}
!verbose pop !verbose pop
!macroend !macroend
!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION !macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION
!verbose push !verbose push
!verbose ${_FileAssociation_VERBOSE} !verbose ${_FileAssociation_VERBOSE}
Push `${_DESCRIPTION}` Push `${_DESCRIPTION}`
Push `${_EXTENSION}` Push `${_EXTENSION}`
Push `${_EXECUTABLE}` Push `${_EXECUTABLE}`
${CallArtificialFunction} RegisterExtension_ ${CallArtificialFunction} RegisterExtension_
!verbose pop !verbose pop
!macroend !macroend
!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION !macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION
!verbose push !verbose push
!verbose ${_FileAssociation_VERBOSE} !verbose ${_FileAssociation_VERBOSE}
Push `${_EXTENSION}` Push `${_EXTENSION}`
Push `${_DESCRIPTION}` Push `${_DESCRIPTION}`
${CallArtificialFunction} UnRegisterExtension_ ${CallArtificialFunction} UnRegisterExtension_
!verbose pop !verbose pop
!macroend !macroend
!define RegisterExtension `!insertmacro RegisterExtensionCall` !define RegisterExtension `!insertmacro RegisterExtensionCall`
!define un.RegisterExtension `!insertmacro RegisterExtensionCall` !define un.RegisterExtension `!insertmacro RegisterExtensionCall`
!macro RegisterExtension !macro RegisterExtension
!macroend !macroend
!macro un.RegisterExtension !macro un.RegisterExtension
!macroend !macroend
!macro RegisterExtension_ !macro RegisterExtension_
!verbose push !verbose push
!verbose ${_FileAssociation_VERBOSE} !verbose ${_FileAssociation_VERBOSE}
Exch $R2 ;exe Exch $R2 ;exe
Exch Exch
Exch $R1 ;ext Exch $R1 ;ext
Exch Exch
Exch 2 Exch 2
Exch $R0 ;desc Exch $R0 ;desc
Exch 2 Exch 2
Push $0 Push $0
Push $1 Push $1
ReadRegStr $1 HKCR $R1 "" ; read current file association ReadRegStr $1 HKCR $R1 "" ; read current file association
StrCmp "$1" "" NoBackup ; is it empty StrCmp "$1" "" NoBackup ; is it empty
StrCmp "$1" "$R0" NoBackup ; is it our own StrCmp "$1" "$R0" NoBackup ; is it our own
WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value
NoBackup: NoBackup:
WriteRegStr HKCR $R1 "" "$R0" ; set our file association WriteRegStr HKCR $R1 "" "$R0" ; set our file association
ReadRegStr $0 HKCR $R0 "" ReadRegStr $0 HKCR $R0 ""
StrCmp $0 "" 0 Skip StrCmp $0 "" 0 Skip
WriteRegStr HKCR "$R0" "" "$R0" WriteRegStr HKCR "$R0" "" "$R0"
WriteRegStr HKCR "$R0\shell" "" "open" WriteRegStr HKCR "$R0\shell" "" "open"
WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0" WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0"
Skip: Skip:
WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"' WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"'
WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0" WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0"
WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"' WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"'
Pop $1 Pop $1
Pop $0 Pop $0
Pop $R2 Pop $R2
Pop $R1 Pop $R1
Pop $R0 Pop $R0
!verbose pop !verbose pop
!macroend !macroend
!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall` !define UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall` !define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
!macro UnRegisterExtension !macro UnRegisterExtension
!macroend !macroend
!macro un.UnRegisterExtension !macro un.UnRegisterExtension
!macroend !macroend
!macro UnRegisterExtension_ !macro UnRegisterExtension_
!verbose push !verbose push
!verbose ${_FileAssociation_VERBOSE} !verbose ${_FileAssociation_VERBOSE}
Exch $R1 ;desc Exch $R1 ;desc
Exch Exch
Exch $R0 ;ext Exch $R0 ;ext
Exch Exch
Push $0 Push $0
Push $1 Push $1
ReadRegStr $1 HKCR $R0 "" ReadRegStr $1 HKCR $R0 ""
StrCmp $1 $R1 0 NoOwn ; only do this if we own it StrCmp $1 $R1 0 NoOwn ; only do this if we own it
ReadRegStr $1 HKCR $R0 "backup_val" ReadRegStr $1 HKCR $R0 "backup_val"
StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
DeleteRegKey HKCR $R0 DeleteRegKey HKCR $R0
Goto NoOwn Goto NoOwn
Restore: Restore:
WriteRegStr HKCR $R0 "" $1 WriteRegStr HKCR $R0 "" $1
DeleteRegValue HKCR $R0 "backup_val" DeleteRegValue HKCR $R0 "backup_val"
DeleteRegKey HKCR $R1 ;Delete key with association name settings DeleteRegKey HKCR $R1 ;Delete key with association name settings
NoOwn: NoOwn:
Pop $1 Pop $1
Pop $0 Pop $0
Pop $R1 Pop $R1
Pop $R0 Pop $R0
!verbose pop !verbose pop
!macroend !macroend
!endif # !FileAssociation_INCLUDED !endif # !FileAssociation_INCLUDED

View File

@ -1,216 +1,216 @@
RequestExecutionLevel user RequestExecutionLevel admin
!include "FileAssociation.nsh" !include "FileAssociation.nsh"
SetCompressor /SOLID /FINAL lzma SetCompressor /SOLID /FINAL lzma
!define PRODUCT_NAME "QupZilla" !define PRODUCT_NAME "QupZilla"
!define /date PRODUCT_VERSION "0.9.9" !define /date PRODUCT_VERSION "0.9.9"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\qupzilla.exe" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\qupzilla.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_UNINST_ROOT_KEY "HKLM"
!include "MUI.nsh" !include "MUI.nsh"
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_ICON "wininstall\install.ico" !define MUI_ICON "wininstall\install.ico"
!define MUI_UNICON "wininstall\uninstall.ico" !define MUI_UNICON "wininstall\uninstall.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "wininstall\welcome.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "wininstall\welcome.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "wininstall\welcome.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wininstall\welcome.bmp"
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE COPYRIGHT.txt !insertmacro MUI_PAGE_LICENSE COPYRIGHT.txt
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\qupzilla.exe" !define MUI_FINISHPAGE_RUN "$INSTDIR\qupzilla.exe"
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH !insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Czech" !insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Slovak" !insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Dutch" !insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "French" !insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German" !insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Korean" !insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Russian" !insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Swedish" !insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Tradchinese" !insertmacro MUI_LANGUAGE "Tradchinese"
!insertmacro MUI_LANGUAGE "Simpchinese" !insertmacro MUI_LANGUAGE "Simpchinese"
!insertmacro MUI_RESERVEFILE_LANGDLL !insertmacro MUI_RESERVEFILE_LANGDLL
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME} ${PRODUCT_VERSION} Installer.exe" OutFile "${PRODUCT_NAME} ${PRODUCT_VERSION} Installer.exe"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}\" InstallDir "$PROGRAMFILES\${PRODUCT_NAME}\"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show ShowInstDetails show
ShowUnInstDetails show ShowUnInstDetails show
!include "wininstall\languages.nsh" !include "wininstall\languages.nsh"
Section !$(TITLE_SecMain) SecMain Section !$(TITLE_SecMain) SecMain
SectionIn RO SectionIn RO
KillProcDLL::KillProc "qupzilla.exe" KillProcDLL::KillProc "qupzilla.exe"
Sleep 100 Sleep 100
SetOverwrite on SetOverwrite on
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "COPYRIGHT.txt" File "COPYRIGHT.txt"
File "qupzilla.exe" File "qupzilla.exe"
File "libeay32.dll" File "libeay32.dll"
File "ssleay32.dll" File "ssleay32.dll"
File "msvcp90.dll" File "msvcp90.dll"
File "msvcr90.dll" File "msvcr90.dll"
File "phonon4.dll" File "phonon4.dll"
File "QtCore4.dll" File "QtCore4.dll"
File "QtGui4.dll" File "QtGui4.dll"
File "QtNetwork4.dll" File "QtNetwork4.dll"
File "QtSql4.dll" File "QtSql4.dll"
File "QtWebKit4.dll" File "QtWebKit4.dll"
SetOutPath "$INSTDIR\data\default\profiles" SetOutPath "$INSTDIR\data\default\profiles"
File "data\default\profiles\profiles.ini" File "data\default\profiles\profiles.ini"
SetOutPath "$INSTDIR\data\default\profiles\default" SetOutPath "$INSTDIR\data\default\profiles\default"
File "data\default\profiles\default\background.png" File "data\default\profiles\default\background.png"
File "data\default\profiles\default\browsedata.db" File "data\default\profiles\default\browsedata.db"
SetOutPath "$INSTDIR\imageformats" SetOutPath "$INSTDIR\imageformats"
File "imageformats\qico4.dll" File "imageformats\qico4.dll"
File "imageformats\qsvg4.dll" File "imageformats\qsvg4.dll"
File "imageformats\qgif4.dll" File "imageformats\qgif4.dll"
File "imageformats\qjpeg4.dll" File "imageformats\qjpeg4.dll"
File "imageformats\qtiff4.dll" File "imageformats\qtiff4.dll"
File "imageformats\qmng4.dll" File "imageformats\qmng4.dll"
SetOutPath "$INSTDIR\sqldrivers" SetOutPath "$INSTDIR\sqldrivers"
File "sqldrivers\qsqlite4.dll" File "sqldrivers\qsqlite4.dll"
File "sqldrivers\qsqlodbc4.dll" File "sqldrivers\qsqlodbc4.dll"
SectionEnd SectionEnd
SectionGroup $(TITLE_SecTranslations) SecTranslations SectionGroup $(TITLE_SecTranslations) SecTranslations
Section $(TITLE_SecEnglish) SecEnglish Section $(TITLE_SecEnglish) SecEnglish
SectionIn RO SectionIn RO
SectionEnd SectionEnd
Section $(TITLE_SecCzech) SecCzech Section $(TITLE_SecCzech) SecCzech
SetOutPath "$INSTDIR\locale" SetOutPath "$INSTDIR\locale"
File "locale\cs_CZ.qm" File "locale\cs_CZ.qm"
File "locale\qt_cs.qm" File "locale\qt_cs.qm"
SectionEnd SectionEnd
Section $(TITLE_SecSlovak) SecSlovak Section $(TITLE_SecSlovak) SecSlovak
SetOutPath "$INSTDIR\locale" SetOutPath "$INSTDIR\locale"
File "locale\sk_SK.qm" File "locale\sk_SK.qm"
File "locale\qt_sk.qm" File "locale\qt_sk.qm"
SectionEnd SectionEnd
SectionGroupEnd SectionGroupEnd
SectionGroup $(TITLE_SecPlugins) SecPlugins SectionGroup $(TITLE_SecPlugins) SecPlugins
Section $(TITLE_SecExamplePlugin) SecExamplePlugin Section $(TITLE_SecExamplePlugin) SecExamplePlugin
SetOutPath "$INSTDIR\plugins" SetOutPath "$INSTDIR\plugins"
File "plugins\ExamplePlugin.dll" File "plugins\ExamplePlugin.dll"
SectionEnd SectionEnd
SectionGroupEnd SectionGroupEnd
Section $(TITLE_SecExtensions) SecExtensions Section $(TITLE_SecExtensions) SecExtensions
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
${registerExtension} "$INSTDIR\qupzilla.exe" ".htm" "HTM File" ${registerExtension} "$INSTDIR\qupzilla.exe" ".htm" "HTM File"
${registerExtension} "$INSTDIR\qupzilla.exe" ".html" "HTML File" ${registerExtension} "$INSTDIR\qupzilla.exe" ".html" "HTML File"
SectionEnd SectionEnd
Section "-StartMenu" Section "-StartMenu"
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
SetShellVarContext all SetShellVarContext all
CreateDirectory "$SMPROGRAMS\QupZilla" CreateDirectory "$SMPROGRAMS\QupZilla"
CreateShortCut "$SMPROGRAMS\QupZilla\Uninstall.lnk" "$INSTDIR\Uninstall.exe" CreateShortCut "$SMPROGRAMS\QupZilla\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$SMPROGRAMS\QupZilla\QupZilla.lnk" "$INSTDIR\qupzilla.exe" CreateShortCut "$SMPROGRAMS\QupZilla\QupZilla.lnk" "$INSTDIR\qupzilla.exe"
CreateShortCut "$SMPROGRAMS\QupZilla\License.lnk" "$INSTDIR\COPYRIGHT.txt" CreateShortCut "$SMPROGRAMS\QupZilla\License.lnk" "$INSTDIR\COPYRIGHT.txt"
SectionEnd SectionEnd
Section $(TITLE_SecDesktop) SecDesktop Section $(TITLE_SecDesktop) SecDesktop
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\QupZilla.lnk" "$INSTDIR\qupzilla.exe" "" CreateShortCut "$DESKTOP\QupZilla.lnk" "$INSTDIR\qupzilla.exe" ""
SectionEnd SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_SecMain) !insertmacro MUI_DESCRIPTION_TEXT ${SecMain} $(DESC_SecMain)
!insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} $(DESC_SecTranslations) !insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} $(DESC_SecTranslations)
!insertmacro MUI_DESCRIPTION_TEXT ${SecEnglish} $(DESC_SecEnglish) !insertmacro MUI_DESCRIPTION_TEXT ${SecEnglish} $(DESC_SecEnglish)
!insertmacro MUI_DESCRIPTION_TEXT ${SecCzech} $(DESC_SecCzech) !insertmacro MUI_DESCRIPTION_TEXT ${SecCzech} $(DESC_SecCzech)
!insertmacro MUI_DESCRIPTION_TEXT ${SecSlovak} $(DESC_SecSlovak) !insertmacro MUI_DESCRIPTION_TEXT ${SecSlovak} $(DESC_SecSlovak)
!insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} $(DESC_SecPlugins) !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} $(DESC_SecPlugins)
!insertmacro MUI_DESCRIPTION_TEXT ${SecExamplePlugin} $(DESC_SecExamplePlugin) !insertmacro MUI_DESCRIPTION_TEXT ${SecExamplePlugin} $(DESC_SecExamplePlugin)
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop) !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop)
!insertmacro MUI_DESCRIPTION_TEXT ${SecExtensions} $(DESC_SecExtensions) !insertmacro MUI_DESCRIPTION_TEXT ${SecExtensions} $(DESC_SecExtensions)
!insertmacro MUI_FUNCTION_DESCRIPTION_END !insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "-Uninstaller" Section "-Uninstaller"
WriteUninstaller "$INSTDIR\uninstall.exe" WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\qupzilla.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\qupzilla.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\qupzilla.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\qupzilla.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
SectionEnd SectionEnd
Section Uninstall Section Uninstall
KillProcDLL::KillProc "qupzilla.exe" KillProcDLL::KillProc "qupzilla.exe"
Sleep 100 Sleep 100
SetShellVarContext all SetShellVarContext all
Delete "$DESKTOP\QupZilla.lnk" Delete "$DESKTOP\QupZilla.lnk"
RMDir /r "$INSTDIR" RMDir /r "$INSTDIR"
RMDir /r "$SMPROGRAMS\QupZilla" RMDir /r "$SMPROGRAMS\QupZilla"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
${unregisterExtension} ".htm" $(FILE_Htm) ${unregisterExtension} ".htm" $(FILE_Htm)
${unregisterExtension} ".html" $(FILE_Html) ${unregisterExtension} ".html" $(FILE_Html)
SectionEnd SectionEnd
BrandingText "${PRODUCT_NAME} ${PRODUCT_VERSION} Installer" BrandingText "${PRODUCT_NAME} ${PRODUCT_VERSION} Installer"
Function .onInit Function .onInit
;Language selection dialog ;Language selection dialog
Push "" Push ""
Push ${LANG_ENGLISH} Push ${LANG_ENGLISH}
Push English Push English
Push ${LANG_CZECH} Push ${LANG_CZECH}
Push Czech Push Czech
Push ${LANG_DUTCH} Push ${LANG_DUTCH}
Push Dutch Push Dutch
Push ${LANG_FRENCH} Push ${LANG_FRENCH}
Push French Push French
Push ${LANG_GERMAN} Push ${LANG_GERMAN}
Push German Push German
Push ${LANG_KOREAN} Push ${LANG_KOREAN}
Push Korean Push Korean
Push ${LANG_RUSSIAN} Push ${LANG_RUSSIAN}
Push Russian Push Russian
Push ${LANG_SPANISH} Push ${LANG_SPANISH}
Push Spanish Push Spanish
Push ${LANG_SWEDISH} Push ${LANG_SWEDISH}
Push Swedish Push Swedish
Push ${LANG_TRADCHINESE} Push ${LANG_TRADCHINESE}
Push "Traditional Chinese" Push "Traditional Chinese"
Push ${LANG_SIMPCHINESE} Push ${LANG_SIMPCHINESE}
Push "Simplified Chinese" Push "Simplified Chinese"
Push ${LANG_SLOVAK} Push ${LANG_SLOVAK}
Push Slovak Push Slovak
Push A ; A means auto count languages Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain ; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "Installer Language" "Please select the language of the installer" LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
Pop $LANGUAGE Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2 StrCmp $LANGUAGE "cancel" 0 +2
Abort Abort
FunctionEnd FunctionEnd