
Hello community, here is the log from the commit of package kchmviewer for openSUSE:Factory checked in at Fri Oct 30 16:57:14 CET 2009. -------- --- KDE/kchmviewer/kchmviewer.changes 2009-08-18 14:45:10.000000000 +0200 +++ /mounts/work_src_done/STABLE/kchmviewer/kchmviewer.changes 2009-10-25 20:11:58.000000000 +0100 @@ -1,0 +2,8 @@ +Sun Oct 25 19:10:04 UTC 2009 - tittiatcoke@gmail.com + +- Update to 4.2 + * Fixed font size change on KHTMLPart + * Fixed "Open in new tab" for QTextBrowser + * Other minor feature enhancements + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- kchmviewer-4.1.tar.bz2 New: ---- kchmviewer-4.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kchmviewer.spec ++++++ --- /var/tmp/diff_new_pack.nB5zJj/_old 2009-10-30 16:56:49.000000000 +0100 +++ /var/tmp/diff_new_pack.nB5zJj/_new 2009-10-30 16:56:49.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package kchmviewer (Version 4.1) +# spec file for package kchmviewer (Version 4.2) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -24,8 +24,8 @@ License: GPL v3 only Group: Productivity/Office/Other Summary: KDE chm Viewer (MS Windows Compressed HTML Documents) -Version: 4.1 -Release: 2 +Version: 4.2 +Release: 1 Url: http://www.kchmviewer.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: %name-%version.tar.bz2 ++++++ kchmviewer-4.1.tar.bz2 -> kchmviewer-4.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/ChangeLog new/kchmviewer-4.2/ChangeLog --- old/kchmviewer-4.1/ChangeLog 2009-07-20 05:33:41.000000000 +0200 +++ new/kchmviewer-4.2/ChangeLog 2009-10-25 02:36:02.000000000 +0200 @@ -1,3 +1,11 @@ +2009-24-10 tim <gyunaev@ulduzsoft.com> + - Version changed to 4.2 + - Fixed font size change on KHTMLPart (thanks to Jure Repinc) + - Fixed Windows file opener being unable to open the file with non-English characters. + - Fixed "Open in new tab" for QTextBrowser opening an empty page. + - Middle button in QTextBrowser and WebKit now opens the link in new tab in background. + - Middle button now closes opened tabs in the tab bar. + 2009-19-07 tim <gyunaev@ulduzsoft.com> - Version changed to 4.1 - Updated Dutch translation (thanks to Sander Pientka) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/lib/libchmfile/bitfiddle.h new/kchmviewer-4.2/lib/libchmfile/bitfiddle.h --- old/kchmviewer-4.1/lib/libchmfile/bitfiddle.h 2008-12-01 10:03:08.000000000 +0100 +++ new/kchmviewer-4.2/lib/libchmfile/bitfiddle.h 2009-10-25 01:12:05.000000000 +0200 @@ -47,9 +47,9 @@ } -inline u_int64_t be_encint(unsigned char* buffer, size_t& length) +inline quint64 be_encint(unsigned char* buffer, size_t& length) { - u_int64_t result = 0; + quint64 result = 0; int shift=0; length = 0; @@ -95,17 +95,17 @@ } -inline u_int64_t sr_int(unsigned char* byte, int* bit, +inline quint64 sr_int(unsigned char* byte, int* bit, unsigned char s, unsigned char r, size_t& length) { - u_int64_t ret; + quint64 ret; unsigned char mask; int n, n_bits, num_bits, base, count; length = 0; size_t fflen; if(!bit || *bit > 7 || s != 2) - return ~(u_int64_t)0; + return ~(quint64)0; ret = 0; count = ffus(byte, bit, fflen); @@ -150,7 +150,7 @@ mask <<= base; ret = (ret << (num_bits+1)) | - (u_int64_t)((*byte & mask) >> base); + (quint64)((*byte & mask) >> base); if( n > *bit ){ ++byte; @@ -164,7 +164,7 @@ } if(count) - ret |= (u_int64_t)1 << n_bits; + ret |= (quint64)1 << n_bits; return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/lib/libchmfile/chmlib-win32/chm_lib.h new/kchmviewer-4.2/lib/libchmfile/chmlib-win32/chm_lib.h --- old/kchmviewer-4.1/lib/libchmfile/chmlib-win32/chm_lib.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kchmviewer-4.2/lib/libchmfile/chmlib-win32/chm_lib.h 2009-10-25 01:12:05.000000000 +0200 @@ -0,0 +1,147 @@ +/* $Id: chm_lib.h,v 1.10 2002/10/09 01:16:33 jedwin Exp $ */ +/*************************************************************************** + * chm_lib.h - CHM archive manipulation routines * + * ------------------- * + * * + * author: Jed Wing <jedwin@ugcs.caltech.edu> * + * version: 0.3 * + * notes: These routines are meant for the manipulation of microsoft * + * .chm (compiled html help) files, but may likely be used * + * for the manipulation of any ITSS archive, if ever ITSS * + * archives are used for any other purpose. * + * * + * Note also that the section names are statically handled. * + * To be entirely correct, the section names should be read * + * from the section names meta-file, and then the various * + * content sections and the "transforms" to apply to the data * + * they contain should be inferred from the section name and * + * the meta-files referenced using that name; however, all of * + * the files I've been able to get my hands on appear to have * + * only two sections: Uncompressed and MSCompressed. * + * Additionally, the ITSS.DLL file included with Windows does * + * not appear to handle any different transforms than the * + * simple LZX-transform. Furthermore, the list of transforms * + * to apply is broken, in that only half the required space * + * is allocated for the list. (It appears as though the * + * space is allocated for ASCII strings, but the strings are * + * written as unicode. As a result, only the first half of * + * the string appears.) So this is probably not too big of * + * a deal, at least until CHM v4 (MS .lit files), which also * + * incorporate encryption, of some description. * + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation; either version 2.1 of the * + * License, or (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef INCLUDED_CHMLIB_H +#define INCLUDED_CHMLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* RWE 6/12/1002 */ +#ifdef PPC_BSTR +#include <wtypes.h> +#endif + +#ifdef WIN32 +#include <windows.h> +#ifdef __MINGW32__ +#define __int64 long long +#endif +typedef unsigned __int64 LONGUINT64; +typedef __int64 LONGINT64; +#else +typedef unsigned long long LONGUINT64; +typedef long long LONGINT64; +#endif + +/* the two available spaces in a CHM file */ +/* N.B.: The format supports arbitrarily many spaces, but only */ +/* two appear to be used at present. */ +#define CHM_UNCOMPRESSED (0) +#define CHM_COMPRESSED (1) + +/* structure representing an ITS (CHM) file stream */ +struct chmFile; + +/* structure representing an element from an ITS file stream */ +#define CHM_MAX_PATHLEN (512) +struct chmUnitInfo +{ + LONGUINT64 start; + LONGUINT64 length; + int space; + int flags; + char path[CHM_MAX_PATHLEN+1]; +}; + +/* open an ITS archive */ +#ifdef PPC_BSTR +/* RWE 6/12/2003 */ +struct chmFile* chm_open(BSTR filename); +#elif defined (WIN32) +struct chmFile* chm_open(const WCHAR *filename); +#else +struct chmFile* chm_open(const char *filename); +#endif + +/* close an ITS archive */ +void chm_close(struct chmFile *h); + +/* methods for ssetting tuning parameters for particular file */ +#define CHM_PARAM_MAX_BLOCKS_CACHED 0 +void chm_set_param(struct chmFile *h, + int paramType, + int paramVal); + +/* resolve a particular object from the archive */ +#define CHM_RESOLVE_SUCCESS (0) +#define CHM_RESOLVE_FAILURE (1) +int chm_resolve_object(struct chmFile *h, + const char *objPath, + struct chmUnitInfo *ui); + +/* retrieve part of an object from the archive */ +LONGINT64 chm_retrieve_object(struct chmFile *h, + struct chmUnitInfo *ui, + unsigned char *buf, + LONGUINT64 addr, + LONGINT64 len); + +/* enumerate the objects in the .chm archive */ +typedef int (*CHM_ENUMERATOR)(struct chmFile *h, + struct chmUnitInfo *ui, + void *context); +#define CHM_ENUMERATE_NORMAL (1) +#define CHM_ENUMERATE_META (2) +#define CHM_ENUMERATE_SPECIAL (4) +#define CHM_ENUMERATE_FILES (8) +#define CHM_ENUMERATE_DIRS (16) +#define CHM_ENUMERATE_ALL (31) +#define CHM_ENUMERATOR_FAILURE (0) +#define CHM_ENUMERATOR_CONTINUE (1) +#define CHM_ENUMERATOR_SUCCESS (2) +int chm_enumerate(struct chmFile *h, + int what, + CHM_ENUMERATOR e, + void *context); + +int chm_enumerate_dir(struct chmFile *h, + const char *prefix, + int what, + CHM_ENUMERATOR e, + void *context); + +#ifdef __cplusplus +} +#endif + +#endif /* INCLUDED_CHMLIB_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/lib/libchmfile/chmlib-win32/chmlib-win32.patch new/kchmviewer-4.2/lib/libchmfile/chmlib-win32/chmlib-win32.patch --- old/kchmviewer-4.1/lib/libchmfile/chmlib-win32/chmlib-win32.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/kchmviewer-4.2/lib/libchmfile/chmlib-win32/chmlib-win32.patch 2009-10-25 01:12:05.000000000 +0200 @@ -0,0 +1,42 @@ +diff -ur chmlib-0.40/src/chm_lib.c chmlib-0.40.mod/src/chm_lib.c +--- chmlib-0.40/src/chm_lib.c 2009-05-23 07:43:31.000000000 -0700 ++++ chmlib-0.40.mod/src/chm_lib.c 2009-10-24 15:50:08.000000000 -0700 +@@ -750,6 +750,8 @@ + #ifdef PPC_BSTR + /* RWE 6/12/2003 */ + struct chmFile *chm_open(BSTR filename) ++#elif defined (WIN32) ++struct chmFile* chm_open(const WCHAR *filename) + #else + struct chmFile *chm_open(const char *filename) + #endif +@@ -791,7 +793,7 @@ + return NULL; + } + #else +- if ((newHandle->fd=CreateFileA(filename, ++ if ((newHandle->fd=CreateFileW(filename, + GENERIC_READ, + 0, + NULL, +Only in chmlib-0.40.mod/src: chm_lib.c~ +diff -ur chmlib-0.40/src/chm_lib.h chmlib-0.40.mod/src/chm_lib.h +--- chmlib-0.40/src/chm_lib.h 2009-05-23 07:43:31.000000000 -0700 ++++ chmlib-0.40.mod/src/chm_lib.h 2009-10-24 15:49:48.000000000 -0700 +@@ -52,6 +52,7 @@ + #endif + + #ifdef WIN32 ++#include <windows.h> + #ifdef __MINGW32__ + #define __int64 long long + #endif +@@ -86,6 +87,8 @@ + #ifdef PPC_BSTR + /* RWE 6/12/2003 */ + struct chmFile* chm_open(BSTR filename); ++#elif defined (WIN32) ++struct chmFile* chm_open(const WCHAR *filename); + #else + struct chmFile* chm_open(const char *filename); + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/lib/libchmfile/libchmfile.pro new/kchmviewer-4.2/lib/libchmfile/libchmfile.pro --- old/kchmviewer-4.1/lib/libchmfile/libchmfile.pro 2008-12-02 02:43:24.000000000 +0100 +++ new/kchmviewer-4.2/lib/libchmfile/libchmfile.pro 2009-10-25 01:12:05.000000000 +0200 @@ -24,3 +24,6 @@ INCLUDEPATH += ../../src CONFIG -= release +win32-mingw-g++: { + DEFINES += USE_PATCHED_CHMLIB +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/lib/libchmfile/libchmfile_search.cpp new/kchmviewer-4.2/lib/libchmfile/libchmfile_search.cpp --- old/kchmviewer-4.1/lib/libchmfile/libchmfile_search.cpp 2008-02-11 02:15:15.000000000 +0100 +++ new/kchmviewer-4.2/lib/libchmfile/libchmfile_search.cpp 2009-10-25 01:12:05.000000000 +0200 @@ -80,12 +80,12 @@ } -static inline void findNextWords ( QVector<u_int64_t> & src, const QVector<u_int64_t> & needle ) +static inline void findNextWords ( QVector<quint64> & src, const QVector<quint64> & needle ) { for ( int s1 = 0; s1 < src.size(); s1++ ) { bool found = false; - u_int64_t target_offset = src[s1] + 1; + quint64 target_offset = src[s1] + 1; DEBUG_SEARCH (("Offset loop: offset at %u is %u, target %u", (unsigned int) s1, (unsigned int) src[s1], (unsigned int) target_offset)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/lib/libchmfile/libchmfileimpl.cpp new/kchmviewer-4.2/lib/libchmfile/libchmfileimpl.cpp --- old/kchmviewer-4.1/lib/libchmfile/libchmfileimpl.cpp 2009-07-20 03:30:11.000000000 +0200 +++ new/kchmviewer-4.2/lib/libchmfile/libchmfileimpl.cpp 2009-10-25 01:12:05.000000000 +0200 @@ -30,7 +30,12 @@ #include <QVector> #include <QTextStream> -#include "chm_lib.h" +#if defined (USE_PATCHED_CHMLIB) + #include "chmlib-win32/chm_lib.h" +#else + #include "chm_lib.h" +#endif + #include "bitfiddle.h" #include "libchmfile.h" #include "libchmurlfactory.h" @@ -87,7 +92,11 @@ if( m_chmFile ) closeAll(); +#if defined (USE_PATCHED_CHMLIB) + m_chmFile = chm_open( (WCHAR*) filename.utf16() ); +#else m_chmFile = chm_open( QFile::encodeName(filename) ); +#endif if ( m_chmFile == NULL ) return false; @@ -474,7 +483,7 @@ free_space = UINT16ARRAY(cursor16); i = sizeof(unsigned int) + sizeof(unsigned short) + sizeof(unsigned short); - u_int64_t wlc_count, wlc_size; + quint64 wlc_count, wlc_size; unsigned int wlc_offset; while (i < node_len - free_space) @@ -571,9 +580,9 @@ inline unsigned int LCHMFileImpl::GetLeafNodeOffset(const QString& text, - unsigned int initialOffset, - unsigned int buffSize, - unsigned short treeDepth) + unsigned int initialOffset, + unsigned int buffSize, + unsigned short treeDepth) { unsigned int test_offset = 0; unsigned char* cursor16, *cursor32; @@ -629,7 +638,7 @@ } -inline bool LCHMFileImpl::ProcessWLC (u_int64_t wlc_count, u_int64_t wlc_size, +inline bool LCHMFileImpl::ProcessWLC (quint64 wlc_count, quint64 wlc_size, unsigned int wlc_offset, unsigned char ds, unsigned char dr, unsigned char cs, unsigned char cr, unsigned char ls, @@ -638,7 +647,7 @@ bool phrase_search) { int wlc_bit = 7; - u_int64_t index = 0, count; + quint64 index = 0, count; size_t length, off = 0; QVector<unsigned char> buffer (wlc_size); unsigned char *cursor32; @@ -649,7 +658,7 @@ if ( RetrieveObject (&m_chmFIftiMain, buffer.data(), wlc_offset, wlc_size) == 0 ) return false; - for ( u_int64_t i = 0; i < wlc_count; ++i ) + for ( quint64 i = 0; i < wlc_count; ++i ) { if ( wlc_bit != 7 ) { @@ -683,9 +692,9 @@ if ( phrase_search ) progres.offsets.reserve (count); - for (u_int64_t j = 0; j < count; ++j) + for (quint64 j = 0; j < count; ++j) { - u_int64_t lcode = sr_int (buffer.data() + off, &wlc_bit, ls, lr, length); + quint64 lcode = sr_int (buffer.data() + off, &wlc_bit, ls, lr, length); off += length; if ( phrase_search ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/lib/libchmfile/libchmfileimpl.h new/kchmviewer-4.2/lib/libchmfile/libchmfileimpl.h --- old/kchmviewer-4.1/lib/libchmfile/libchmfileimpl.h 2009-07-20 03:30:11.000000000 +0200 +++ new/kchmviewer-4.2/lib/libchmfile/libchmfileimpl.h 2009-10-25 01:12:05.000000000 +0200 @@ -23,9 +23,13 @@ #ifndef INCLUDE_LIBCHMFILEIMPL_H #define INCLUDE_LIBCHMFILEIMPL_H -#include <sys/types.h> +#if defined (USE_CHMLIB_WIN32) + #include "chmlib-win32/chm_lib.h" +#else + #include "chm_lib.h" +#endif -#include "chm_lib.h" +#include <sys/types.h> #include "libchmfile.h" #include "libchmtocimage.h" @@ -38,11 +42,11 @@ { public: inline LCHMSearchProgressResult() {} - inline LCHMSearchProgressResult( u_int32_t t, u_int32_t u ) : titleoff(t),urloff(u) {} + inline LCHMSearchProgressResult( unsigned int t, unsigned int u ) : titleoff(t),urloff(u) {} - QVector<u_int64_t> offsets; - u_int32_t titleoff; - u_int32_t urloff; + QVector<quint64> offsets; + quint32 titleoff; + quint32 urloff; }; //! An array to keeps the intermediate search results @@ -144,15 +148,15 @@ const char * GetFontEncFromCharSet (const QString& font) const; //! Helper. Returns the $FIftiMain offset of leaf node or 0. - u_int32_t GetLeafNodeOffset(const QString& text, - u_int32_t initalOffset, - u_int32_t buffSize, - u_int16_t treeDepth ); + unsigned int GetLeafNodeOffset(const QString& text, + unsigned int initialOffset, + unsigned int buffSize, + unsigned short treeDepth); //! Helper. Processes the word location code entries while searching. - bool ProcessWLC(u_int64_t wlc_count, - u_int64_t wlc_size, - u_int32_t wlc_offset, + bool ProcessWLC(quint64 wlc_count, + quint64 wlc_size, + quint32 wlc_offset, unsigned char ds, unsigned char dr, unsigned char cs, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindow.cpp new/kchmviewer-4.2/src/kchmviewwindow.cpp --- old/kchmviewer-4.1/src/kchmviewwindow.cpp 2009-07-20 05:37:07.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindow.cpp 2009-10-25 02:26:00.000000000 +0200 @@ -34,7 +34,7 @@ #include "kchmviewwindowmgr.h" -KCHMViewWindow::KCHMViewWindow( QTabWidget * parent ) +KCHMViewWindow::KCHMViewWindow( KCHMViewWindowTabs * parent ) { invalidate(); m_contextMenu = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindow.h new/kchmviewer-4.2/src/kchmviewwindow.h --- old/kchmviewer-4.1/src/kchmviewwindow.h 2009-07-20 05:37:05.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindow.h 2009-10-25 02:26:00.000000000 +0200 @@ -25,6 +25,7 @@ #include "kde-qt.h" +class KCHMViewWindowTabs; class KCHMViewWindow { @@ -35,7 +36,7 @@ SEARCH_WHOLEWORDS = 0x20 }; - KCHMViewWindow ( QTabWidget * parent ); + KCHMViewWindow ( KCHMViewWindowTabs * parent ); virtual ~KCHMViewWindow(); //! Open a page from current chm archive @@ -118,6 +119,7 @@ QMenu * getContextMenu( const QString& link, QWidget * parent ); QMenu * createStandardContextMenu( QWidget * parent ); + private: //! History class KCHMUrlHistory { @@ -140,17 +142,17 @@ QMenu * m_contextMenu; QMenu * m_contextMenuLink; QList<KCHMUrlHistory> m_history; - - // This member keeps a "open new tab" link between getContextMenu() - // call and appropriate slot call - QString m_newTabLinkKeeper; - + QString m_openedPage; QString m_lastOpenedPage; QString m_base_url; // The parent tab browser - QTabWidget * m_parentTabWidget; + KCHMViewWindowTabs * m_parentTabWidget; + + // This member keeps a "open new tab" link between getContextMenu() + // call and appropriate slot call + QString m_newTabLinkKeeper; }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindow_qtextbrowser.cpp new/kchmviewer-4.2/src/kchmviewwindow_qtextbrowser.cpp --- old/kchmviewer-4.1/src/kchmviewwindow_qtextbrowser.cpp 2009-07-20 05:36:57.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindow_qtextbrowser.cpp 2009-10-25 02:36:02.000000000 +0200 @@ -29,7 +29,7 @@ #include "kchmviewwindow_qtextbrowser.h" -KCHMViewWindow_QTextBrowser::KCHMViewWindow_QTextBrowser( QTabWidget * parent ) +KCHMViewWindow_QTextBrowser::KCHMViewWindow_QTextBrowser( KCHMViewWindowTabs * parent ) : QTextBrowser ( parent ), KCHMViewWindow ( parent ) { m_zoomfactor = 0; @@ -317,7 +317,7 @@ m->addAction( i18n("Open Link in a new tab\tShift+LMB"), ::mainWindow, SLOT( onOpenPageInNewTab() ) ); m->addAction( i18n("Open Link in a new background tab\tCtrl+LMB"), ::mainWindow, SLOT( onOpenPageInNewBackgroundTab() ) ); m->addSeparator(); - m_newTabLinkKeeper = link; + setTabKeeper( link ); } ::mainWindow->setupPopupMenu( m ); @@ -325,3 +325,20 @@ delete m; } + +void KCHMViewWindow_QTextBrowser::mouseReleaseEvent ( QMouseEvent * event ) +{ + if ( event->button() == Qt::MidButton ) + { + QString link = anchorAt( event->pos() ); + + if ( !link.isEmpty() ) + { + setTabKeeper( link ); + ::mainWindow->onOpenPageInNewBackgroundTab(); + return; + } + } + + QTextBrowser::mouseReleaseEvent( event ); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindow_qtextbrowser.h new/kchmviewer-4.2/src/kchmviewwindow_qtextbrowser.h --- old/kchmviewer-4.1/src/kchmviewwindow_qtextbrowser.h 2009-07-20 05:36:53.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindow_qtextbrowser.h 2009-10-25 02:26:00.000000000 +0200 @@ -31,7 +31,7 @@ { Q_OBJECT public: - KCHMViewWindow_QTextBrowser( QTabWidget * parent ); + KCHMViewWindow_QTextBrowser( KCHMViewWindowTabs * parent ); ~KCHMViewWindow_QTextBrowser(); //! Open a page from current chm archive @@ -93,6 +93,8 @@ // Overloaded to provide custom context menu void contextMenuEvent( QContextMenuEvent *e ); + void mouseReleaseEvent ( QMouseEvent * event ); + void find( bool forward, bool backward ); QMenu * createPopupMenu ( const QPoint & pos ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindow_qtwebkit.cpp new/kchmviewer-4.2/src/kchmviewwindow_qtwebkit.cpp --- old/kchmviewer-4.1/src/kchmviewwindow_qtwebkit.cpp 2009-07-20 05:36:51.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindow_qtwebkit.cpp 2009-10-25 02:36:02.000000000 +0200 @@ -171,7 +171,7 @@ // // Webkit browser // -KCHMViewWindow_QtWebKit::KCHMViewWindow_QtWebKit( QTabWidget * parent ) +KCHMViewWindow_QtWebKit::KCHMViewWindow_QtWebKit( KCHMViewWindowTabs * parent ) : QWebView ( parent ), KCHMViewWindow ( parent ) { m_zoomfactor = 1; @@ -375,7 +375,7 @@ m->addAction( i18n("Open Link in a new tab\tShift+LMB"), ::mainWindow, SLOT( onOpenPageInNewTab() ) ); m->addAction( i18n("Open Link in a new background tab\tCtrl+LMB"), ::mainWindow, SLOT( onOpenPageInNewBackgroundTab() ) ); m->addSeparator(); - m_newTabLinkKeeper = link; + setTabKeeper( link ); } ::mainWindow->setupPopupMenu( m ); @@ -393,5 +393,23 @@ return res.linkUrl().path(); } + +void KCHMViewWindow_QtWebKit::mouseReleaseEvent ( QMouseEvent * event ) +{ + if ( event->button() == Qt::MidButton ) + { + QString link = anchorAt( event->pos() ); + + if ( !link.isEmpty() ) + { + setTabKeeper( link ); + ::mainWindow->onOpenPageInNewBackgroundTab(); + return; + } + } + + QWebView::mouseReleaseEvent( event ); +} + #endif // #if defined (QT_WEBKIT_LIB) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindow_qtwebkit.h new/kchmviewer-4.2/src/kchmviewwindow_qtwebkit.h --- old/kchmviewer-4.1/src/kchmviewwindow_qtwebkit.h 2009-07-20 05:36:48.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindow_qtwebkit.h 2009-10-25 02:36:02.000000000 +0200 @@ -32,7 +32,7 @@ { Q_OBJECT public: - KCHMViewWindow_QtWebKit( QTabWidget * parent ); + KCHMViewWindow_QtWebKit( KCHMViewWindowTabs * parent ); ~KCHMViewWindow_QtWebKit(); //! Open a page from current chm archive @@ -94,6 +94,8 @@ // Overloaded to provide custom context menu void contextMenuEvent( QContextMenuEvent *e ); + void mouseReleaseEvent ( QMouseEvent * event ); + void find( bool forward, bool backward ); QMenu * createPopupMenu ( const QPoint & pos ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindowmgr.cpp new/kchmviewer-4.2/src/kchmviewwindowmgr.cpp --- old/kchmviewer-4.1/src/kchmviewwindowmgr.cpp 2009-07-20 05:37:02.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindowmgr.cpp 2009-10-25 02:26:00.000000000 +0200 @@ -35,21 +35,44 @@ #endif + +// A small overriden class to handle a middle click +KCHMViewWindowTabs::KCHMViewWindowTabs( QWidget * parent ) + : QTabWidget( parent ) +{ +} + +KCHMViewWindowTabs::~KCHMViewWindowTabs() +{ +} + +void KCHMViewWindowTabs::mouseReleaseEvent ( QMouseEvent * event ) +{ + if ( event->button() == Qt::MidButton) + { + int tab = tabBar()->tabAt( event->pos() ); + + if ( tab != -1 ) + emit mouseMiddleClickTab( tab ); + } +} + + + KCHMViewWindowMgr::KCHMViewWindowMgr( QWidget *parent ) : QWidget( parent ), Ui::TabbedBrowser() { // UIC setupUi( this ); - // Remove the UIC-generated tab if it's there. - // Do it right here before the signals are connected, since after Qt 4.4.0 it triggers - // the currentChanged signal. - if ( tabWidget->count() > 0 ) - tabWidget->removeTab ( 0 ); - + // Create the tab widget + m_tabWidget = new KCHMViewWindowTabs( this ); + verticalLayout->insertWidget( 0, m_tabWidget, 10 ); + // on current tab changed - connect( tabWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( onTabChanged(QWidget *) ) ); - + connect( m_tabWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( onTabChanged(QWidget *) ) ); + connect( m_tabWidget, SIGNAL( mouseMiddleClickTab( int ) ), this, SLOT( onCloseWindow(int) ) ); + // Create a close button m_closeButton = new QToolButton( this ); m_closeButton->setCursor( Qt::ArrowCursor ); @@ -60,7 +83,7 @@ connect( m_closeButton, SIGNAL( clicked() ), this, SLOT( onCloseCurrentWindow() ) ); // Put it there - tabWidget->setCornerWidget( m_closeButton, Qt::TopRightCorner ); + m_tabWidget->setCornerWidget( m_closeButton, Qt::TopRightCorner ); // Create a "new tab" button QToolButton * newButton = new QToolButton( this ); @@ -71,7 +94,7 @@ connect( newButton, SIGNAL( clicked() ), this, SLOT( openNewTab() ) ); // Put it there - tabWidget->setCornerWidget( newButton, Qt::TopLeftCorner ); + m_tabWidget->setCornerWidget( newButton, Qt::TopLeftCorner ); // Hide the search frame frameFind->setVisible( false ); @@ -108,7 +131,7 @@ KCHMViewWindow * KCHMViewWindowMgr::current() { - TabData * tab = findTab( tabWidget->currentWidget() ); + TabData * tab = findTab( m_tabWidget->currentWidget() ); if ( !tab ) abort(); @@ -123,18 +146,18 @@ switch ( appConfig.m_usedBrowser ) { default: - viewvnd = new KCHMViewWindow_QTextBrowser( tabWidget ); + viewvnd = new KCHMViewWindow_QTextBrowser( m_tabWidget ); break; #if defined (USE_KDE) case KCHMConfig::BROWSER_KHTMLPART: - viewvnd = new KCHMViewWindow_KHTMLPart( tabWidget ); + viewvnd = new KCHMViewWindow_KHTMLPart( m_tabWidget ); break; #endif #if defined (QT_WEBKIT_LIB) case KCHMConfig::BROWSER_QTWEBKIT: - viewvnd = new KCHMViewWindow_QtWebKit( tabWidget ); + viewvnd = new KCHMViewWindow_QtWebKit( m_tabWidget ); break; #endif } @@ -153,12 +176,12 @@ SLOT( activateWindow() ) ); m_Windows.push_back( tabdata ); - tabWidget->addTab( tabdata.widget, "" ); - Q_ASSERT( m_Windows.size() == tabWidget->count() ); + m_tabWidget->addTab( tabdata.widget, "" ); + Q_ASSERT( m_Windows.size() == m_tabWidget->count() ); // Set active if it is the first tab if ( set_active || m_Windows.size() == 1 ) - tabWidget->setCurrentWidget( tabdata.widget ); + m_tabWidget->setCurrentWidget( tabdata.widget ); // Handle clicking on link in browser window connect( viewvnd->getQObject(), @@ -195,7 +218,7 @@ if ( title.length() > 25 ) title = title.left( 22 ) + "..."; - tabWidget->setTabText( tabWidget->indexOf( window->getQWidget() ), title ); + m_tabWidget->setTabText( m_tabWidget->indexOf( window->getQWidget() ), title ); tab->action->setText( title ); updateCloseButtons(); @@ -208,10 +231,23 @@ if ( m_Windows.size() == 1 ) return; - TabData * tab = findTab( tabWidget->currentWidget() ); + TabData * tab = findTab( m_tabWidget->currentWidget() ); closeWindow( tab->widget ); } + +void KCHMViewWindowMgr::onCloseWindow( int num ) +{ + // Do not allow to close the last window + if ( m_Windows.size() == 1 ) + return; + + TabData * tab = findTab( m_tabWidget->widget( num )); + + if ( tab ) + closeWindow( tab->widget ); +} + void KCHMViewWindowMgr::closeWindow( QWidget * widget ) { WindowsIterator it; @@ -225,7 +261,7 @@ m_menuWindow->removeAction( it->action ); - tabWidget->removeTab( tabWidget->indexOf( it->widget ) ); + m_tabWidget->removeTab( m_tabWidget->indexOf( it->widget ) ); delete it->window; delete it->action; @@ -258,9 +294,9 @@ { settings.clear(); - for ( int i = 0; i < tabWidget->count(); i++ ) + for ( int i = 0; i < m_tabWidget->count(); i++ ) { - QWidget * p = tabWidget->widget( i ); + QWidget * p = m_tabWidget->widget( i ); TabData * tab = findTab( p ); if ( !tab ) @@ -311,7 +347,7 @@ continue; QWidget *widget = it->widget; - tabWidget->setCurrentWidget(widget); + m_tabWidget->setCurrentWidget(widget); break; } } @@ -327,12 +363,12 @@ void KCHMViewWindowMgr::setCurrentPage(int index) { - tabWidget->setCurrentIndex( index ); + m_tabWidget->setCurrentIndex( index ); } int KCHMViewWindowMgr::currentPageIndex() const { - return tabWidget->currentIndex(); + return m_tabWidget->currentIndex(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kchmviewwindowmgr.h new/kchmviewer-4.2/src/kchmviewwindowmgr.h --- old/kchmviewer-4.1/src/kchmviewwindowmgr.h 2009-07-20 05:37:00.000000000 +0200 +++ new/kchmviewer-4.2/src/kchmviewwindowmgr.h 2009-10-25 02:26:00.000000000 +0200 @@ -26,6 +26,23 @@ #include "kchmsettings.h" #include "ui_window_browser.h" +// A small overriden class to handle a middle click +class KCHMViewWindowTabs : public QTabWidget +{ + Q_OBJECT + + public: + KCHMViewWindowTabs( QWidget * parent ); + + virtual ~KCHMViewWindowTabs(); + + signals: + void mouseMiddleClickTab( int tab ); + + protected: + void mouseReleaseEvent ( QMouseEvent * event ); +}; + class KCHMViewWindowMgr : public QWidget, public Ui::TabbedBrowser { @@ -65,6 +82,7 @@ public slots: void onCloseCurrentWindow(); + void onCloseWindow( int num ); void onActivateFind(); void onFindNext(); void onFindPrevious(); @@ -104,6 +122,8 @@ // linked permanently - if a middle window is deleted, all the following // actions will be relinked and replaced. QList< QAction* > m_actions; + + KCHMViewWindowTabs * m_tabWidget; }; #endif /* INCLUDE_KCHMVIEWWINDOWMGR_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kde/kchmviewwindow_khtmlpart.cpp new/kchmviewer-4.2/src/kde/kchmviewwindow_khtmlpart.cpp --- old/kchmviewer-4.1/src/kde/kchmviewwindow_khtmlpart.cpp 2008-06-19 01:34:09.000000000 +0200 +++ new/kchmviewer-4.2/src/kde/kchmviewwindow_khtmlpart.cpp 2009-10-25 02:39:04.000000000 +0200 @@ -27,6 +27,7 @@ #include "kde-qt.h" #include "kchmmainwindow.h" #include "kchmconfig.h" +#include "kchmviewwindowmgr.h" #include "kchmviewwindow_khtmlpart.h" @@ -35,7 +36,7 @@ return view(); } -KCHMViewWindow_KHTMLPart::KCHMViewWindow_KHTMLPart( QTabWidget * parent ) +KCHMViewWindow_KHTMLPart::KCHMViewWindow_KHTMLPart( KCHMViewWindowTabs * parent ) : KHTMLPart ( parent ), KCHMViewWindow ( parent ) { m_zoomfactor = 0; @@ -76,7 +77,7 @@ m_zoomfactor = zoom; // Default ZoomFactor is 100, any increase or decrease should modify this value. - KHTMLPart::setZoomFactor ( 100 + (m_zoomfactor * 10) ); + KHTMLPart::setFontScaleFactor ( 100 + (m_zoomfactor * 10) ); } void KCHMViewWindow_KHTMLPart::invalidate( ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/kde/kchmviewwindow_khtmlpart.h new/kchmviewer-4.2/src/kde/kchmviewwindow_khtmlpart.h --- old/kchmviewer-4.1/src/kde/kchmviewwindow_khtmlpart.h 2008-06-10 02:46:56.000000000 +0200 +++ new/kchmviewer-4.2/src/kde/kchmviewwindow_khtmlpart.h 2009-10-25 02:26:00.000000000 +0200 @@ -36,7 +36,7 @@ { Q_OBJECT public: - KCHMViewWindow_KHTMLPart( QTabWidget * parent ); + KCHMViewWindow_KHTMLPart( KCHMViewWindowTabs * parent ); ~KCHMViewWindow_KHTMLPart(); //! Open a page from current chm archive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/version.h new/kchmviewer-4.2/src/version.h --- old/kchmviewer-4.1/src/version.h 2009-07-20 05:36:32.000000000 +0200 +++ new/kchmviewer-4.2/src/version.h 2009-10-25 00:22:11.000000000 +0200 @@ -23,6 +23,6 @@ #define INCLUDE_VERSION_H #define APP_NAME "kchmviewer" -#define APP_VERSION "4.1" +#define APP_VERSION "4.2" #endif /* INCLUDE_VERSION_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kchmviewer-4.1/src/window_browser.ui new/kchmviewer-4.2/src/window_browser.ui --- old/kchmviewer-4.1/src/window_browser.ui 2007-08-29 10:05:10.000000000 +0200 +++ new/kchmviewer-4.2/src/window_browser.ui 2009-10-25 02:26:00.000000000 +0200 @@ -1,4 +1,5 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <comment>********************************************************************* ** ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved. @@ -22,8 +23,8 @@ ** *********************************************************************</comment> <class>TabbedBrowser</class> - <widget class="QWidget" name="TabbedBrowser" > - <property name="geometry" > + <widget class="QWidget" name="TabbedBrowser"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> @@ -31,72 +32,51 @@ <height>664</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>TabbedBrowser</string> </property> - <layout class="QVBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > - <number>0</number> - </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QTabWidget" name="tabWidget" > - <widget class="QWidget" name="frontpage" > - <attribute name="title" > - <string>Untitled</string> - </attribute> - <layout class="QGridLayout" > - <property name="margin" > - <number>8</number> - </property> - <property name="spacing" > - <number>6</number> - </property> - </layout> - </widget> - </widget> + <layout class="QVBoxLayout" name="verticalLayout"/> </item> <item> - <widget class="QFrame" name="frameFind" > - <property name="frameShape" > + <widget class="QFrame" name="frameFind"> + <property name="frameShape"> <enum>QFrame::StyledPanel</enum> </property> - <property name="frameShadow" > + <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> - <layout class="QHBoxLayout" > - <property name="margin" > - <number>0</number> - </property> - <property name="spacing" > + <layout class="QHBoxLayout"> + <property name="spacing"> <number>6</number> </property> + <property name="margin"> + <number>0</number> + </property> <item> - <widget class="QToolButton" name="toolClose" > - <property name="text" > + <widget class="QToolButton" name="toolClose"> + <property name="text"> <string/> </property> - <property name="icon" > - <iconset resource="resources/images.qrc" >:/images/find_close.png</iconset> + <property name="icon"> + <iconset resource="resources/images.qrc"> + <normaloff>:/images/find_close.png</normaloff>:/images/find_close.png</iconset> </property> - <property name="autoRaise" > + <property name="autoRaise"> <bool>true</bool> </property> </widget> </item> <item> - <widget class="QLineEdit" name="editFind" > - <property name="sizePolicy" > - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> + <widget class="QLineEdit" name="editFind"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>150</width> <height>0</height> @@ -105,94 +85,96 @@ </widget> </item> <item> - <widget class="QToolButton" name="toolPrevious" > - <property name="text" > + <widget class="QToolButton" name="toolPrevious"> + <property name="text"> <string>Previous</string> </property> - <property name="icon" > - <iconset resource="resources/images.qrc" >:/images/find_previous.png</iconset> + <property name="icon"> + <iconset resource="resources/images.qrc"> + <normaloff>:/images/find_previous.png</normaloff>:/images/find_previous.png</iconset> </property> - <property name="toolButtonStyle" > + <property name="toolButtonStyle"> <enum>Qt::ToolButtonTextBesideIcon</enum> </property> - <property name="autoRaise" > + <property name="autoRaise"> <bool>true</bool> </property> </widget> </item> <item> - <widget class="QToolButton" name="toolNext" > - <property name="minimumSize" > + <widget class="QToolButton" name="toolNext"> + <property name="minimumSize"> <size> <width>0</width> <height>0</height> </size> </property> - <property name="text" > + <property name="text"> <string>Next</string> </property> - <property name="icon" > - <iconset resource="resources/images.qrc" >:/images/find_next.png</iconset> + <property name="icon"> + <iconset resource="resources/images.qrc"> + <normaloff>:/images/find_next.png</normaloff>:/images/find_next.png</iconset> </property> - <property name="toolButtonStyle" > + <property name="toolButtonStyle"> <enum>Qt::ToolButtonTextBesideIcon</enum> </property> - <property name="autoRaise" > + <property name="autoRaise"> <bool>true</bool> </property> - <property name="arrowType" > + <property name="arrowType"> <enum>Qt::NoArrow</enum> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkCase" > - <property name="text" > + <widget class="QCheckBox" name="checkCase"> + <property name="text"> <string>Case Sensitive</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="checkWholeWords" > - <property name="text" > + <widget class="QCheckBox" name="checkWholeWords"> + <property name="text"> <string>Whole words</string> </property> </widget> </item> <item> - <widget class="QLabel" name="labelWrapped" > - <property name="minimumSize" > + <widget class="QLabel" name="labelWrapped"> + <property name="minimumSize"> <size> <width>0</width> <height>20</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>1050</width> <height>20</height> </size> </property> - <property name="text" > - <string><img src=":/images/find_wrap.png"> Search wrapped</string> + <property name="text"> + <string><img src=":/images/find_wrap.png"> Search wrapped</string> </property> - <property name="textFormat" > + <property name="textFormat"> <enum>Qt::RichText</enum> </property> - <property name="scaledContents" > + <property name="scaledContents"> <bool>true</bool> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> </widget> </item> <item> <spacer> - <property name="orientation" > + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0"> <size> <width>81</width> <height>21</height> @@ -206,7 +188,7 @@ </layout> </widget> <resources> - <include location="resources/images.qrc" /> + <include location="resources/images.qrc"/> </resources> <connections/> </ui> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org