aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/objects/class_progressbar.cpp
Commit message (Expand)AuthorAgeFilesLines
* updates FSF address, thanks to Kebianizao for noticing•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3200 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Markus Rennings2009-05-081-1/+1
* Fixed macro name convention and listview doc•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3001 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2009-01-161-6/+6
* hopefully removed all the remaining noisy messages from gcc•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2841 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Fabio Bas2008-11-081-7/+7
* more works on objects module (locale stuff+some fixes+code clean)•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2742 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2008-10-161-20/+24
* fixed license template for modules from n to r•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2484 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Elvio Basello2008-09-181-3/+5
* QT4 new stuff and ftp/http(wip) new classes (lack of docs :\) •••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2441 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2008-09-121-12/+12
* ported KVS progressbar (completed), popupmenu (wip)•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1491 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2008-04-161-37/+28
* QT4 port: QIconSet (completed), objects module (w.i.p.), code clean.•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1480 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2008-04-141-1/+1
* More QT4 work and removed QT3 unused code in objects module. •••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1294 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2008-03-261-13/+4
* More Qt4 tweaks•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@439 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Szymon Tomasz Stefanek2007-03-281-1/+1
* objects module QT4 porting (wip)•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@384 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2007-02-271-11/+23
* added new buttongroup classes,dcc.setBandwidthLimit; fixed/removed some old c...•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@234 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Noldor2007-01-231-4/+4
* Switching from cvs to svn, initial import•••git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@14 17fca916-40b9-46aa-a4ea-0a15b648b75c Gravatar Szymon Tomasz Stefanek2006-12-181-0/+150
D20; background-color: #FFF0F0 } /* Literal.String.Single */ .highlight .ss { color: #A60; background-color: #FFF0F0 } /* Literal.String.Symbol */ .highlight .bp { color: #038 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #06B; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #369 } /* Name.Variable.Class */ .highlight .vg { color: #D70 } /* Name.Variable.Global */ .highlight .vi { color: #33B } /* Name.Variable.Instance */ .highlight .vm { color: #369 } /* Name.Variable.Magic */ .highlight .il { color: #00D; font-weight: bold } /* Literal.Number.Integer.Long */
//=============================================================================
//
//   File : KvsObject_textBrowser.cpp
//   Creation date : Fri Mar 18 14:30:48 CEST 2005
//   by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor)
//
//   This file is part of the KVIrc IRC client distribution
//   Copyright (C) 2005-2008 Alessandro Carbone (elfonol at gmail dot 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 2
//   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, write to the Free Software Foundation,
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "KvsObject_textBrowser.h"
#include "KviError.h"
#include "kvi_debug.h"
#include "KviLocale.h"
#include "KviIconManager.h"

#include <QTextBrowser>
#include <QFile>
#include <QUrl>
/*
	@doc: textBrowser
	@keyterms:
		textBrowser browser widget class,
	@title:
		textBrowser class
	@type:
		class
	@short:
		Provides a class that can display HTML pages.
	@inherits:
		[class]widget[/class]
	@description:
		Provides a class that can display HTML pages with hypertext navigation.
	@functions:
		!fn: $setSource(<file_name:string>)
		With this you can display the page at szFile location (szFile include the path).
		!fn: $backward()
		Changes the document displayed to the previous document in the list of documents built by navigating links.
		!fn: $forward()
		Changes the document displayed to the next document in the list of documents built by navigating links.
		!fn: $home()
		Changes the document displayed to be the first document the browser displayed.
		!fn: $reload()
		Reloads the current set source.
		!fn: $linkClickedEvent(<link_href:string>)
		Triggered when a link is clicked by the user. The default implementation of this function
		emits the "linkClicked" signal.
	@signals:
		!sg: $linkClicked(<link_href:string>)
		This signal is emitted by the default implementation of the [classfnc]$linkClickedEvent[/classfnc]() function.
*/

KVSO_BEGIN_REGISTERCLASS(KvsObject_textBrowser, "textBrowser", "multilineedit")
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_textBrowser, setSource)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_textBrowser, forward)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_textBrowser, backward)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_textBrowser, home)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_textBrowser, reload)
KVSO_REGISTER_HANDLER_BY_NAME(KvsObject_textBrowser, linkClickedEvent)
KVSO_END_REGISTERCLASS(KvsObject_textBrowser)

KVSO_BEGIN_CONSTRUCTOR(KvsObject_textBrowser, KvsObject_textedit)

KVSO_END_CONSTRUCTOR(KvsObject_textBrowser)

KVSO_BEGIN_DESTRUCTOR(KvsObject_textBrowser)

KVSO_END_CONSTRUCTOR(KvsObject_textBrowser)

bool KvsObject_textBrowser::init(KviKvsRunTimeContext *, KviKvsVariantList *)
{
	SET_OBJECT(QTextBrowser);
	connect(obj, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(anchorClicked(const QUrl &)));
	return true;
}

KVSO_CLASS_FUNCTION(textBrowser, setSource)
{
	CHECK_INTERNAL_POINTER(widget())
	QString szFile;
	KVSO_PARAMETERS_BEGIN(c)
	KVSO_PARAMETER("file_name", KVS_PT_STRING, 0, szFile)
	KVSO_PARAMETERS_END(c)
	if(!QFile::exists(szFile))
	{
		c->warning(__tr2qs_ctx("I can't find the specified file '%Q'.", "objects"), &szFile);
		return true;
	}
	QUrl url;
	url.setPath(szFile);
	((QTextBrowser *)widget())->setSource(url);
	return true;
}

KVSO_CLASS_FUNCTION(textBrowser, forward)
{
	CHECK_INTERNAL_POINTER(widget())
	((QTextBrowser *)widget())->forward();
	return true;
}

KVSO_CLASS_FUNCTION(textBrowser, backward)
{
	CHECK_INTERNAL_POINTER(widget())
	((QTextBrowser *)widget())->backward();
	return true;
}

KVSO_CLASS_FUNCTION(textBrowser, home)
{
	CHECK_INTERNAL_POINTER(widget())
	((QTextBrowser *)widget())->home();
	return true;
}

KVSO_CLASS_FUNCTION(textBrowser, reload)
{
	CHECK_INTERNAL_POINTER(widget())
	((QTextBrowser *)widget())->reload();
	return true;
}

void KvsObject_textBrowser::anchorClicked(const QUrl & url)
{
	KviKvsVariantList parms(new KviKvsVariant(url.path()));
	callFunction(this, "linkClickedEvent", nullptr, &parms);
}

KVSO_CLASS_FUNCTION(textBrowser, linkClickedEvent)
{
	emitSignal("linkClicked", c, c->params());
	return true;
}