+++ /dev/null
-Installation :
---------------
- 1. Ctrl-Alt-M to open the addon manager
- 2. Click on "Install an addon"
- 3. Choose the file "install.kvs" where unzipped the addon
- 4. Then it should be installed, and configurable using the "Configuration" button
# register the script: this must be the first instruction executed
# since it will abort with an error when a greater version is already installed
-addon.register("newsticker","1.2.0",$tr("Newsticker: The RSS News Reader","newsticker"),$tr("Displays RSS news feeds from various sources","newsticker"),"3.2.0.99.20051230",newsticker_32.png)
+addon.register(
+ "newsticker",
+ "1.2.0",
+ $tr("Newsticker: The RSS News Reader","newsticker"),
+ $tr("Displays RSS news feeds from various sources","newsticker"),
+ "4.0.4",
+ newsticker_32.png
+ )
{
# This is our uninstall callback: it will be called by KVIrc when addon.uninstall is invoked
- newsticker::core::uninstall
+ # The stuff should be destroyed in reverse order, if possible.
+
+ # Close any running instance
+ newsticker::close
+
+ # Kill aliases
+ alias("newsticker::close"){}
+ alias("newsticker::show"){}
+
+ # Kill actions
+ action.destroy "newsticker::toggle";
+
+ # Kill classes (reversed order)
+ objects.killClass -q "newsticker::window"
+ objects.killClass -q "newsticker::configuration"
+ objects.killClass -q "newsticker::controller"
+ objects.killClass -q "newsticker::qtwrapper"
+ objects.killClass -q "newsticker::source"
+ objects.killClass -q "newsticker::rss::reader"
+ objects.killClass -q "newsticker::rss::entrylist"
+ objects.killClass -q "newsticker::rss::entry"
}
addon.setconfigurecallback(newsticker)
# Ok, addon.register succeeded. We can go on with the installation.
# get the installer helper class (this is pretty standard and included in the distro)
-include "utils/installer.kvs"
# Get the path that this script was launched from
%mypath = $file.extractPath($0)
//%mypath = $str.lefttolast($0,/)
-# The installer will copy our files and generate automatically
-# an uninstallation alias for them
-%installer = $new(installer,0,myinstaller)
-# copy files in each subdirectory
-# the pics
-%installer->$copyFiles("%mypath/pics/","*.png",$file.localdir("pics"))
-# the translations
-#%installer->$copyFiles("%mypath/locale/","*.mo",$file.localdir("locale"))
-# the documentation
-#%installer->$copyFiles("%mypath/help/en/newsticker/","*.html",$file.localdir("help/en/newsticker"))
-# parse source files
-%installer->$includeFiles("%mypath/src/","*.kvs")
-# then generate the uninstall alias
-%installer->$generateUninstallAlias("newsticker::core::uninstall")
-# finally kill the installer helper
-delete %installer
-
-# fetch the complete script
-//include "src/main.kvs"
+addon.copyfiles "newsticker" "pics" "%mypath/pics/*.png"
+addon.copyfiles "newsticker" "locale" "%mypath/locale/*.mo"
+addon.copyfiles "newsticker" "help" "%mypath/help/en/newsticker/*.html"
+
+parse "%mypath/src/rssentry.kvs"
+parse "%mypath/src/rssentrylist.kvs"
+parse "%mypath/src/rssreader.kvs"
+parse "%mypath/src/source.kvs"
+parse "%mypath/src/qtwrapper.kvs"
+parse "%mypath/src/configuration.kvs"
+parse "%mypath/src/controller.kvs"
+parse "%mypath/src/window.kvs"
+
+parse "%mypath/src/aliases.kvs"
+parse "%mypath/src/actions.kvs"
# make sure any previous instance is closed
newsticker::close
+
# show it up :)
newsticker::show
+++ /dev/null
-#!/bin/bash
-
-# Version of the script
-version="1.1.0"
-
-# Choose the file types you want to include
-filetypes='*.kvs *.png *.po'
-
-#################################################3
-
-test ! -f install.kvs && echo Bad directory && exit
-
-test -z "$(grep '"'$version'"' install.kvs)" && echo "Wrong version ($version)" && exit
-
-dir=$(pwd)
-name=$(basename $dir)-$version
-
-\rm -rf $name*
-mkdir $name
-for file in INSTALL README AUTHORS FAQ ; do
- test -f $file && cp $file $name
-done
-
-for itype in $(seq 1 $(echo $filetypes | wc -w)) ; do
- for file in $(find . -name "$(echo "$filetypes" | cut -d" " -f$itype)" -print) ; do
- dir=$name/$(dirname $file| cut -c3-)
- mkdir -p $dir
- cp -f $file $dir
- done
-done
-
-zip -r $name.zip $name
-\rm -r $name
-
-
-action.create -t="tools" (newsticker::toggle,$tr("Show Newsticker","newsticker"),$tr("Shows the Newsticker Window","newsticker"),"newsticker_32.png","newsticker_16.png")
+action.create -t="tools" (
+ "newsticker::toggle",
+ $tr("Show Newsticker","newsticker"),
+ $tr("Shows the Newsticker Window","newsticker"),
+ "newsticker_32.png",
+ "newsticker_16.png"
+ )
{
newsticker::show
}
{
constructor()
{
- if ($str.contains($features(),"QT4"))@$setWindowTitle($tr("Edit source","newsticker"))
- else @$setWindowTitle($tr("Edit source","newsticker"))
+ if ($str.contains($features(),"QT4"))
+ @$setWindowTitle($tr("Edit source","newsticker"))
+ else
+ @$setWindowTitle($tr("Edit source","newsticker"))
%l = $new(layout,$this)
%lb = $new(label,$this)
{
constructor()
{
- if ($str.contains($features(),"QT4")) {@%qt4=$true;@%idx=0;}
- else @%qt4=$false
+ if ($str.contains($features(),"QT4"))
+ {@%qt4=$true;@%idx=0;}
+ else
+ @%qt4=$false
}
selectedItem()
+++ /dev/null
-/*
- A helper class for installing and parsing files,
- and generating an uninstallation alias on the fly.
-
- Example :
- include "utils/installer.kvs"
- %installer = $new(installer,0,myinstaller)
- %installer->$copyFiles(pics,*.png,$file.localdir(pics))
- %installer->$includeFiles(src,*.kvs)
- %installer->generateUninstallAlias("foo::uninstall")
- delete %installer
-*/
-class(installer,object)
-{
- constructor()
- {
- }
-
- copyFiles($0 = source dir,$1 = file regexp,$2 = target dir)
- {
- if(!$file.exists($0))return
- if($isempty($0))
- {
- echo "[Installer] SCRIPT BUG: The first argument to installer_copyfiles must be a source directory"
- halt
- }
-
- if($isempty($1))
- {
- echo "[Installer] SCRIPT BUG: The second argument to installer_copyfiles must be a file name or file regexp"
- halt
- }
-
- if($isempty($2))
- {
- echo "[Installer] SCRIPT BUG: The third argument to installer_copyfiles must be a destination directory"
- halt
- }
-
- if($file.exists($0))
- {
- %files = $file.ls($file.fixpath($0),f,$1)
- if($length(%files))
- {
- file.mkdir $2
- foreach(%file,%files)
- {
- $this->%lFiles <+ $str.replace($file.fixpath("$2/%file"),"\\","\\\\")
- file.copy -o $file.fixpath($0/%file) $file.fixpath($2/%file)
- }
- }
- }
- }
-
- // warning: this function includes files in a substantially random order
- includeFiles($0 = dir, $1 = file regexp)
- {
- if($isempty($0) || !$file.exists($0))
- {
- echo "[Installer] SCRIPT BUG: The first argument to installer_includefiles must be a source directory"
- halt
- }
-
- if($1 == "")
- %szRe = "*.kvs"
- else
- %szRe = $1
-
- %files = $file.ls($file.fixpath($0),f,$1)
- if($length(%files))
- {
- foreach(%file,%files)
- {
- $this->%lSources <+ $str.replace($file.fixpath("$0/%file"),"\\","\\\\")
- include $file.fixpath("$0/%file")
- }
- }
- }
-
-
- generateUninstallAlias($0 = alias name)
- {
- %c = "alias($0)$lf"
- %c .= "{$lf"
- if($isset($this->%lFiles))
- {
- foreach(%file,$this->%lFiles)
- {
- %file =~ s/"^$file.localdir()/(.*)$"/"\$file.localdir(\\1)"/
- %c .= " file.remove -q \"%file\"$lf";
- }
- }
- if($isset($this->%lSources))
- {
- foreach(%file,$this->%lSources){
- foreach(%line,$file.readlines(%file))
- if(!$str.isempty(%line)){
- if($str.match("event(*)",%line,e))
- %c .= " event -q ("$str.token(1,"()",%line)"){}$lf"
- else if($str.match("alias(*)",%line,e))
- %aliases<+$str.token(1,"()",%line)
- else if($str.match("defpopup(*)",%line,e))
- %c .= " defpopup("$str.token(1,"()",%line)"){}$lf"
- else if($str.match("toolbar.create * *",%line,e))
- %c .= " toolbar.destroy -q "$str.word(1,%line)"$lf"
- else if($str.match("action.create* (*)",%line,e))
- %c .= " action.destroy -q "$str.replace($str.token(1,"(,)",%line),\",)"$lf"
- else if($str.match("class(*)*",%line,e))
- %c .= " objects.killclass -q "$str.token(1,"(,)",%line)"$lf"
- }
- }
- if($isset(%aliases))
- foreach(%alias,%aliases)
- %c .= " alias -q (%alias){}$lf"
- %c .= " alias -q ($0){}$lf"
- }
- %c .= "}"
- eval %c
- }
-}
-
-
-