diff options
| author | 2006-12-18 01:34:15 +0000 | |
|---|---|---|
| committer | 2006-12-18 01:34:15 +0000 | |
| commit | c75b9f00eaeee4b8503ba662b3d7ccc9e1914096 (patch) | |
| tree | a5e7ee244fa4124588a114732c4ecbc248c7c199 /src/modules/addon | |
| parent | Switching from cvs to svn, initial import (diff) | |
| download | KVIrc-c75b9f00eaeee4b8503ba662b3d7ccc9e1914096.tar.gz KVIrc-c75b9f00eaeee4b8503ba662b3d7ccc9e1914096.tar.bz2 KVIrc-c75b9f00eaeee4b8503ba662b3d7ccc9e1914096.zip | |
Switching from cvs to svn, initial import
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@14 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/addon')
| -rw-r--r-- | src/modules/addon/.svnignore | 11 | ||||
| -rw-r--r-- | src/modules/addon/Makefile.am | 22 | ||||
| -rw-r--r-- | src/modules/addon/addon.vcproj | 165 | ||||
| -rw-r--r-- | src/modules/addon/addon_vc05.vcproj | 260 | ||||
| -rw-r--r-- | src/modules/addon/kvaddon.dsw | 29 | ||||
| -rw-r--r-- | src/modules/addon/kviaddon.dsp | 147 | ||||
| -rw-r--r-- | src/modules/addon/libkviaddon.cpp | 658 | ||||
| -rw-r--r-- | src/modules/addon/managementdialog.cpp | 371 | ||||
| -rw-r--r-- | src/modules/addon/managementdialog.h | 105 | ||||
| -rw-r--r-- | src/modules/addon/pics/.svnignore | 6 | ||||
| -rw-r--r-- | src/modules/addon/pics/Makefile.am | 9 | ||||
| -rw-r--r-- | src/modules/addon/pics/kvi_dialog_addons.png | bin | 0 -> 191271 bytes |
12 files changed, 1783 insertions, 0 deletions
diff --git a/src/modules/addon/.svnignore b/src/modules/addon/.svnignore new file mode 100644 index 000000000..087a502ca --- /dev/null +++ b/src/modules/addon/.svnignore @@ -0,0 +1,11 @@ +Makefile.in +Makefile +.deps +*.o +*.lo +*.la +*.moc +.libs +.mospics +moc_*.cpp +.pics
\ No newline at end of file diff --git a/src/modules/addon/Makefile.am b/src/modules/addon/Makefile.am new file mode 100644 index 000000000..e232b8ffc --- /dev/null +++ b/src/modules/addon/Makefile.am @@ -0,0 +1,22 @@ +############################################################################### +# KVirc IRC client Makefile - 10.03.2000 Szymon Stefanek <stefanek@tin.it> +############################################################################### + +SUBDIRS = pics + +AM_CPPFLAGS = -I$(SS_TOPSRCDIR)/src/kvilib/include/ -I$(SS_TOPSRCDIR)/src/kvirc/include/ \ +$(SS_INCDIRS) $(SS_CPPFLAGS) -DGLOBAL_KVIRC_DIR=\"$(globalkvircdir)\" + +pluglib_LTLIBRARIES = libkviaddon.la + +libkviaddon_la_LDFLAGS = -module -avoid-version $(SS_LDFLAGS) $(SS_LIBDIRS) + +libkviaddon_la_SOURCES = libkviaddon.cpp managementdialog.cpp +nodist_libkviaddon_la_SOURCES = moc_managementdialog.cpp + +libkviaddon_la_LIBADD = $(SS_LIBLINK) ../../kvilib/build/libkvilib.la + +noinst_HEADERS= managementdialog.h + +moc_managementdialog.cpp: managementdialog.h + $(SS_QT_MOC) $< -o $@ diff --git a/src/modules/addon/addon.vcproj b/src/modules/addon/addon.vcproj new file mode 100644 index 000000000..997b04296 --- /dev/null +++ b/src/modules/addon/addon.vcproj @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="addon" + ProjectGUID="{E666CE2F-5F24-407C-86B3-DB55C252FF78}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules" + IntermediateDirectory="Debug" + ConfigurationType="2" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvilib\config";"$(QTDIR)\include";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\file"" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ADDON_EXPORTS" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="4"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="qt-mtnc321.lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin"" + IgnoreAllDefaultLibraries="TRUE" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/addon.pdb" + SubSystem="2" + ImportLibrary="$(OutDir)/addon.lib" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules" + IntermediateDirectory="Release" + ConfigurationType="2" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvilib\config";"$(QTDIR)\include";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\file"" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ADDON_EXPORTS" + RuntimeLibrary="0" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="qt-mtnc321.lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin"" + IgnoreAllDefaultLibraries="TRUE" + GenerateDebugInformation="TRUE" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + ImportLibrary="$(OutDir)/addon.lib" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + <File + RelativePath=".\libkviaddon.cpp"> + </File> + <File + RelativePath=".\managementdialog.cpp"> + </File> + <File + RelativePath=".\moc_managementdialog.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + <File + RelativePath=".\managementdialog.h"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"" + Outputs="$(InputDir)\moc_$(InputName).cpp"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"" + Outputs="$(InputDir)\moc_$(InputName).cpp"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/src/modules/addon/addon_vc05.vcproj b/src/modules/addon/addon_vc05.vcproj new file mode 100644 index 000000000..c7ac25f1e --- /dev/null +++ b/src/modules/addon/addon_vc05.vcproj @@ -0,0 +1,260 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="addon" + ProjectGUID="{E666CE2F-5F24-407C-86B3-DB55C252FF78}" + RootNamespace="addon" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules\" + IntermediateDirectory="Debug" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvilib\config";"$(QTDIR)\include";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\file"" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ADDON_EXPORTS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="qt-$(QTTAG).lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib perl58.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)"" + GenerateManifest="true" + IgnoreAllDefaultLibraries="true" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/addon.pdb" + SubSystem="2" + TurnOffAssemblyGeneration="true" + ImportLibrary="$(OutDir)/addon.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + EmbedManifest="true" + VerboseOutput="true" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules" + IntermediateDirectory="Release" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="1" + InlineFunctionExpansion="2" + EnableIntrinsicFunctions="true" + FavorSizeOrSpeed="2" + OmitFramePointers="true" + EnableFiberSafeOptimizations="true" + WholeProgramOptimization="true" + AdditionalIncludeDirectories=""$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvilib\config";"$(QTDIR)\include";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\file"" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ADDON_EXPORTS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + MinimalRebuild="true" + ExceptionHandling="1" + RuntimeLibrary="0" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="qt-$(QTTAG).lib qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib perl58.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)"" + GenerateManifest="true" + IgnoreAllDefaultLibraries="true" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + LinkTimeCodeGeneration="1" + TurnOffAssemblyGeneration="true" + ImportLibrary="$(OutDir)/addon.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + EmbedManifest="true" + VerboseOutput="true" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\libkviaddon.cpp" + > + </File> + <File + RelativePath=".\managementdialog.cpp" + > + </File> + <File + RelativePath=".\moc_managementdialog.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\managementdialog.h" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"
" + Outputs="$(InputDir)\moc_$(InputName).cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -o "$(InputDir)\moc_$(InputName).cpp" "$(InputDir)\$(InputFileName)"
" + Outputs="$(InputDir)\moc_$(InputName).cpp" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/src/modules/addon/kvaddon.dsw b/src/modules/addon/kvaddon.dsw new file mode 100644 index 000000000..770c8f9ca --- /dev/null +++ b/src/modules/addon/kvaddon.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "kviaddon"=.\kviaddon.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/src/modules/addon/kviaddon.dsp b/src/modules/addon/kviaddon.dsp new file mode 100644 index 000000000..a5c8de6e4 --- /dev/null +++ b/src/modules/addon/kviaddon.dsp @@ -0,0 +1,147 @@ +# Microsoft Developer Studio Project File - Name="kviaddon" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=kviaddon - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "kviaddon.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "kviaddon.mak" CFG="kviaddon - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "kviaddon - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "kviaddon - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "kviaddon - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "kviaddon_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "$(QTDIR)\include" /I "..\..\kvilib\tal" /I "..\..\kvilib\system" /I "..\..\kvilib\irc" /I "..\..\kvilib\file" /I "..\..\kvilib\ext" /I "..\..\kvilib\net" /I "..\..\kvilib\core\wstring" /I "..\..\kvilib\core" /I "..\..\kvilib\config" /I "..\..\kvirc\kvs" /I "..\..\kvirc\module" /I "..\..\kvirc\uparser\scripttoolbar" /I "..\..\kvirc\uparser" /I "..\..\kvirc\sparser" /I "..\..\kvirc\kernel" /I "..\..\kvirc\ui" /I "C:\ssl" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "kviscript_EXPORTS" /D "QT_DLL" /D "QT_THREAD_SUPPORT" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 $(QTDIR)\lib\qt-mtnc321.lib $(QTDIR)\lib\qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib winmm.lib user32.lib gdi32.lib comdlg32.lib uuid.lib ole32.lib shell32.lib /nologo /dll /machine:I386 /out:"..\..\..\win32build\bin\modules\kviaddon.dll" /libpath:"C:\OpenSSL\lib\VC" /libpath:"..\..\kvilib\Release" /libpath:"..\..\kvirc\Release" + +!ELSEIF "$(CFG)" == "kviaddon - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "kviaddon_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "_$(QTDIR)\include" /I "$(QTDIR)\include" /I "..\..\kvilib\tal" /I "..\..\kvilib\system" /I "..\..\kvilib\irc" /I "..\..\kvilib\file" /I "..\..\kvilib\ext" /I "..\..\kvilib\net" /I "..\..\kvilib\core\wstring" /I "..\..\kvilib\core" /I "..\..\kvilib\config" /I "..\..\kvirc\kvs" /I "..\..\kvirc\module" /I "..\..\kvirc\uparser\scripttoolbar" /I "..\..\kvirc\uparser" /I "..\..\kvirc\sparser" /I "..\..\kvirc\kernel" /I "..\..\kvirc\ui" /I "C:\ssl" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "kviaddon_EXPORTS" /D "QT_DLL" /D "QT_THREAD_SUPPORT" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 $(QTDIR)\lib\qt-mtnc321.lib $(QTDIR)\lib\qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib msvcrt.lib winmm.lib user32.lib gdi32.lib comdlg32.lib uuid.lib ole32.lib shell32.lib /nologo /dll /incremental:no /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\..\..\win32build\KviDebug\modules\kviscript.dll" /libpath:"C:\OpenSSL\lib\VC" /libpath:"..\..\kvilib\Debug" /libpath:"..\..\kvirc\Debug" +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "kviaddon - Win32 Release" +# Name "kviaddon - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\libkviaddon.cpp +# End Source File +# Begin Source File + +SOURCE=.\managementdialog.cpp +# End Source File +# Begin Source File + +SOURCE=.\moc_managementdialog.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\managementdialog.h + +!IF "$(CFG)" == "kviaddon - Win32 Release" + +# Begin Custom Build +InputDir=. +InputPath=.\managementdialog.h +InputName=managementdialog + +"$(InputDir)\moc_$(InputName).cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + %qtdir%\bin\moc.exe $(InputDir)\$(InputName).h -o $(InputDir)\moc_$(InputName).cpp + +# End Custom Build + +!ELSEIF "$(CFG)" == "kviaddon - Win32 Debug" + +# Begin Custom Build +InputDir=. +InputPath=.\managementdialog.h +InputName=managementdialog + +"$(InputDir)\moc_$(InputName).cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + %qtdir%\bin\moc.exe $(InputDir)\$(InputName).h -o $(InputDir)\moc_$(InputName).cpp + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/src/modules/addon/libkviaddon.cpp b/src/modules/addon/libkviaddon.cpp new file mode 100644 index 000000000..2dc34efab --- /dev/null +++ b/src/modules/addon/libkviaddon.cpp @@ -0,0 +1,658 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// File : libkviaddon.cpp +// Creation date : Tue 31 Mar 01:02:12 2005 GMT by Szymon Stefanek +// +// This toolbar is part of the KVirc irc client distribution +// Copyright (C) 2005 Szymon Stefanek (pragma at kvirc dot net) +// +// 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 opinion) 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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "kvi_module.h" +#include "kvi_kvs_scriptaddonmanager.h" +#include "kvi_locale.h" +#include "kvi_qstring.h" +#include "kvi_parameterlist.h" +#include "kvi_cmdformatter.h" +#include "kvi_qstring.h" +#include "kvi_error.h" +#include "kvi_out.h" +#include "kvi_iconmanager.h" +#include "kvi_mirccntrl.h" +#include "kvi_config.h" +#include "kvi_sourcesdate.h" + +#include "managementdialog.h" + + + +QRect g_rectManagementDialogGeometry(0,0,0,0); + +/* + @doc: addon.exists + @type: + function + @title: + $addon.exists + @short: + Checks if an addon is currently installed + @syntax: + <boolean> $addon.exists(<id:string>[,<version:string>]) + @description: + Returns 1 if the addon with the specified <id> is currently installed + and 0 otherwise. If <version> is specified then any addon with + a version lower than <version> is ignored (so you can effectively + check if a greater or equal version is present). +*/ + +static bool addon_kvs_fnc_exists(KviKvsModuleFunctionCall * c) +{ + QString szId; + QString szVersion; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("id",KVS_PT_NONEMPTYSTRING,0,szId) + KVSM_PARAMETER("version",KVS_PT_STRING,KVS_PF_OPTIONAL,szVersion) + KVSM_PARAMETERS_END(c) + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(szId); + if(a) + { + if(szVersion.isEmpty()) + { + c->returnValue()->setBoolean(true); + } else { + c->returnValue()->setBoolean(KviKvsScriptAddonManager::instance()->compareVersions(a->version(),szVersion) < 0); + } + } else { + c->returnValue()->setBoolean(false); + } + return true; +} + +/* + @doc: addon.version + @type: + function + @title: + $addon.version + @short: + Returns the version of an installed addon + @syntax: + <string> $addon.version(<id:string>) + @description: + Returns the version of the currently installed addon with the + specified <id>. If the addon with the given <id> does not exist + then an empty string is returned. +*/ + +static bool addon_kvs_fnc_version(KviKvsModuleFunctionCall * c) +{ + QString szId; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("id",KVS_PT_NONEMPTYSTRING,0,szId) + KVSM_PARAMETERS_END(c) + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(szId); + if(a) + { + c->returnValue()->setString(a->version()); + } else { + c->returnValue()->setNothing(); + } + return true; +} + +/* + @doc: addon.list + @type: + command + @title: + addon.list + @short: + Lists the installed addons + @syntax: + addon.list + @description: + Lists the currently installed addons + @seealso: + [cmd]addon.register[/cmd] +*/ + +static bool addon_kvs_cmd_list(KviKvsModuleCommandCall * c) +{ + QDict<KviKvsScriptAddon> * da = KviKvsScriptAddonManager::instance()->addonDict(); + + int cnt = 0; + QDictIterator<KviKvsScriptAddon> it(*da); + while(KviKvsScriptAddon * a = it.current()) + { + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("%cAddon id %Q, version %Q%c"),KVI_TEXT_BOLD,&(a->name()),&(a->version()),KVI_TEXT_BOLD); + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Name: %Q"),&(a->visibleName())); + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Description: %Q"),&(a->description())); + + ++it; + cnt++; + } + + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Total: %d addons installed"),cnt); + return true; +} + +/* + @doc: addon.uninstall + @type: + command + @title: + addon.uninstall + @short: + Uninstalls an addon + @syntax: + addon.uninstall [-q] [-n] <id:string> + @switches: + !sw: -n | --no-callback + Doesn't call the uninstall callback but only removes the + registration entry. + !sw: -q | --quiet + Makes the command run quietly + @description: + Uninstalls the specified addon by executing its uninstall callback function. + It also removes the addon's registration entry. + If the -n switch is specified the the uninstall callback is not called, + only the registration entry is removed. + @seealso: + [cmd]addon.register[/cmd] +*/ + +static bool addon_kvs_cmd_uninstall(KviKvsModuleCommandCall * c) +{ + QString szName; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("name",KVS_PT_NONEMPTYSTRING,0,szName) + KVSM_PARAMETERS_END(c) + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(szName); + if(a) + { + if(!c->switches()->find('q',"quiet")) + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Uninstalling existing addon version %Q"),&(a->version())); + + // uninstall the existing version + KviKvsScriptAddonManager::instance()->unregisterAddon(szName,c->window(),!c->switches()->find('n',"no-callback")); + } else { + if(!c->switches()->find('q',"quiet")) + c->warning(__tr2qs("The addon \"%1\" does not exist").arg(szName)); + } + + return true; +} + +/* + @doc: addon.configure + @type: + command + @title: + addon.configure + @short: + Executes a addon's configuration callback + @syntax: + addon.configure [-q] <id:string> + @switches: + !sw: -q | --quiet + Makes the command run quietly + @description: + Executes the configuration callback of the specified addon. + @seealso: + [cmd]addon.register[/cmd] + [cmd]addon.setconfigurecallback[/cmd] +*/ + +static bool addon_kvs_cmd_configure(KviKvsModuleCommandCall * c) +{ + QString szName; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("name",KVS_PT_NONEMPTYSTRING,0,szName) + KVSM_PARAMETERS_END(c) + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(szName); + if(a) + { + QString ss = a->configureCallbackCode(); + if(ss.isEmpty()) + { + if(!c->switches()->find('q',"quiet")) + c->warning(__tr2qs("The addon \"%1\" has no configure callback set").arg(szName)); + } else { + a->executeConfigureCallback(c->window()); + } + } else { + if(!c->switches()->find('q',"quiet")) + c->warning(__tr2qs("The addon \"%1\" does not exist").arg(szName)); + } + + return true; +} + +/* + @doc: addon.help + @type: + command + @title: + addon.help + @short: + Executes a addon's help callback + @syntax: + addon.help [-q] <id:string> + @switches: + !sw: -q | --quiet + Makes the command run quietly + @description: + Executes the help callback of the specified addon. + It will usually display the addon's documentation in the help viewer. + @seealso: + [cmd]addon.register[/cmd] + [cmd]addon.sethelpcallback[/cmd] +*/ + +static bool addon_kvs_cmd_help(KviKvsModuleCommandCall * c) +{ + QString szName; + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("name",KVS_PT_NONEMPTYSTRING,0,szName) + KVSM_PARAMETERS_END(c) + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(szName); + if(a) + { + QString ss = a->helpCallbackCode(); + if(ss.isEmpty()) + { + if(!c->switches()->find('q',"quiet")) + c->warning(__tr2qs("The addon \"%1\" has no help callback set").arg(szName)); + } else { + a->executeHelpCallback(c->window()); + } + } else { + if(!c->switches()->find('q',"quiet")) + c->warning(__tr2qs("The addon \"%1\" does not exist").arg(szName)); + } + + return true; +} + +/* + @doc: addon.setconfigurecallback + @type: + command + @title: + addon.setconfigurecallback + @short: + Sets a addon's configuration callback + @syntax: + addon.setconfigurecallback [-q] (<id:string>) + { + <configure_callback> + } + @switches: + !sw: -q + Makes the command run quietly + @description: + Sets the configure callback for the specified addon. + The configure callback will be called by the user either by the + means of [cmd]addon.configure[/cmd] or by accessing the + proper function via GUI. + @seealso: + [cmd]addon.register[/cmd] + [cmd]addon.configure[/cmd] +*/ + +static bool addon_kvs_cmd_setconfigurecallback(KviKvsModuleCallbackCommandCall * c) +{ + QString szName; + + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("name",KVS_PT_NONEMPTYSTRING,0,szName) + KVSM_PARAMETERS_END(c) + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(szName); + if(a) + { + a->setConfigureCallback(c->callback()->code()); + } else { + if(!c->switches()->find('q',"quiet")) + c->warning(__tr2qs("The addon \"%1\" does not exist").arg(szName)); + } + + return true; +} + +/* + @doc: addon.sethelpcallback + @type: + command + @title: + addon.sethelpcallback + @short: + Sets a addon's configuration callback + @syntax: + addon.sethelpcallback(<id:string>) + { + <configure_callback> + } + @switches: + !sw: -q + Makes the command run quietly + @description: + Sets the help callback for the specified addon. + The help callback will be called by the user either by the + means of [cmd]addon.help[/cmd] or by accessing the + proper function via GUI. It should display some sort + of addon documentation, usually in the help browser. + @seealso: + [cmd]addon.register[/cmd] + [cmd]addon.help[/cmd] +*/ + +static bool addon_kvs_cmd_sethelpcallback(KviKvsModuleCallbackCommandCall * c) +{ + QString szName; + + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("name",KVS_PT_NONEMPTYSTRING,0,szName) + KVSM_PARAMETERS_END(c) + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(szName); + if(a) + { + a->setHelpCallback(c->callback()->code()); + } else { + if(!c->switches()->find('q',"quiet")) + c->warning(__tr2qs("The addon \"%1\" does not exist").arg(szName)); + } + + return true; +} + +/* + @doc: addon.register + @type: + command + @title: + addon.register + @short: + Registers a script-based addon + @syntax: + addon.register [-f] [-n] [-q] (<id:string>,<version:string>,<visible_name:string>,<description:string>,<minkvircverion:string>[,<iconid:string>]) + { + <uninstall callback> + } + @switches: + !sw: -f | --force + Registers the addon even if an addon with the same <id> and + a higher version already exists. The usage of this flag + is highly discouraged (i.e. use it only for debugging purposes + on your own machine). + !sw: -n | --no-uninstall + Performs no uninstallation of existing versions of the addon: + it simply replaces the registration entry with the new data. + Again, do NOT use this switch if not for debugging purposes + and on your own machine. + !sw: -q | --quiet + Makes the command run quietly + @description: + [p] + Registers a script-based addon. + [/p] + [p] + The registration process allows to "show" the addon in the script-addon manager + dialog and provides a standard way for the user to manage and uninstall the addons. + You simply register your addon BEFORE attempting to install it. + [/p] + [p] + A script-based addon is a set of scripts, icons, translations and possibly + other data files that add functionality to the KVIrc program. + The script-based addons are often simply called "scripts" and + we will adhere to that naming in certain parts of the documentation too. + [/p] + [p] + Each script-based addon (a set of scripts) is identified by an UNIQUE + <id>. Two addons with the same <id> can't co-exist in the same + KVIrc installation (so be sure to choose a token characteristic enough + to avoid collisions with others). The <id> itself is used only for + identification purposes and the user will almost always see the <visible_name> + instead, which can contain the [fnc]$tr[/fnc] function that will handle + the translation for it. + [/p] + [p] + Each addon has also a <version> which is a string in the form x.y.z + where x, y and z are numbers (yes.. that's the standard major-minor-patch level + version numbering scheme). A <version> of 2.4.23 is greater than 2.4.3 + even if 2.4.3 comes after when compared as a string. + When an addon with a greater or equal version is installed over + an addon with a lower version, the lower one gets uninstalled first. + Installing a lower version over a greater one is not possible, unless + the lower versioned one is uninstalled first. + [/p] + [p] + <description> is another, possibly translated, string that will + be presented to the user in the addon management dialog. + [/p] + [p] + <minkvircversion> is the minimum KVIrc version required for the + addon to run. If the version of the running KVIrc executable + is lower than the requested one then the command will abort with an error. + If you want to completly ignore the KVIrc versioning (don't do it), + use "0.0.0" here. If you need fine tuning on cvs features you may add also + the sources date tag at the end of the required version string (e.g 3.2.1.20060303). + [/p] + [p] + <iconid> is the [doc:image_id]image identifier[/doc] of the icon + that will be displayed in the addon management dialog. + If not specified, a default icon will be used. + [/p] + [p] + The <uninstall_callback> is a snippet of code that should + wipe out the addon from the system. It is ALWAYS a good practice + to write a complete uninstallation procedure (think that YOU like + to be able to completly uninstall a program that you don't use anymore). + The <uninstall_callback> will be called by KVIrc when the addon + uninstallation is requested, either explicitly by using the GUI or the + command [cmd]addon.uninstall[/cmd], or implicitly by installing + a newer version of the addon (upgrading). + [/p] + [p] + If the user security rules don't allow your addon to be installed + or a higher version of a addon with the same name already exists + the command will fail with an error (aborting your whole intallation addon). + If you don't want to fail with an error but handle it gracefully instead + then you should use [fnc]$addon.exists()[/fnc] to check if a + addon with the same name and a greater version already exists. + You can't gracefully handle security error conditions: your installation + will be always aborted with an error in this case. + [/p] + [p] + The addon can also have a configuration callback settable with [cmd]addon.setconfigurecallback[/cmd] + and a help callback settable with [cmd]addon.sethelpcallback[/cmd]. The first + will usually display a configuration dialog, the second will display + some sort of addon's documentation, usually in the help browser. + [/p] + [p] + The registration process uninstalls any previous addon version + by executing its uninstall callback routine. This is another reason for that + you should call addon.register BEFORE you attempt to install your addon. + Failing to do that may cause your old uninstalled to wipe out your newly + installed files or code. + [/p] + @seealso: + [cmd]addon.uninstall[/cmd], [fnc]$addon.exists()[/fnc], + [cmd]addon.setconfigurecallback[/cmd], [cmd]addon.configure[/cmd], + [cmd]addon.sethelpcallback[/cmd], [cmd]addon.help[/cmd] + @examples: + [example] + + [/example] +*/ + +static bool addon_kvs_cmd_register(KviKvsModuleCallbackCommandCall * c) +{ + KviKvsScriptAddonRegistrationData rd; + QString szMinKVIrcVersion; + + KVSM_PARAMETERS_BEGIN(c) + KVSM_PARAMETER("name",KVS_PT_NONEMPTYSTRING,0,(rd.szName)) + KVSM_PARAMETER("version",KVS_PT_NONEMPTYSTRING,0,(rd.szVersion)) + KVSM_PARAMETER_IGNORED("visible_text") + KVSM_PARAMETER_IGNORED("description") + KVSM_PARAMETER("min_kvirc_version",KVS_PT_NONEMPTYSTRING,0,szMinKVIrcVersion) + KVSM_PARAMETER("icon_id",KVS_PT_STRING,KVS_PF_OPTIONAL,(rd.szIconId)) + KVSM_PARAMETERS_END(c) + + + if(!(c->getParameterCode(2,rd.szVisibleNameScript) && c->getParameterCode(3,rd.szDescriptionScript))) + { + c->error(__tr2qs("Internal error: call a head-shrinker")); + return false; + } + + if(c->callback()) + rd.szUninstallCallbackScript = c->callback()->code(); + + if(!KviKvsScriptAddonManager::instance()->isValidVersionString(rd.szVersion)) + { + c->error(__tr2qs("The specified version \"%Q\" is not a valid version string"),&(rd.szVersion)); + return false; + } + + if(!KviKvsScriptAddonManager::instance()->isValidVersionString(szMinKVIrcVersion)) + { + c->error(__tr2qs("The specified KVIrc version \"%Q\" is not a valid version string"),&szMinKVIrcVersion); + return false; + } + + if(KviKvsScriptAddonManager::instance()->compareVersions(szMinKVIrcVersion,KVI_VERSION "." KVI_SOURCES_DATE) < 0) + { + c->error(__tr2qs("This KVIrc executable is too old to run this addon (minimum version required is %Q)"),&szMinKVIrcVersion); + return false; + } + + if(!c->switches()->find('q',"quiet")) + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Attempting to register addon \"%Q\" with version %Q"),&(rd.szName),&(rd.szVersion)); + + KviKvsScriptAddon * a = KviKvsScriptAddonManager::instance()->findAddon(rd.szName); + if(a) + { + // the same addon already exists + if(KviKvsScriptAddonManager::instance()->compareVersions(a->version(),rd.szVersion) < 0) + { + // and it has a higher version... + // complain unless -f is used + if(!c->switches()->find('f',"force")) + { + c->error(__tr2qs("The script addon \"%Q\" already exists with version %Q which is higher than %Q"),&(rd.szName),&(a->version()),&(rd.szVersion)); + return false; + } + } + + if(!c->switches()->find('q',"quiet")) + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Uninstalling existing addon version %Q"),&(a->version())); + + // uninstall the existing version + KviKvsScriptAddonManager::instance()->unregisterAddon(rd.szName,c->window(),!c->switches()->find('n',"no-uninstall")); + } + + if(!KviKvsScriptAddonManager::instance()->registerAddon(&rd)) + { + c->error(__tr2qs("Script registration failed")); + return false; + } + + if(!c->switches()->find('q',"quiet")) + c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Script succesfully registered")); + + return true; +} + +/* + @doc: addon.dialog + @type: + command + @title: + addon.dialog + @short: + Shows the addon addon management editor + @syntax: + addon.dialog + @description: + Shows the addon addon management editor +*/ + +static bool addon_kvs_cmd_dialog(KviKvsModuleCommandCall * c) +{ + KviScriptManagementDialog::display(); + return true; +} + +static bool addon_module_init(KviModule *m) +{ + KVSM_REGISTER_FUNCTION(m,"exists",addon_kvs_fnc_exists); + KVSM_REGISTER_FUNCTION(m,"version",addon_kvs_fnc_version); + + KVSM_REGISTER_SIMPLE_COMMAND(m,"dialog",addon_kvs_cmd_dialog); + KVSM_REGISTER_SIMPLE_COMMAND(m,"list",addon_kvs_cmd_list); + KVSM_REGISTER_SIMPLE_COMMAND(m,"uninstall",addon_kvs_cmd_uninstall); + KVSM_REGISTER_SIMPLE_COMMAND(m,"configure",addon_kvs_cmd_configure); + KVSM_REGISTER_SIMPLE_COMMAND(m,"help",addon_kvs_cmd_help); + + KVSM_REGISTER_CALLBACK_COMMAND(m,"setconfigurecallback",addon_kvs_cmd_setconfigurecallback); + KVSM_REGISTER_CALLBACK_COMMAND(m,"sethelpcallback",addon_kvs_cmd_sethelpcallback); + KVSM_REGISTER_CALLBACK_COMMAND(m,"register",addon_kvs_cmd_register); + + QString szBuf; + m->getDefaultConfigFileName(szBuf); + KviConfig cfg(szBuf,KviConfig::Read); + g_rectManagementDialogGeometry = cfg.readRectEntry("EditorGeometry",QRect(10,10,390,440)); + + return true; +} + +static bool addon_module_cleanup(KviModule *m) +{ + KviScriptManagementDialog::cleanup(); + + QString szBuf; + m->getDefaultConfigFileName(szBuf); + KviConfig cfg(szBuf,KviConfig::Write); + cfg.writeEntry("EditorGeometry",g_rectManagementDialogGeometry); + + return true; +} + +static bool addon_module_can_unload(KviModule * m) +{ + return (!KviScriptManagementDialog::instance()); +} + + +KVIRC_MODULE( + "addon", // module name + "1.0.0", // module version + "Copyright (C) 2005 Szymon Stefanek (pragma at kvirc dot net)", // author & (C) + "Script management functions for the KVS engine", + addon_module_init, + addon_module_can_unload, + 0, + addon_module_cleanup +) diff --git a/src/modules/addon/managementdialog.cpp b/src/modules/addon/managementdialog.cpp new file mode 100644 index 000000000..f5bb0e6ad --- /dev/null +++ b/src/modules/addon/managementdialog.cpp @@ -0,0 +1,371 @@ +//============================================================================= +// +// File : managementdialog.cpp +// Created on Fri 08 Apr 2005 14:54:56 by Szymon Stefanek +// +// This file is part of the KVIrc IRC Client distribution +// Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net> +// +// 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 opinion) 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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include "managementdialog.h" + +#include "kvi_listview.h" +#include "kvi_locale.h" +#include "kvi_frame.h" +#include "kvi_iconmanager.h" +#include "kvi_kvs_scriptaddonmanager.h" +#include "kvi_window.h" + +#include "kvi_filedialog.h" +#include "kvi_fileutils.h" +#include "kvi_kvs_script.h" +#include "kvi_sourcesdate.h" + +#include <qpushbutton.h> +#include <qlayout.h> +#include <qapplication.h> +#include <qtooltip.h> +#include <qdragobject.h> +#include <qlineedit.h> +#include <qlabel.h> +#include <qmessagebox.h> +#include <qframe.h> +#include <qscrollview.h> +#include <qheader.h> +#include <qpainter.h> +#include <qpixmap.h> +#include <qsimplerichtext.h> +#include <qmessagebox.h> + +KviScriptManagementDialog * KviScriptManagementDialog::m_pInstance = 0; +extern QRect g_rectManagementDialogGeometry; + + +#define LVI_ICON_SIZE 32 +#define LVI_BORDER 4 +#define LVI_SPACING 8 +#define LVI_MINIMUM_TEXT_WIDTH 300 +#define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER) + +KviScriptAddonListViewItem::KviScriptAddonListViewItem(QListView * v,KviKvsScriptAddon * a) +: QListViewItem(v,"") +{ + m_pAddon = new KviKvsScriptAddon(*a); + m_pListView = v; + QString t = "<nobr><b>"; + t += a->visibleName(); + t += "</b> ["; + t += a->version(); + t += "]"; + t += " <font color=\"#a0a0a0\">["; + t += a->name(); + t += "]</font></nobr>"; + t += "<br><nobr><font size=\"-1\">"; + t += a->description(); + t += "</font></nobr>"; + m_szKey = a->visibleName().upper(); + m_pText = new QSimpleRichText(t,v->font()); + QPixmap * p = a->icon(); + m_pIcon = p ? new QPixmap(*p) : new QPixmap(LVI_ICON_SIZE,LVI_ICON_SIZE); +} + +KviScriptAddonListViewItem::~KviScriptAddonListViewItem() +{ + delete m_pIcon; + delete m_pText; + delete m_pAddon; +} + +QString KviScriptAddonListViewItem::key(int,bool) const +{ + return m_szKey; +} + +void KviScriptAddonListViewItem::setup() +{ + QListViewItem::setup(); + int iWidth = m_pListView->visibleWidth(); + if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; + iWidth -= LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER; + m_pText->setWidth(iWidth); + int iHeight = m_pText->height() + (2 * LVI_BORDER); + if(iHeight < (LVI_ICON_SIZE + (2 * LVI_BORDER)))iHeight = LVI_ICON_SIZE + (2 * LVI_BORDER); + setHeight(iHeight); +} + +void KviScriptAddonListViewItem::paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align) +{ + QListViewItem::paintCell(p,cg,column,width,align); +// p->fillRect(QRect(0,0,width,height()),isSelected() ? cg.highlight() : cg.base()); + p->drawPixmap(LVI_BORDER,LVI_BORDER,*m_pIcon); + int afterIcon = LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING; + int www = m_pListView->visibleWidth() - (afterIcon + LVI_BORDER); + m_pText->setWidth(www); + if(isSelected()) + { + QColorGroup cg2(cg); + cg2.setColor(QColorGroup::HighlightedText,cg.text()); + m_pText->draw(p,afterIcon,LVI_BORDER,QRect(afterIcon,LVI_BORDER,www,height() - (LVI_BORDER * 2)),cg2); + } else { + m_pText->draw(p,afterIcon,LVI_BORDER,QRect(afterIcon,LVI_BORDER,www,height() - (LVI_BORDER * 2)),cg); + } +} + + + + + + + +KviScriptAddonListView::KviScriptAddonListView(QWidget * pParent) +: KviListView(pParent) +{ + QPixmap * p = g_pIconManager->getImage("kvi_dialog_addons.png"); + if(p)setBackgroundOverlayPixmap(p,Qt::AlignRight | Qt::AlignBottom); + + setSelectionMode(Single); + header()->hide(); + int iWidth = visibleWidth(); + if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; + addColumn("",iWidth); + setSorting(0,true); +} + +KviScriptAddonListView::~KviScriptAddonListView() +{ +} + +void KviScriptAddonListView::resizeEvent(QResizeEvent * e) +{ + KviListView::resizeEvent(e); + int iWidth = visibleWidth(); + if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH; + setColumnWidth(0,iWidth); +} + + +KviScriptManagementDialog::KviScriptManagementDialog(QWidget * p) +: QDialog(p,"" /*,WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_StaysOnTop | WStyle_DialogBorder*/) +{ + setCaption(__tr2qs("Manage Script-Based Addons")); + setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ADDONS))); + setModal(true); + + m_pInstance = this; + + QGridLayout * g = new QGridLayout(this,11,3,4,5); + + /*QLabel * lb = new QLabel(this); + lb->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); + + g->addMultiCellWidget(lb,0,10,0,0); + QPixmap * pix = g_pIconManager->getImage("kvi_dialog_addons.png"); + if(pix) + { + lb->setPixmap(*pix); + lb->setFixedWidth(pix->width()); + } + lb->setBackgroundColor(Qt::black); + lb->setAlignment(Qt::AlignBottom | Qt::AlignRight); + */ + m_pListView = new KviScriptAddonListView(this); + g->addMultiCellWidget(m_pListView,0,10,1,1); + + m_pConfigureButton = new QPushButton(__tr2qs("Configure"),this); + connect(m_pConfigureButton,SIGNAL(clicked()),this,SLOT(configureScript())); + g->addWidget(m_pConfigureButton,0,2); + + m_pHelpButton = new QPushButton(__tr2qs("Show Help"),this); + connect(m_pHelpButton,SIGNAL(clicked()),this,SLOT(showScriptHelp())); + g->addWidget(m_pHelpButton,1,2); + + g->addRowSpacing(2,40); + + m_pUninstallButton = new QPushButton(__tr2qs("Uninstall"),this); + connect(m_pUninstallButton,SIGNAL(clicked()),this,SLOT(uninstallScript())); + g->addWidget(m_pUninstallButton,3,2); + + g->addRowSpacing(4,15); + + QFrame *f = new QFrame(this); + f->setFrameStyle(QFrame::HLine | QFrame::Sunken); + g->addWidget(f,5,2); + + g->addRowSpacing(6,15); + + m_pInstallButton = new QPushButton(__tr2qs("Install Addon..."),this); + connect(m_pInstallButton,SIGNAL(clicked()),this,SLOT(installScript())); + g->addWidget(m_pInstallButton,7,2); + + m_pGetScriptsButton = new QPushButton(__tr2qs("More Addons..."),this); + connect(m_pGetScriptsButton,SIGNAL(clicked()),this,SLOT(getMoreScripts())); + g->addWidget(m_pGetScriptsButton,8,2); + + QPushButton * b = new QPushButton(__tr2qs("Close"),this); + connect(b,SIGNAL(clicked()),this,SLOT(closeClicked())); + g->addWidget(b,10,2); + + g->setRowStretch(9,1); + g->setColStretch(1,1); + + fillListView(); + + currentChanged(0); + connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentChanged(QListViewItem *))); + //currentToolBarChanged(); + + if(g_rectManagementDialogGeometry.y() < 5) + { + g_rectManagementDialogGeometry.setY(5); + } + resize(g_rectManagementDialogGeometry.width(), + g_rectManagementDialogGeometry.height()); + move(g_rectManagementDialogGeometry.x(), + g_rectManagementDialogGeometry.y()); +} + +KviScriptManagementDialog::~KviScriptManagementDialog() +{ + g_rectManagementDialogGeometry = QRect(pos().x(),pos().y(),size().width(),size().height()); + + //KviActionManager::instance()->customizeToolBarsDialogDestroyed(); + m_pInstance = 0; +} + +void KviScriptManagementDialog::fillListView() +{ + m_pListView->clear(); + QDict<KviKvsScriptAddon> * d = KviKvsScriptAddonManager::instance()->addonDict(); + if(!d)return; + QDictIterator<KviKvsScriptAddon> it(*d); + KviScriptAddonListViewItem * item; + while(KviKvsScriptAddon * a = it.current()) + { + item = new KviScriptAddonListViewItem(m_pListView,a); + ++it; + } +} + +void KviScriptManagementDialog::currentChanged(QListViewItem *) +{ + KviScriptAddonListViewItem * it = (KviScriptAddonListViewItem *)m_pListView->currentItem(); + if(!it) + { + m_pConfigureButton->setEnabled(false); + m_pUninstallButton->setEnabled(false); + m_pHelpButton->setEnabled(false); + } else { + m_pConfigureButton->setEnabled(!(it->addon()->configureCallbackCode().isEmpty())); + m_pHelpButton->setEnabled(!(it->addon()->helpCallbackCode().isEmpty())); + m_pUninstallButton->setEnabled(true); + } +} + +void KviScriptManagementDialog::showScriptHelp() +{ + KviScriptAddonListViewItem * it = (KviScriptAddonListViewItem *)m_pListView->currentItem(); + if(!it)return; + if(it->addon()->helpCallbackCode().isEmpty())return; + it->addon()->executeHelpCallback(g_pActiveWindow); +} + +void KviScriptManagementDialog::configureScript() +{ + KviScriptAddonListViewItem * it = (KviScriptAddonListViewItem *)m_pListView->currentItem(); + if(!it)return; + if(it->addon()->configureCallbackCode().isEmpty())return; + it->addon()->executeConfigureCallback(g_pActiveWindow); +} + +void KviScriptManagementDialog::uninstallScript() +{ + KviScriptAddonListViewItem * it = (KviScriptAddonListViewItem *)m_pListView->currentItem(); + if(!it)return; + + QString txt = "<p>"; + txt += __tr2qs("Do you really want to uninstall the addon \"%1\" ?").arg(it->addon()->visibleName()); + txt += "</p>"; + + if(QMessageBox::question(this, + __tr2qs("Confirm addon uninstallation"),txt,__tr2qs("&Yes"),__tr2qs("&No"),0,1) != 0)return; + + KviKvsScriptAddonManager::instance()->unregisterAddon(it->addon()->name(),g_pActiveWindow); + + fillListView(); + currentChanged(0); +} + +void KviScriptManagementDialog::getMoreScripts() +{ + KviKvsScript::run("openurl http://www.kvirc.net/?id=addons&version=" KVI_VERSION "." KVI_SOURCES_DATE,g_pActiveWindow); +} + +void KviScriptManagementDialog::installScript() +{ + QString buffer; + + if(!KviFileDialog::askForOpenFileName(buffer,__tr2qs("Please select the addon installation file"),QString::null,"install.kvs",false,true))return; + + buffer.replace("\\","\\\\"); + + QString szCmd = "parse \""; + szCmd += buffer; + szCmd += "\""; + + KviKvsScript::run(szCmd,g_pActiveWindow); + + fillListView(); + currentChanged(0); + + m_pListView->publicUpdateContents(); + //m_pListView->triggerUpdate(); +} + +void KviScriptManagementDialog::showEvent(QShowEvent * e) +{ +// QRect r = parentWidget() ? parentWidget()->rect() : QApplication::desktop()->rect(); +// int x = (r.width() - width()) / 2; +// int y = (r.height() - height()) / 2; +// move(x,y); +} + +void KviScriptManagementDialog::closeClicked() +{ + delete this; +} + +void KviScriptManagementDialog::cleanup() +{ + if(!m_pInstance)return; + delete m_pInstance; + m_pInstance = 0; +} + +void KviScriptManagementDialog::display() +{ + if(m_pInstance)return; + m_pInstance = new KviScriptManagementDialog(g_pFrame); + m_pInstance->show(); +} + +void KviScriptManagementDialog::closeEvent(QCloseEvent * e) +{ + e->ignore(); + delete this; +} + diff --git a/src/modules/addon/managementdialog.h b/src/modules/addon/managementdialog.h new file mode 100644 index 000000000..0c9a8fd23 --- /dev/null +++ b/src/modules/addon/managementdialog.h @@ -0,0 +1,105 @@ +#ifndef _MANAGEMENTDIALOG_H_ +#define _MANAGEMENTDIALOG_H_ +//============================================================================= +// +// File : managementdialog.h +// Created on Fri 08 Apr 2005 14:54:56 by Szymon Stefanek +// +// This file is part of the KVIrc IRC Client distribution +// Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net> +// +// 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 opinion) 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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include <qdialog.h> + +#include "kvi_listview.h" +#include "kvi_settings.h" +#include <qwidget.h> +#include <qlabel.h> +#include <qdialog.h> +#include <qcolor.h> +#include <qlistview.h> + +class QPushButton; +class QPixmap; +class QSimpleRichText; +class KviKvsScriptAddon; + +class KviScriptAddonListViewItem : public QListViewItem +{ +public: + KviScriptAddonListViewItem(QListView * v,KviKvsScriptAddon * a); + ~KviScriptAddonListViewItem(); +protected: + KviKvsScriptAddon * m_pAddon; + QSimpleRichText * m_pText; + QPixmap * m_pIcon; + QListView * m_pListView; + QString m_szKey; +public: + KviKvsScriptAddon * addon(){ return m_pAddon; }; +protected: + virtual QString key(int,bool) const; + virtual void paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align); + virtual void setup(); +}; + +class KviScriptAddonListView : public KviListView +{ + Q_OBJECT +public: + KviScriptAddonListView(QWidget * pParent); + ~KviScriptAddonListView(); +protected: + virtual void resizeEvent(QResizeEvent * e); +}; + +class KviScriptManagementDialog : public QDialog +{ + Q_OBJECT +protected: + KviScriptManagementDialog(QWidget * p); +public: + ~KviScriptManagementDialog(); +protected: + KviScriptAddonListView * m_pListView; + static KviScriptManagementDialog * m_pInstance; + QPushButton * m_pUninstallButton; + QPushButton * m_pConfigureButton; + QPushButton * m_pHelpButton; + QPushButton * m_pInstallButton; + QPushButton * m_pGetScriptsButton; +public: + static KviScriptManagementDialog * instance(){ return m_pInstance; }; + static void display(); + static void cleanup(); +protected: + void fillListView(); + virtual void showEvent(QShowEvent * e); + virtual void closeEvent(QCloseEvent *e); +protected slots: + void currentChanged(QListViewItem *i); + void closeClicked(); + void showScriptHelp(); + void configureScript(); + void uninstallScript(); + void getMoreScripts(); + void installScript(); +}; + + +#endif //!_MANAGEMENTDIALOG_H_ diff --git a/src/modules/addon/pics/.svnignore b/src/modules/addon/pics/.svnignore new file mode 100644 index 000000000..ea8bf68f9 --- /dev/null +++ b/src/modules/addon/pics/.svnignore @@ -0,0 +1,6 @@ +Makefile.in +Makefile +core +.pics +.mospics +.xvpics
\ No newline at end of file diff --git a/src/modules/addon/pics/Makefile.am b/src/modules/addon/pics/Makefile.am new file mode 100644 index 000000000..726f519da --- /dev/null +++ b/src/modules/addon/pics/Makefile.am @@ -0,0 +1,9 @@ +############################################################################### +# KVirc IRC client Makefile - 10.03.2000 Szymon Stefanek <stefanek@tin.it> +############################################################################### + +tmpdir = $(picsdir) + +tmp_DATA= kvi_dialog_addons.png + +EXTRA_DIST = $(tmp_DATA) diff --git a/src/modules/addon/pics/kvi_dialog_addons.png b/src/modules/addon/pics/kvi_dialog_addons.png Binary files differnew file mode 100644 index 000000000..550c324f8 --- /dev/null +++ b/src/modules/addon/pics/kvi_dialog_addons.png |
