aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/setup
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2006-12-18 01:34:15 +0000
committerGravatar Szymon Tomasz Stefanek2006-12-18 01:34:15 +0000
commitc75b9f00eaeee4b8503ba662b3d7ccc9e1914096 (patch)
treea5e7ee244fa4124588a114732c4ecbc248c7c199 /src/modules/setup
parentSwitching from cvs to svn, initial import (diff)
downloadKVIrc-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/setup')
-rw-r--r--src/modules/setup/.svnignore10
-rw-r--r--src/modules/setup/Makefile.am26
-rw-r--r--src/modules/setup/kvisetup.dsp142
-rw-r--r--src/modules/setup/kvisetup.dsw29
-rw-r--r--src/modules/setup/libkvisetup.cpp146
-rwxr-xr-xsrc/modules/setup/setup.vcproj170
-rw-r--r--src/modules/setup/setup_vc05.vcproj255
-rw-r--r--src/modules/setup/setupwizard.cpp987
-rw-r--r--src/modules/setup/setupwizard.h148
9 files changed, 1913 insertions, 0 deletions
diff --git a/src/modules/setup/.svnignore b/src/modules/setup/.svnignore
new file mode 100644
index 000000000..3ebe7fb0c
--- /dev/null
+++ b/src/modules/setup/.svnignore
@@ -0,0 +1,10 @@
+Makefile.in
+Makefile
+.deps
+*.o
+*.lo
+*.la
+*.moc
+.libs
+.mospics
+.pics \ No newline at end of file
diff --git a/src/modules/setup/Makefile.am b/src/modules/setup/Makefile.am
new file mode 100644
index 000000000..73e3bcec0
--- /dev/null
+++ b/src/modules/setup/Makefile.am
@@ -0,0 +1,26 @@
+###############################################################################
+# KVirc IRC client Makefile - 10.03.2000 Szymon Stefanek <stefanek@tin.it>
+###############################################################################
+
+AM_CPPFLAGS = -I$(SS_TOPSRCDIR)/src/kvilib/include/ -I$(SS_TOPSRCDIR)/src/kvirc/include/ \
+$(SS_INCDIRS) $(SS_CPPFLAGS) -DGLOBAL_KVIRC_DIR=\"$(globalkvircdir)\"
+
+pluglib_LTLIBRARIES = libkvisetup.la
+
+libkvisetup_la_LDFLAGS = -module -avoid-version $(SS_LDFLAGS) $(SS_LIBDIRS)
+
+libkvisetup_la_SOURCES = libkvisetup.cpp setupwizard.cpp
+libkvisetup_la_LIBADD = $(SS_LIBLINK) ../../kvilib/build/libkvilib.la
+
+noinst_HEADERS= setupwizard.h
+
+#datadir = $(picsdir)
+
+#data_DATA = kvi_dock.png
+
+#EXTRA_DIST = $(data_DATA)
+
+%.moc: %.h
+ $(SS_QT_MOC) $< -o $@
+
+setupwizard.cpp: setupwizard.moc
diff --git a/src/modules/setup/kvisetup.dsp b/src/modules/setup/kvisetup.dsp
new file mode 100644
index 000000000..64cfc77ff
--- /dev/null
+++ b/src/modules/setup/kvisetup.dsp
@@ -0,0 +1,142 @@
+# Microsoft Developer Studio Project File - Name="kvisetup" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=kvisetup - 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 "kvisetup.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 "kvisetup.mak" CFG="kvisetup - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "kvisetup - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "kvisetup - 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)" == "kvisetup - 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 "ACTION_EXPORTS" /YX /FD /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 "ACTION_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 imm32.lib wsock32.lib winmm.lib $(QTDIR)\lib\qt-mtnc321.lib $(QTDIR)\lib\qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /machine:I386 /out:"..\..\..\win32build\bin\modules\kvisetup.dll" /libpath:"C:\OpenSSL\lib\VC" /libpath:"..\..\kvilib\Release" /libpath:"..\..\kvirc\Release"
+
+!ELSEIF "$(CFG)" == "kvisetup - 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 "ACTION_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /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 "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ACTION_EXPORTS" /YX /FD /GZ /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 odbc32.lib odbccp32.lib $(QTDIR)\lib\qt-mtnc321.lib $(QTDIR)\lib\qtmain.lib libeay32.lib SSLeay32.lib ws2_32.lib kvilib.lib kvirc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\win32build\KviDebug\modules\kvisetup.dll" /pdbtype:sept /libpath:"C:\OpenSSL\lib\VC" /libpath:"..\..\kvilib\Debug" /libpath:"..\..\kvirc\Debug"
+
+!ENDIF
+
+# Begin Target
+
+# Name "kvisetup - Win32 Release"
+# Name "kvisetup - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\libkvisetup.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\setupwizard.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\setupwizard.h
+
+!IF "$(CFG)" == "kvisetup - Win32 Release"
+
+# Begin Custom Build
+InputDir=.
+InputPath=.\setupwizard.h
+InputName=setupwizard
+
+"$(InputDir)\$(InputName).moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ %qtdir%\bin\moc.exe $(InputDir)\$(InputName).h -o $(InputDir)\$(InputName).moc
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "kvisetup - Win32 Debug"
+
+# Begin Custom Build
+InputDir=.
+InputPath=.\setupwizard.h
+InputName=setupwizard
+
+"$(InputDir)\$(InputName).moc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ %qtdir%\bin\moc.exe $(InputDir)\$(InputName).h -o $(InputDir)\$(InputName).moc
+
+# 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/setup/kvisetup.dsw b/src/modules/setup/kvisetup.dsw
new file mode 100644
index 000000000..ee5ee6b4a
--- /dev/null
+++ b/src/modules/setup/kvisetup.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "kvisetup"=.\kvisetup.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/src/modules/setup/libkvisetup.cpp b/src/modules/setup/libkvisetup.cpp
new file mode 100644
index 000000000..c86287853
--- /dev/null
+++ b/src/modules/setup/libkvisetup.cpp
@@ -0,0 +1,146 @@
+//=============================================================================
+//
+// File : libkvisetup.cpp
+// Creation date : Sat Oct 6 02:08:24 2001 GMT by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001-2004 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 "setupwizard.h"
+
+#include <qstring.h>
+#include <qfile.h>
+
+#include "kvi_options.h"
+#include "kvi_defaults.h"
+#include "kvi_app.h"
+#include "kvi_kvs_script.h"
+#include "kvi_kvs_variantlist.h"
+#include "kvi_window.h"
+
+// this will be choosen during the setup process
+QString g_szChoosenIncomingDirectory;
+//int g_iThemeToApply = THEME_APPLY_NONE;
+bool bNeedToApplyDefaults;
+unsigned int uPort;
+QString szHost;
+QString szUrl;
+
+
+
+
+// this is called by KviApp when no local kvirc directory has been found
+// we have nothing to rely on yet... (settings have not been loaded yet)
+KVIMODULEEXPORTFUNC bool setup_begin()
+{
+ // FIXME: try to guess the user's .kvirc directory
+ // and the preferred nickname from a previous installation
+
+ KviSetupWizard * w = new KviSetupWizard();
+ int retcode = w->exec();
+ delete w;
+ return (retcode == QDialog::Accepted);
+}
+
+
+// this is called just after the first startup
+// all the subsystems are up and running (we even have a nice console
+// to write on if needed).
+// all the options are loaded.
+KVIMODULEEXPORTFUNC void setup_finish()
+{
+ if(bNeedToApplyDefaults)
+ {
+ KVI_OPTION_STRING(KviOption_stringIncomingPath) = g_szChoosenIncomingDirectory;
+ // Reset the quit message and the real name... if they contain the KVIrc version
+ // then probably the user hasn't even edited them.
+ if(KVI_OPTION_STRING(KviOption_stringQuitMessage).find("KVIrc",0,false) != -1)
+ KVI_OPTION_STRING(KviOption_stringQuitMessage) = KVI_DEFAULT_QUIT_MESSAGE;
+ // We deserve to change the user's part message in something nice :)
+ KVI_OPTION_STRING(KviOption_stringPartMessage) = KVI_DEFAULT_PART_MESSAGE;
+
+ // FIXME: Should we also change these ?
+ // #define KVI_DEFAULT_CTCP_USERINFO_REPLY "I'm too lazy to edit this field."
+ // #define KVI_DEFAULT_AWAY_MESSAGE "I'm off to see the wizard."
+
+ // Apply the choosen default theme
+ QString szDir;
+/* switch(g_iThemeToApply)
+ {
+ case THEME_APPLY_HIRES:
+ g_pApp->getGlobalKvircDirectory(szDir,KviApp::Themes,"default.hires");
+ g_pApp->loadTheme(szDir);
+ break;
+ case THEME_APPLY_LORES:
+ g_pApp->getGlobalKvircDirectory(szDir,KviApp::Themes,"default.lores");
+ g_pApp->loadTheme(szDir);
+ break;
+ // default: no theme
+ }*/
+
+ g_pApp->getGlobalKvircDirectory(szDir,KviApp::Themes,"silverirc");
+ g_pApp->loadTheme(szDir);
+
+ g_pApp->loadDefaultScript();
+ if(!szUrl.isEmpty())
+ {
+ KviKvsVariantList * pParams = new KviKvsVariantList();
+ pParams->append(szUrl);
+ KviKvsScript::run("openurl $0",g_pActiveWindow,pParams);
+ delete pParams;
+ KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = TRUE;
+ } else if(!szHost.isEmpty()) {
+ KviKvsVariantList * pParams = new KviKvsVariantList();
+ pParams->append(szHost);
+ pParams->append((kvs_int_t)uPort);
+ KviKvsScript::run("server $0 $1",g_pActiveWindow,pParams);
+ delete pParams;
+ KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = TRUE;
+ }
+ }
+}
+
+static bool setup_module_init(KviModule *m)
+{
+ bNeedToApplyDefaults=true;
+ return true;
+}
+
+static bool setup_module_cleanup(KviModule *m)
+{
+ return true;
+}
+
+static bool setup_module_can_unload(KviModule *m)
+{
+ return true; // can be always unloaded...this module does basically nothing
+}
+
+KVIRC_MODULE(
+ "Setup wizard",
+ "1.0.0",
+ "Szymon Stefanek <pragma at kvirc dot net>" ,
+ "First-time-run setup wizard",
+ setup_module_init ,
+ setup_module_can_unload,
+ 0,
+ setup_module_cleanup
+)
diff --git a/src/modules/setup/setup.vcproj b/src/modules/setup/setup.vcproj
new file mode 100755
index 000000000..9aaf65de3
--- /dev/null
+++ b/src/modules/setup/setup.vcproj
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="setup"
+ ProjectGUID="{24152082-6DE9-4B8B-9409-88016C3B663E}"
+ 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="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SETUP_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="&quot;$(SSLLIBDIR)&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;"
+ IgnoreAllDefaultLibraries="TRUE"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/setup.pdb"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/setup.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"
+ Optimization="2"
+ GlobalOptimizations="TRUE"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ EnableFiberSafeOptimizations="TRUE"
+ AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SETUP_EXPORTS"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ 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="&quot;$(SSLLIBDIR)&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;"
+ IgnoreAllDefaultLibraries="TRUE"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ ImportLibrary="$(OutDir)/setup.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">
+ <File
+ RelativePath="libkvisetup.cpp">
+ </File>
+ <File
+ RelativePath="setupwizard.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="setupwizard.h">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="$(QTDIR)\bin\moc -o &quot;$(InputDir)\$(InputName).moc&quot; &quot;$(InputDir)\$(InputFileName)&quot;
+"
+ Outputs="$(InputDir)\$(InputName).moc"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="$(QTDIR)\bin\moc -o &quot;$(InputDir)\$(InputName).moc&quot; &quot;$(InputDir)\$(InputFileName)&quot;
+"
+ Outputs="$(InputDir)\$(InputName).moc"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/modules/setup/setup_vc05.vcproj b/src/modules/setup/setup_vc05.vcproj
new file mode 100644
index 000000000..8ebefa5a2
--- /dev/null
+++ b/src/modules/setup/setup_vc05.vcproj
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="setup"
+ ProjectGUID="{24152082-6DE9-4B8B-9409-88016C3B663E}"
+ RootNamespace="setup"
+ 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="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SETUP_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="&quot;$(SSLLIBDIR)&quot;;&quot;$(PERLDIR)\lib\CORE&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;;&quot;$(ZLIBLIBDIR)&quot;"
+ GenerateManifest="true"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/setup.pdb"
+ SubSystem="2"
+ TurnOffAssemblyGeneration="true"
+ ImportLibrary="$(OutDir)/setup.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="&quot;$(ProjectDir)\..\..\kvilib\tal&quot;;&quot;$(ProjectDir)\..\..\kvilib\system&quot;;&quot;$(ProjectDir)\..\..\kvilib\irc&quot;;&quot;$(ProjectDir)\..\..\kvilib\file&quot;;&quot;$(ProjectDir)\..\..\kvilib\ext&quot;;&quot;$(ProjectDir)\..\..\kvilib\net&quot;;&quot;$(ProjectDir)\..\..\kvilib\core\wstring&quot;;&quot;$(ProjectDir)\..\..\kvilib\core&quot;;&quot;$(ProjectDir)\..\..\kvilib\config&quot;;&quot;$(SSLINCDIR)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(ProjectDir)\..\..\kvirc\kvs&quot;;&quot;$(ProjectDir)\..\..\kvirc\module&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser\scripttoolbar&quot;;&quot;$(ProjectDir)\..\..\kvirc\uparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\sparser&quot;;&quot;$(ProjectDir)\..\..\kvirc\kernel&quot;;&quot;$(ProjectDir)\..\..\kvirc\ui&quot;"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SETUP_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ MinimalRebuild="true"
+ ExceptionHandling="1"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ 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="&quot;$(SSLLIBDIR)&quot;;&quot;$(PERLDIR)\lib\CORE&quot;;&quot;$(QTDIR)\lib&quot;;&quot;$(SolutionDir)\win32build\bin&quot;;&quot;$(ZLIBLIBDIR)&quot;"
+ GenerateManifest="true"
+ IgnoreAllDefaultLibraries="true"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ LinkTimeCodeGeneration="1"
+ TurnOffAssemblyGeneration="true"
+ ImportLibrary="$(OutDir)/setup.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"
+ >
+ <File
+ RelativePath="libkvisetup.cpp"
+ >
+ </File>
+ <File
+ RelativePath="setupwizard.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="setupwizard.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="$(QTDIR)\bin\moc -o &quot;$(InputDir)\$(InputName).moc&quot; &quot;$(InputDir)\$(InputFileName)&quot;&#x0D;&#x0A;"
+ Outputs="$(InputDir)\$(InputName).moc"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="$(QTDIR)\bin\moc -o &quot;$(InputDir)\$(InputName).moc&quot; &quot;$(InputDir)\$(InputFileName)&quot;&#x0D;&#x0A;"
+ Outputs="$(InputDir)\$(InputName).moc"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/modules/setup/setupwizard.cpp b/src/modules/setup/setupwizard.cpp
new file mode 100644
index 000000000..4e6f4264b
--- /dev/null
+++ b/src/modules/setup/setupwizard.cpp
@@ -0,0 +1,987 @@
+//===============================================================================
+//
+// File : setupwizard.cpp
+// Creation date : Sat Oct 6 02:06:53 2001 GMT by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001-2004 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 "setupwizard.h"
+
+#include "kvi_app.h"
+#include "kvi_locale.h"
+#include "kvi_fileutils.h"
+#include "kvi_defaults.h"
+#include "kvi_msgbox.h"
+#include "kvi_tal_filedialog.h"
+#include "kvi_qstring.h"
+#include "kvi_env.h"
+#include "kvi_options.h"
+#include "kvi_config.h"
+
+#include <qtextedit.h>
+#include <qmessagebox.h>
+#include <qdir.h>
+#include <qpushbutton.h>
+#include <qvalidator.h>
+#include <qtextcodec.h>
+#include <qhbox.h>
+
+#ifdef COMPILE_ON_WINDOWS
+ #include <windows.h>
+ #include <winnls.h> // for MultiByteToWideChar
+ #include <objbase.h> // CoCreateInstance , CoInitialize & CO.
+ #include <shlobj.h> // IShellLink IPersistFile & CO.
+#else
+ #include <unistd.h> // for symlink()
+#endif
+
+// libkvisetup.cpp
+extern QString g_szChoosenIncomingDirectory;
+//extern int g_iThemeToApply;
+extern bool bNeedToApplyDefaults;
+extern unsigned int uPort;
+extern QString szHost;
+extern QString szUrl;
+
+#ifdef COMPILE_ON_WINDOWS
+ #define KVI_LOCAL_KVIRC_SUBDIRECTORY_NAME "KVIrc"
+#else
+ #define KVI_LOCAL_KVIRC_SUBDIRECTORY_NAME ".kvirc"
+#endif
+
+KviSetupPage::KviSetupPage(KviSetupWizard * w)
+: QHBox(w)
+{
+ // we need this to set localized text on buttons (see QT doc/ QWizard class)
+ w->QWizard::backButton()->setText(__tr2qs("< &Back"));
+ w->QWizard::nextButton()->setText(__tr2qs("&Next >"));
+ w->QWizard::finishButton()->setText(__tr2qs("Finish"));
+ w->QWizard::cancelButton()->setText(__tr2qs("Cancel"));
+ //w->QWizard::helpButton()->setText(__tr2qs("Help"));
+
+ setSpacing(8);
+
+ m_pPixmapLabel = new QLabel(this);
+
+ m_pPixmapLabel->setPixmap(*(w->m_pLabelPixmap));
+ m_pPixmapLabel->setFixedSize(w->m_pLabelPixmap->size());
+ m_pPixmapLabel->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
+ m_pPixmapLabel->setMargin(0);
+
+ m_pVBox = new QVBox(this);
+ m_pVBox->setSpacing(8);
+
+ QLabel * l = new QLabel(m_pVBox);
+ l->setAlignment(Qt::AlignAuto | Qt::AlignTop);
+ QString szHeader = "<table width=\"100%\"><tr><td bgcolor=\"#303030\">" \
+ "<h1><font color=\"#FFFFFF\">KVIrc " KVI_VERSION "</font></h1>" \
+ "</td></tr></table>";
+ l->setText(szHeader);
+
+ m_pTextLabel = new QLabel(m_pVBox);
+ m_pTextLabel->setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
+ m_pVBox->setStretchFactor(m_pTextLabel,1);
+}
+
+KviSetupPage::~KviSetupPage()
+{
+}
+
+
+KviSetupWizard::KviSetupWizard()
+: QWizard(0,0,true)
+{
+ QString szLabelText;
+
+ QString szImagePath;
+ g_pApp->getGlobalKvircDirectory(szImagePath,KviApp::Pics,"kvi_setup_label.png");
+
+ m_pLabelPixmap = new QPixmap(szImagePath);
+ if(m_pLabelPixmap->isNull())
+ {
+ delete m_pLabelPixmap;
+ m_pLabelPixmap = new QPixmap(180,400);
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Welcome
+
+ m_pWelcome = new KviSetupPage(this);
+
+ // here we go...
+ QString szText = __tr2qs("<p>" \
+ "<h2>Welcome :)</h2>" \
+ "This is your first time running this version of KVIrc.<br>" \
+ "This wizard will guide you through the few steps " \
+ "required to complete the setup.<br><br>" \
+ "If you had a previous version of KVIrc installed, no worries. You will " \
+ "have a chance to preserve the old configuration." \
+ "</p>" \
+ "<p>Click \"<b>Next</b>\" to proceed.</p>");
+
+ m_pWelcome->m_pTextLabel->setText(szText);
+
+ addPage(m_pWelcome,__tr2qs("Welcome to KVIrc"));
+
+#ifdef COMPILE_ON_WINDOWS
+ m_pCreateUrlHandlers = new QCheckBox(__tr2qs("Make KVIrc default IRC client"),m_pWelcome->m_pVBox);
+ m_pCreateUrlHandlers->setChecked(true);
+#endif
+#ifdef COMPILE_KDE_SUPPORT
+ m_pCreateDesktopShortcut = new QCheckBox(__tr2qs("Create desktop shortcut"),m_pWelcome->m_pVBox);
+ m_pCreateDesktopShortcut->setChecked(true);
+#endif
+ setBackEnabled(m_pWelcome,false);
+ setHelpEnabled(m_pWelcome,false);
+
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // License
+#ifndef COMPILE_ON_WINDOWS //it have been already shown by installer
+ KviSetupPage * m_pLicense = new KviSetupPage(this);
+ m_pLicense->m_pTextLabel->setText(__tr2qs( \
+ "<p>All of the files in this distribution are covered by the GPL. " \
+ "In human terms this can be read as follows:<br>" \
+ "<ul>" \
+ "<li><b>KVIrc is free</b>, use it, have fun! <b>:)</b></li>" \
+ "<li>If you use <b>any</b> part of KVIrc in your own project, you <b>must</b> release that project under the same license.</li>" \
+ "</ul></p>" \
+ "<p>The \"legalese\" version of the license is shown in the box below.</p>"));
+
+ QTextEdit * ed = new QTextEdit(m_pLicense->m_pVBox);
+ ed->setReadOnly(true);
+ ed->setWordWrap(QTextEdit::NoWrap);
+ QString szLicense;
+ QString szLicensePath;
+ g_pApp->getGlobalKvircDirectory(szLicensePath,KviApp::License,"COPYING");
+ if(!KviFileUtils::loadFile(szLicensePath,szLicense))
+ {
+ szLicense = __tr("Oops... can't find the license file.\n" \
+ "It MUST be included in the distribution...\n" \
+ "Please report to <pragma at kvirc dot net>");
+ }
+ ed->setText(szLicense);
+
+ m_pLicense->m_pVBox->setStretchFactor(ed,1);
+
+ addPage(m_pLicense,__tr2qs("Dreaded License Agreement"));
+
+ setHelpEnabled(m_pLicense,false);
+
+ setCaption(__tr2qs("KVIrc Setup"));
+#else
+ m_pLicense = 0;
+#endif
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Directories
+
+ m_pDirectory = new KviSetupPage(this);
+
+
+ m_pDirectory->m_pTextLabel->setText(__tr2qs("<p>Please choose a folder for " \
+ "KVIrc to store its settings and other data, and another for downloaded files. " \
+ "Make sure that you have permission to write to both folders.<br><br>" \
+ "The suggested locations are fine in most cases, so if you don't know what " \
+ "is this about, just click \"<b>Next</b>\".<br><br>" \
+ "If you had a previous version of KVIrc installed, you can choose " \
+ "the existing directory for the settings, and your configuration " \
+ "will be preserved." \
+ "</p>"));
+
+ addPage(m_pDirectory,__tr2qs("Application Folders"));
+
+ QString tmp;
+
+ m_pDirButtonGroup = new QVButtonGroup(__tr2qs("Store configuration in folder"),m_pDirectory->m_pVBox);
+ m_pDirUsePrev = new QRadioButton(__tr2qs("Use settings folder from previous installation"),m_pDirButtonGroup);
+ connect(m_pDirUsePrev,SIGNAL(clicked()),this,SLOT(oldDirClicked()));
+
+ m_pOldPathBox = new QHBox(m_pDirButtonGroup);
+ m_pOldDataPathEdit = new QLineEdit(m_pOldPathBox);
+ connect(m_pOldDataPathEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(oldDataTextChanged ( const QString & )));
+
+ QPushButton * pb = new QPushButton(__tr2qs("&Browse..."),m_pOldPathBox);
+ connect(pb,SIGNAL(clicked()),this,SLOT(chooseOldDataPath()));
+ m_pOldPathBox->setSpacing(3);
+ m_pOldPathBox->setStretchFactor(m_pOldDataPathEdit,1);
+
+ m_pDirUseNew = new QRadioButton(__tr2qs("Use new settings folder"),m_pDirButtonGroup);
+ connect(m_pDirUseNew,SIGNAL(clicked()),this,SLOT(newDirClicked()));
+
+ QLabel* l = new QLabel(m_pDirButtonGroup);
+ l->setText(__tr2qs("Settings folder:"));
+
+ m_pNewPathBox = new QHBox(m_pDirButtonGroup);
+ m_pDataPathEdit = new QLineEdit(m_pNewPathBox);
+
+ pb = new QPushButton(__tr2qs("&Browse..."),m_pNewPathBox);
+ connect(pb,SIGNAL(clicked()),this,SLOT(chooseDataPath()));
+
+ m_pNewPathBox->setSpacing(3);
+ m_pNewPathBox->setStretchFactor(m_pDataPathEdit,1);
+
+#ifdef COMPILE_ON_WINDOWS
+ tmp = QTextCodec::codecForLocale()->toUnicode(getenv( "APPDATA" ));
+ if(tmp.isEmpty())
+ tmp = QDir::homeDirPath();
+#else
+ tmp = QDir::homeDirPath();
+#endif //COMPILE_ON_WINDOWS
+ KviQString::ensureLastCharIs(tmp,KVI_PATH_SEPARATOR_CHAR);
+ tmp.append(KVI_LOCAL_KVIRC_SUBDIRECTORY_NAME);
+ KviFileUtils::adjustFilePath(tmp);
+ m_pDataPathEdit->setText(tmp);
+
+
+
+ l = new QLabel(m_pDirButtonGroup);
+ l->setText(__tr2qs("Download files to folder:"));
+
+
+ m_pNewIncomingBox = new QHBox(m_pDirButtonGroup);
+
+ m_pIncomingPathEdit = new QLineEdit(m_pNewIncomingBox);
+
+ pb = new QPushButton(__tr2qs("&Browse..."),m_pNewIncomingBox);
+ connect(pb,SIGNAL(clicked()),this,SLOT(chooseIncomingPath()));
+
+ m_pNewIncomingBox->setSpacing(3);
+ m_pNewIncomingBox->setStretchFactor(m_pIncomingPathEdit,1);
+
+ tmp = QDir::homeDirPath();
+ KviQString::ensureLastCharIs(tmp,KVI_PATH_SEPARATOR_CHAR);
+ tmp.append(KVI_DEFAULT_INCOMING_SUBDIRECTORY_NAME);
+ KviFileUtils::adjustFilePath(tmp);
+ m_pIncomingPathEdit->setText(tmp);
+
+ m_pDirUseNew->toggle();
+ newDirClicked();
+
+#ifdef COMPILE_ON_WINDOWS
+ m_pDirMakePortable = new QRadioButton(__tr2qs("All settings in shared program folder (portable)")
+ ,m_pDirButtonGroup);
+#endif
+ m_pDirRestore = new QRadioButton(__tr2qs("Restore from backup archive"),m_pDirButtonGroup);
+ m_pDirRestore->setEnabled(FALSE);
+
+ l = new QLabel(m_pDirectory->m_pVBox,"<b> </b>");
+
+ m_pDirectory->m_pVBox->setStretchFactor(m_pDirectory->m_pTextLabel,1);
+
+ setHelpEnabled(m_pDirectory,false);
+
+ connect(m_pDataPathEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(newDataTextChanged ( const QString & )));
+ connect(m_pIncomingPathEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(newIncomingTextChanged ( const QString & )));
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Identity
+
+ m_pIdentity = new KviSetupPage(this);
+
+ m_pIdentity->m_pTextLabel->setText(__tr2qs("Please choose a Nickname.<br><br>" \
+ "Your nickname is the name that other IRC users will know you by. " \
+ "It can't contain spaces or punctuation. Some IRC networks will shorten your nickname if it is more than 32 characters " \
+ "long.<br><br>"
+ "If in doubt, just enter the first nick that comes to mind. " \
+ "You will be able to change it later in the Identity properties, or with the /NICK command."));
+
+ QString nick;
+ char * nnn = kvi_getenv("USER");
+ if(nnn)nick = nnn;
+ else nick = "newbie";
+ if(nick.isEmpty())nick = "newbie";
+ if(nick == "root")nick = "newbie";
+//m_pIdentity->m_pVBox
+ QGroupBox * gbox = new QGroupBox(1,QGroupBox::Horizontal,__tr2qs("Basic Properties"),m_pIdentity->m_pVBox);
+
+ m_pNickSelector = new KviStringSelector(gbox,__tr2qs("Nickname:"),&(KVI_OPTION_STRING(KviOption_stringNickname1)),true);
+ m_pNickSelector->setMinimumLabelWidth(120);
+
+ QValidator * v = new QRegExpValidator(QRegExp("[^-0-9 ][^ ]*"),gbox);
+ m_pNickSelector->setValidator(v);
+
+ m_pRealNameSelector = new KviStringSelector(gbox,__tr2qs("Real name:"),&(KVI_OPTION_STRING(KviOption_stringRealname)),true);
+ m_pRealNameSelector->setMinimumLabelWidth(120);
+
+
+ QString szOptionalCtcpUserInfo = __tr2qs("This field is optional and will appear as part of the CTCP USERINFO reply.");
+ QString szCenterBegin("<center>");
+ QString szCenterEnd("</center>");
+ QString szTrailing = "<br><br>" + szOptionalCtcpUserInfo + szCenterEnd;
+
+ gbox = new QGroupBox(1,QGroupBox::Horizontal,__tr2qs("Profile"),m_pIdentity->m_pVBox);
+
+ QHBox* hb = new QHBox(gbox);
+ hb->setSpacing(4);
+
+ l = new QLabel(__tr2qs("Age:"),hb);
+ l->setMinimumWidth(120);
+
+ m_pAgeCombo = new QComboBox(hb);
+
+ m_pAgeCombo->insertItem(__tr2qs("Unspecified"));
+ unsigned int i;
+ for(i=1;i<120;i++)
+ {
+ QString tmp;
+ tmp.setNum(i);
+ m_pAgeCombo->insertItem(tmp);
+ }
+
+ bool bOk;
+ i = KVI_OPTION_STRING(KviOption_stringCtcpUserInfoAge).toUInt(&bOk);
+ if(!bOk)i = 0;
+ if(i > 120)i = 120;
+ m_pAgeCombo->setCurrentItem(i);
+
+ hb->setStretchFactor(m_pAgeCombo,1);
+
+
+ hb = new QHBox(gbox);
+ hb->setSpacing(4);
+
+ l = new QLabel(__tr2qs("Gender:"),hb);
+ l->setMinimumWidth(120);
+
+ m_pGenderCombo = new QComboBox(hb);
+
+ m_pGenderCombo->insertItem(__tr2qs("Unspecified"));
+ m_pGenderCombo->insertItem(__tr2qs("Female"));
+ m_pGenderCombo->insertItem(__tr2qs("Male"));
+
+ if(KviQString::equalCI(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender),"Male"))
+ m_pGenderCombo->setCurrentItem(2);
+ else if(KviQString::equalCI(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender),"Female"))
+ m_pGenderCombo->setCurrentItem(1);
+ else
+ m_pGenderCombo->setCurrentItem(0);
+
+ hb->setStretchFactor(m_pGenderCombo,1);
+
+ m_pLocationSelector = new KviStringSelector(gbox,__tr2qs("Location:"),&(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoLocation)),true);
+ m_pLocationSelector->setMinimumLabelWidth(120);
+
+ m_pLanguagesSelector = new KviStringSelector(gbox,__tr2qs("Languages:"),&(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoLanguages)),true);
+ m_pLanguagesSelector->setMinimumLabelWidth(120);
+
+ m_pOtherInfoSelector = new KviStringSelector(gbox,__tr2qs("Other:"),&(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoOther)),true);
+ m_pOtherInfoSelector->setMinimumLabelWidth(120);
+
+ addPage(m_pIdentity,__tr2qs("Identity"));
+
+ l = new QLabel(m_pIdentity->m_pVBox,"<b> </b>");
+
+ setHelpEnabled(m_pIdentity,false);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Default theme
+/* m_pTheme = new KviSetupPage(this);
+ m_pTheme->m_pTextLabel->setText(__tr2qs( \
+ "<p>Here you can choose the default appearance of KVIrc.<br><br>" \
+ "The Fancy Theme uses icons, a transparent background and a lot of colors. " \
+ "The Minimalist Theme is designed for low-color displays " \
+ "or for \"console\" extremists; it's more or less white text on a black background.<br><br>" \
+ "If you had a previous version of KVIrc installed, you can choose to not apply any theme " \
+ "in order to preserve your current visual settings.<br><br>" \
+ "If you don't know what to choose, just use the default.</p>"));
+
+ m_pThemeButtonGroup = new QVButtonGroup(m_pTheme->m_pVBox);
+
+ QHBox* pThemesHb = new QHBox(m_pThemeButtonGroup);
+
+ QVBox* pThemesVb = new QVBox(pThemesHb);
+
+ QString szThemeImagePath;
+ g_pApp->getGlobalKvircDirectory(szThemeImagePath,KviApp::Pics,"kvi_setup_theme_hires.png");
+
+ QPixmap* pHiResPixmap = new QPixmap(szThemeImagePath);
+ if(pHiResPixmap->isNull())
+ {
+ delete pHiResPixmap;
+ pHiResPixmap= new QPixmap(250,200);
+ }
+
+ QLabel* pPixmapLabelHiRes = new QLabel(pThemesVb);
+
+ pPixmapLabelHiRes->setPixmap(*pHiResPixmap);
+ pPixmapLabelHiRes->setFixedSize(pHiResPixmap->size());
+ pPixmapLabelHiRes->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
+ pPixmapLabelHiRes->setMargin(0);
+
+ m_pThemeHiRes = new QRadioButton(__tr2qs("&Fancy Theme"),pThemesVb);
+
+ pThemesVb = new QVBox(pThemesHb);
+ g_pApp->getGlobalKvircDirectory(szThemeImagePath,KviApp::Pics,"kvi_setup_theme_lowres.png");
+ QPixmap* pLowResPixmap = new QPixmap(szThemeImagePath);
+ if(pLowResPixmap->isNull())
+ {
+ delete pLowResPixmap;
+ pLowResPixmap= new QPixmap(250,200);
+ }
+
+ QLabel* pPixmapLabelLowRes = new QLabel(pThemesVb);
+
+ pPixmapLabelLowRes->setPixmap(*pLowResPixmap);
+ pPixmapLabelLowRes->setFixedSize(pLowResPixmap->size());
+ pPixmapLabelLowRes->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
+ pPixmapLabelLowRes->setMargin(0);
+
+ m_pThemeLoRes = new QRadioButton(__tr2qs("&Minimalist Theme"),pThemesVb);
+ m_pThemeNone = new QRadioButton(__tr2qs("&Don't apply any theme"),m_pThemeButtonGroup);
+ m_pThemeButtonGroup->insert(m_pThemeHiRes);
+ m_pThemeButtonGroup->insert(m_pThemeLoRes);
+
+ m_pThemeHiRes->setChecked(true);
+
+ addPage(m_pTheme,__tr2qs("Default Theme"));
+
+ setHelpEnabled(m_pTheme,false);*/
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Server config
+ m_pServers = new KviSetupPage(this);
+
+ m_pServers->m_pTextLabel->setText(__tr2qs( \
+ "Now you should specify an IRC server, to be connected to it"));
+
+
+ m_pServersButtonGroup = new QVButtonGroup(__tr2qs("Choose a server to connect"),m_pServers->m_pVBox);
+
+ m_pServersChooseFromList = new QRadioButton(__tr2qs("Choose from built-in server list"),m_pServersButtonGroup);
+
+ m_pServersSpecifyManually = new QRadioButton(__tr2qs("Specify server manually"),m_pServersButtonGroup);
+ hb = new QHBox(m_pServersButtonGroup);
+
+ m_uServerPort=6667;
+ m_pServerHostSelector = new KviStringSelector(hb,__tr2qs("Server:"),&m_szServerHost,true);
+ m_pServerPortSelector = new KviUIntSelector(hb,__tr2qs("Port:"),&m_uServerPort,1,65536,6667,true,false);
+
+
+ m_pServersOpenIrcUrl = new QRadioButton(__tr2qs("Open irc:// or irc6:// URL"),m_pServersButtonGroup);
+ m_szServerUrl="irc://";
+ m_pServerUrlSelector = new KviStringSelector(m_pServersButtonGroup,__tr2qs("URL:"),&m_szServerUrl,true);
+
+ m_pServersLoadConfig = new QRadioButton(__tr2qs("Use server config"),m_pServersButtonGroup);
+ m_pServersLoadConfig->setEnabled(FALSE);
+ m_pServerConfigSelector = new KviFileSelector(m_pServersButtonGroup,__tr2qs("Config file:"),&m_szServerConfigFile,true);
+ m_pServerConfigSelector->setEnabled(FALSE);
+
+ m_pServersChooseFromList->toggle();
+ addPage(m_pServers,__tr2qs("Choose a server to connect"));
+ setFinishEnabled(m_pServers,true);
+ setHelpEnabled(m_pServers,false);
+
+ // Preconfigured values
+#ifdef COMPILE_ON_WINDOWS
+ QString szTmp;
+ g_pApp->getGlobalKvircDirectory(szTmp,KviApp::Config,"preinstalled.kvc");
+ if(KviFileUtils::fileExists(szTmp))
+ {
+ KviConfig cfg(szTmp,KviConfig::Read);
+ cfg.setGroup("Setup");
+ if(cfg.readBoolEntry("hideServerList",FALSE)) {
+ setAppropriate(m_pServers,false);
+ setFinishEnabled(m_pIdentity,true);
+ KVI_OPTION_BOOL(KviOption_boolShowChannelsJoinOnIrc) = false;
+ KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = false;
+ }
+ int iDir;
+ iDir=cfg.readIntEntry("settingsDir",-1);
+ if(iDir>0) {
+ switch(iDir)
+ {
+ case 1:
+ m_pDirUseNew->toggle();
+ setAppropriate(m_pDirectory,false);
+ break;
+ case 2:
+ m_pDirMakePortable->toggle();
+ setAppropriate(m_pDirectory,false);
+ break;
+ }
+ }
+ }
+#endif
+}
+
+
+KviSetupWizard::~KviSetupWizard()
+{
+ delete m_pLabelPixmap;
+}
+
+void KviSetupWizard::oldDirClicked()
+{
+ m_pOldPathBox->setEnabled(true);
+ m_pNewPathBox->setEnabled(false);
+ m_pNewIncomingBox->setEnabled(false);
+
+ if(m_pIdentity) setAppropriate(m_pIdentity,false);
+// if(m_pTheme) setAppropriate(m_pTheme,false);
+ if(m_pServers) setAppropriate(m_pServers,false);
+
+ if(m_pOldDataPathEdit->text().isEmpty()) setNextEnabled(m_pDirectory,false);
+ else setNextEnabled(m_pDirectory,true);
+}
+
+void KviSetupWizard::oldDataTextChanged ( const QString & str)
+{
+ setNextEnabled(m_pDirectory,!str.isEmpty());
+}
+
+void KviSetupWizard::newDataTextChanged ( const QString & str)
+{
+ setNextEnabled(m_pDirectory,!str.isEmpty() && !m_pIncomingPathEdit->text().isEmpty());
+}
+
+void KviSetupWizard::newIncomingTextChanged ( const QString & str)
+{
+ setNextEnabled(m_pDirectory,!str.isEmpty() && !m_pDataPathEdit->text().isEmpty());
+}
+
+void KviSetupWizard::newDirClicked()
+{
+ m_pOldPathBox->setEnabled(false);
+ m_pNewPathBox->setEnabled(true);
+ m_pNewIncomingBox->setEnabled(true);
+
+ if(m_pIdentity) setAppropriate(m_pIdentity,true);
+// if(m_pTheme) setAppropriate(m_pTheme,true);
+ if(m_pServers) setAppropriate(m_pServers,true);
+
+ if(m_pDataPathEdit->text().isEmpty() || m_pIncomingPathEdit->text().isEmpty()) setNextEnabled(m_pDirectory,false);
+ else setNextEnabled(m_pDirectory,true);
+}
+void KviSetupWizard::chooseOldDataPath()
+{
+ QString szBuffer = KviTalFileDialog::getExistingDirectoryPath(m_pDataPathEdit->text(),__tr2qs("Choose an Old Configuration Folder - KVIrc Setup"),0);
+ if(!szBuffer.isEmpty())
+ {
+ KviQString::ensureLastCharIs(szBuffer,KVI_PATH_SEPARATOR_CHAR);
+ if(!g_pApp->checkLocalKvircDirectory(szBuffer))
+ {
+ if(
+ QMessageBox::question(
+ this,
+ __tr2qs("Do not overwrite folder? - KVIrc"),
+ tr("A folder %1 seems to be not a valid KVIrc settings folder."
+ "Do you want to use it anyway?")
+ .arg( szBuffer ),
+ __tr2qs("&Yes"), __tr2qs("&No"),
+ QString::null, 0, 1 ) == 0
+ ) {
+ m_pOldDataPathEdit->setText(szBuffer);
+ }
+ } else {
+ m_pOldDataPathEdit->setText(szBuffer);
+ }
+ }
+}
+
+void KviSetupWizard::chooseDataPath()
+{
+ QString szBuffer = KviTalFileDialog::getExistingDirectoryPath(m_pDataPathEdit->text(),__tr2qs("Choose a Configuration Folder - KVIrc Setup"),0);
+ if(!szBuffer.isEmpty())
+ {
+ KviQString::ensureLastCharIs(szBuffer,KVI_PATH_SEPARATOR_CHAR);
+ m_pDataPathEdit->setText(szBuffer);
+ }
+}
+
+void KviSetupWizard::chooseIncomingPath()
+{
+ //QString szBuffer = QFileDialog::getExistingDirectory(m_pIncomingPathEdit->text(),0,0,__tr2qs("Choose the download folder"));
+ QString szBuffer = KviTalFileDialog::getExistingDirectoryPath(m_pIncomingPathEdit->text(),__tr2qs("Choose a Download Folder - KVIrc Setup"),0);
+ if(!szBuffer.isEmpty())
+ {
+ m_pIncomingPathEdit->setText(szBuffer);
+ }
+}
+
+/*
+void KviSetupWizard::directorySelected(const QString &szDir)
+{
+ KviStr szDirectory = szDir;
+ kvi_adjustFilePath(szDirectory);
+ szDirectory.ensureLastCharIs(KVI_PATH_SEPARATOR_CHAR);
+ szDirectory.append(KVI_LOCAL_KVIRC_SUBDIRECTORY_NAME);
+ szDirectory.ensureLastCharIs(KVI_PATH_SEPARATOR_CHAR);
+ kvi_adjustFilePath(szDirectory);
+ m_pDirectoryEdit->setText(szDirectory.ptr());
+}
+*/
+
+void KviSetupWizard::makeLink()
+{
+#ifdef COMPILE_ON_WINDOWS
+ // Let's make a link on the desktop :)
+ // You need this horrible snippet of code to create a shortcut!!!!
+ //
+ // you have to:
+ // - dig in the registry ,
+ // - trigger the entire COM subsystem
+ // - bring up a couple of OLE interfaces....
+ // - use some obscure functions like MultiByteToWideChar
+ // - and the finally drop the entire OLE+COM interface in the garbadge
+ // ...
+ // Isn't this horrible ? (compared to symlink()!)
+ //
+
+ // Well..let's go (please note that we don't handle most possible errors!
+ // otherwise there would be 150 lines for a stupid symlink!)
+
+ HKEY hCU;
+ DWORD lpType;
+ ULONG ulSize = MAX_PATH;
+ char szLink[MAX_PATH];
+
+ // Dig in the registry looking up the Desktop path
+ if(RegOpenKeyEx(HKEY_CURRENT_USER,
+ "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
+ 0,KEY_QUERY_VALUE,&hCU) == ERROR_SUCCESS)
+ {
+ RegQueryValueEx(hCU,"Desktop",NULL,&lpType,
+ (unsigned char *)&szLink,&ulSize);
+ RegCloseKey(hCU);
+ }
+
+ // Build our paths
+ QString szLinkTarget = szLink;
+ szLinkTarget.append("\\kvirc.lnk");
+
+ QString szKvircExec = g_pApp->m_szGlobalKvircDir;
+ szKvircExec.append("\\kvirc.exe");
+
+ // Trigger a horrible machinery
+ CoInitialize(NULL); // we need COM+OLE
+
+ // Fiddle with an obscure shell interface
+ IShellLink* psl;
+
+ // Get a pointer to the IShellLink interface: this is kinda ugly :)
+ if(CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,
+ IID_IShellLink,(void **)&psl) == S_OK)
+ {
+ // just for fun , lookup another shell interface
+
+ IPersistFile* ppf;
+
+ // Query IShellLink for the IPersistFile interface for
+ // saving the shell link in persistent storage.
+ if(psl->QueryInterface(IID_IPersistFile,(void **)&ppf) == S_OK)
+ {
+ WORD wsz[MAX_PATH];
+ // Set the path to the shell link target.
+ psl->SetPath(QTextCodec::codecForLocale()->fromUnicode(szKvircExec).data());
+ // Set the description of the shell link.
+ psl->SetDescription("kvirc");
+ // Ensure string is ANSI.
+ MultiByteToWideChar(CP_ACP,0,QTextCodec::codecForLocale()->fromUnicode(szLinkTarget).data(),-1,(LPWSTR)wsz,MAX_PATH);
+ // Save the link via the IPersistFile::Save method.
+ ppf->Save((LPCOLESTR)wsz,true);
+ ppf->Release();
+ }
+ psl->Release();
+ }
+ // And throw OLE & Co. in the garbadge
+ CoUninitialize();
+#endif //COMPILE_ON_WINDOWS
+
+#ifdef COMPILE_KDE_SUPPORT
+ QString tmp = QDir::homeDirPath();
+ KviQString::ensureLastCharIs(tmp,KVI_PATH_SEPARATOR_CHAR);
+ tmp.append("Desktop");
+ KviQString::ensureLastCharIs(tmp,KVI_PATH_SEPARATOR_CHAR);
+ tmp.append("kvirc.desktop");
+
+ QString contents = "[Desktop Entry]\n" \
+ "GenericName=IRC Client\n" \
+ "Comment=Connect to Internet Relay Chat\n" \
+ "Exec=kvirc -m %u\n" \
+ "Icon=kvirc\n" \
+ "MapNotify=true\n" \
+ "Name=KVIrc 3\n" \
+ "Terminal=false\n" \
+ "Type=Application\n" \
+ "X-KDE-SubstituteUID=false\n";
+
+ KviFileUtils::writeFile(tmp,contents,false);
+#endif //COMPILE_KDE_SUPPORT
+
+}
+
+void KviSetupWizard::setUrlHandlers()
+{
+#ifdef COMPILE_ON_WINDOWS
+ QString szReg = "REGEDIT4\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc]\r\n" \
+ "@=\"URL:IRC Protocol\"\r\n" \
+ "\"IRC Protocol\"=\"http://www.kvirc.net/\"\r\n" \
+ "\"EditFlags\"=hex:02,00,00,00\r\n" \
+ "\"URL Protocol\"=""\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc\\DefaultIcon]\r\n" \
+ "@=\"\\\"@KVIRCEXECUTABLE@\\\"\"\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc\\shell]\r\n" \
+ "@=\"\"\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc\\shell\\open]\r\n" \
+ "\"EditFlags\"=hex:01,00,00,00\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc\\shell\\open\\command]\r\n" \
+ "@=\"\\\"@KVIRCEXECUTABLE@\\\" %1\"\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc6]\r\n" \
+ "@=\"URL:IRC6 Protocol\"\r\n" \
+ "\"IRC6 Protocol\"=\"http://www.kvirc.net/\"\r\n" \
+ "\"EditFlags\"=hex:02,00,00,00\r\n" \
+ "\"URL Protocol\"=""\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc6\\DefaultIcon]\r\n" \
+ "@=\"\\\"@KVIRCEXECUTABLE@\\\"\"\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc6\\shell]\r\n" \
+ "@=\"\"\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc6\\shell\\open]\r\n" \
+ "\"EditFlags\"=hex:01,00,00,00\r\n" \
+ "\r\n" \
+ "[HKEY_CLASSES_ROOT\\irc6\\shell\\open\\command]\r\n" \
+ "@=\"\\\"@KVIRCEXECUTABLE@\\\" %1\"\r\n";
+
+ QString szKvircExec = g_pApp->m_szGlobalKvircDir;
+ szKvircExec.append("\\kvirc.exe");
+ szKvircExec.replace("\\","\\\\");
+
+ szReg.replace("@KVIRCEXECUTABLE@",QTextCodec::codecForLocale()->fromUnicode(szKvircExec));
+
+ QString szRegFile = g_pApp->m_szGlobalKvircDir;
+ szRegFile.append("\\kvirc.reg");
+
+ KviFileUtils::writeFile(szRegFile,szReg,false);
+
+ QString szCmd = "regedit /S \"";
+ szCmd += szRegFile;
+ szCmd += "\"";
+
+ WinExec(QTextCodec::codecForLocale()->fromUnicode(szCmd).data(),SW_SHOW);
+#endif
+}
+
+void KviSetupWizard::reject()
+{
+ if(QMessageBox::warning(this,__tr2qs("Abort Setup - KVIrc Setup"),
+ __tr2qs("You have chosen to abort the setup.<br>KVIrc cannot run until you complete this procedure.<br><br>Do you really wish to abort?"),
+ QMessageBox::Yes,QMessageBox::No|QMessageBox::Default|QMessageBox::Escape) != QMessageBox::Yes)return;
+
+ QWizard::reject();
+}
+
+void KviSetupWizard::accept()
+{
+ QString szDir;
+
+ if(m_pDirUsePrev->isOn())
+ {
+ bNeedToApplyDefaults=false;
+ g_pApp->m_szLocalKvircDir = m_pOldDataPathEdit->text();
+ } else {
+ bNeedToApplyDefaults=true;
+ if(m_pDirUseNew->isOn()) {
+ szDir = m_pDataPathEdit->text();
+ }
+#ifdef COMPILE_ON_WINDOWS
+ else { //portable
+ szDir = g_pApp->applicationDirPath()+KVI_PATH_SEPARATOR_CHAR+"Settings";
+ }
+#endif
+
+ KviFileUtils::adjustFilePath(szDir);
+ KviQString::ensureLastCharIs(szDir,KVI_PATH_SEPARATOR_CHAR);
+ if(!KviFileUtils::directoryExists(szDir))
+ {
+ if(!KviFileUtils::makeDir(szDir))
+ {
+ KviMessageBox::warning(__tr("Cannot create directory %s.\n" \
+ "You may not have write permission " \
+ "for that path. Please go back and choose another directory."));
+ showPage(m_pDirectory);
+ return;
+ }
+ } /*else {
+ kvi_infoBox(__tr("Kvirc setup"),
+ __tr("The directory '%s' already exists.\n" \
+ "(maybe from a previous Kvirc installation)\n"\
+ "If you experience any problems try deleting the old directory:\n" \
+ "the setup program will be started automatically again."),szDir.ptr());
+ }*/
+
+ g_pApp->m_szLocalKvircDir = szDir;
+ KviFileUtils::adjustFilePath(g_pApp->m_szLocalKvircDir);
+
+ if(m_pDirUseNew->isOn()) {
+ szDir = m_pIncomingPathEdit->text();
+ }
+#ifdef COMPILE_ON_WINDOWS
+ else { //portable
+ szDir = g_pApp->applicationDirPath()+KVI_PATH_SEPARATOR_CHAR+"Downloads";
+ }
+#endif
+
+ KviFileUtils::adjustFilePath(szDir);
+ if(!KviFileUtils::directoryExists(szDir))
+ {
+ if(!KviFileUtils::makeDir(szDir))
+ {
+ KviMessageBox::warning(__tr("Cannot create directory %s.\n" \
+ "You may not have write permission " \
+ "for that path. Please go back and choose another directory."));
+ showPage(m_pDirectory);
+ return;
+ }
+ }
+
+ g_szChoosenIncomingDirectory = szDir;
+
+#ifndef COMPILE_ON_WINDOWS
+ // Make local->global link
+ QString localPath = QString("%1/global").arg(g_pApp->m_szLocalKvircDir);
+ unlink(QTextCodec::codecForLocale()->fromUnicode(localPath).data());
+ symlink(QTextCodec::codecForLocale()->fromUnicode(g_pApp->m_szGlobalKvircDir).data(),QTextCodec::codecForLocale()->fromUnicode(localPath).data());
+#endif
+
+#ifdef COMPILE_KDE_SUPPORT
+ if(m_pCreateDesktopShortcut->isChecked())
+ makeLink();
+#endif
+
+#ifdef COMPILE_ON_WINDOWS
+ if(m_pCreateUrlHandlers->isChecked())
+ setUrlHandlers();
+#endif
+
+/* if(m_pTheme)
+ {
+ if(m_pThemeButtonGroup->selected() == m_pThemeHiRes)
+ {
+ g_iThemeToApply = THEME_APPLY_HIRES;
+ } else if(m_pThemeButtonGroup->selected() == m_pThemeLoRes)
+ {
+ g_iThemeToApply = THEME_APPLY_LORES;
+ } else {
+ g_iThemeToApply = THEME_APPLY_NONE;
+ }
+ }
+*/
+ if(m_pIdentity)
+ {
+ m_pNickSelector->commit();
+ m_pRealNameSelector->commit();
+ m_pLocationSelector->commit();
+ m_pLanguagesSelector->commit();
+ m_pOtherInfoSelector->commit();
+
+ KVI_OPTION_STRING(KviOption_stringNickname1).stripWhiteSpace();
+ KVI_OPTION_STRING(KviOption_stringNickname1).replace(" ","");
+
+ if(KVI_OPTION_STRING(KviOption_stringNickname1).length() > 32)
+ {
+ QString tmp = KVI_OPTION_STRING(KviOption_stringNickname1).left(32);
+ KVI_OPTION_STRING(KviOption_stringNickname1) = tmp;
+ }
+
+ if(KVI_OPTION_STRING(KviOption_stringNickname1).isEmpty())KVI_OPTION_STRING(KviOption_stringNickname1) = "newbie";
+
+ QString szNickPart;
+ if(KVI_OPTION_STRING(KviOption_stringNickname1).length() < 31)
+ {
+ szNickPart = KVI_OPTION_STRING(KviOption_stringNickname1);
+ } else {
+ szNickPart = KVI_OPTION_STRING(KviOption_stringNickname1).left(30);
+ }
+
+ QString alt = szNickPart;
+ alt.prepend("|"); // <-- this is an erroneous nickname on IrcNet :/
+ alt.append("|");
+ KVI_OPTION_STRING(KviOption_stringNickname2) = alt;
+ alt = szNickPart;
+ alt.prepend("_");
+ alt.append("_");
+ KVI_OPTION_STRING(KviOption_stringNickname3) = alt;
+ alt = szNickPart;
+ alt.append("2");
+ KVI_OPTION_STRING(KviOption_stringNickname4) = alt;
+
+ int i = m_pAgeCombo->currentItem();
+ if(i < 0)i = 0;
+ if(i > 120)i = 120;
+ if(i <= 0)KVI_OPTION_STRING(KviOption_stringCtcpUserInfoAge) = "";
+ else KVI_OPTION_STRING(KviOption_stringCtcpUserInfoAge).setNum(i);
+
+ switch(m_pGenderCombo->currentItem())
+ {
+ case 1:
+ // this should be in english
+ KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender) = "Female";
+ break;
+ case 2:
+ // this should be in english
+ KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender) = "Male";
+ break;
+ default:
+ KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender) = "";
+ break;
+ }
+
+ m_pServerHostSelector->commit();
+ m_pServerUrlSelector->commit();
+ m_pServerConfigSelector->commit();
+ m_pServerPortSelector->commit();
+
+ if(m_pServersSpecifyManually->isOn())
+ {
+ KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = FALSE;
+ szHost = m_szServerHost;
+ uPort=m_uServerPort;
+ } else if(m_pServersOpenIrcUrl->isOn())
+ {
+ KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = FALSE;
+ szUrl=m_szServerUrl;
+ }
+ }
+ }
+#ifdef COMPILE_ON_WINDOWS
+ if(m_pDirMakePortable->isOn()) {
+ KviFileUtils::writeFile(g_pApp->applicationDirPath()+KVI_PATH_SEPARATOR_CHAR+"portable","true");
+ } else {
+#endif
+ g_pApp->saveKvircDirectory();
+#ifdef COMPILE_ON_WINDOWS
+ }
+#endif
+ QWizard::accept();
+}
+
+#include "setupwizard.moc"
diff --git a/src/modules/setup/setupwizard.h b/src/modules/setup/setupwizard.h
new file mode 100644
index 000000000..6457767aa
--- /dev/null
+++ b/src/modules/setup/setupwizard.h
@@ -0,0 +1,148 @@
+#ifndef _SETUPWIZARD_H_
+#define _SETUPWIZARD_H_
+//
+// File : setupwizard.h
+// Creation date : Sat Oct 6 02:06:51 2001 GMT by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001 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 <qwizard.h>
+#include <qvbox.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <qlineedit.h>
+#include <qvbuttongroup.h>
+#include <qradiobutton.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+
+#include "kvi_settings.h"
+#include "kvi_string.h"
+#include "kvi_selectors.h"
+
+class KviSetupWizard;
+
+class KviSetupPage : public QHBox
+{
+ Q_OBJECT
+public:
+ KviSetupPage(KviSetupWizard * w);
+ ~KviSetupPage();
+public:
+ QVBox * m_pVBox;
+ QLabel * m_pPixmapLabel;
+ QLabel * m_pTextLabel;
+
+};
+
+
+#define THEME_APPLY_NONE 0
+#define THEME_APPLY_HIRES 1
+#define THEME_APPLY_LORES 2
+
+class KviSetupWizard : public QWizard
+{
+ Q_OBJECT
+public:
+ KviSetupWizard();
+ ~KviSetupWizard();
+public:
+ QPixmap * m_pLabelPixmap;
+
+ KviSetupPage * m_pWelcome;
+ KviSetupPage * m_pLicense;
+ KviSetupPage * m_pDirectory;
+ KviSetupPage * m_pIdentity;
+// KviSetupPage * m_pTheme;
+ KviSetupPage * m_pServers;
+
+ // Theme
+ QVButtonGroup * m_pThemeButtonGroup;
+ QRadioButton * m_pThemeHiRes;
+ QRadioButton * m_pThemeLoRes;
+ QRadioButton * m_pThemeNone;
+
+ // Welcome
+ QCheckBox * m_pCreateUrlHandlers;
+ QCheckBox * m_pCreateDesktopShortcut;
+
+ //Dir
+ QLineEdit * m_pDataPathEdit;
+ QLineEdit * m_pIncomingPathEdit;
+ QVButtonGroup * m_pDirButtonGroup;
+ QRadioButton * m_pDirUsePrev;
+ QRadioButton * m_pDirUseNew;
+#ifdef COMPILE_ON_WINDOWS
+ QRadioButton * m_pDirMakePortable;
+#endif
+ QRadioButton * m_pDirRestore;
+ QLineEdit * m_pOldDataPathEdit;
+ QHBox * m_pOldPathBox;
+ QHBox * m_pNewPathBox;
+ QHBox * m_pNewIncomingBox;
+
+ //Identify
+ QComboBox * m_pAgeCombo;
+ QComboBox * m_pGenderCombo;
+
+ KviStringSelector * m_pNickSelector;
+ KviStringSelector * m_pRealNameSelector;
+ KviStringSelector * m_pLocationSelector;
+ KviStringSelector * m_pLanguagesSelector;
+ KviStringSelector * m_pOtherInfoSelector;
+
+ //Servers
+ QVButtonGroup * m_pServersButtonGroup;
+ QRadioButton * m_pServersChooseFromList;
+ QRadioButton * m_pServersSpecifyManually;
+ QRadioButton * m_pServersOpenIrcUrl;
+ QRadioButton * m_pServersLoadConfig;
+
+ QString m_szServerConfigFile;
+ QString m_szServerUrl;
+ QString m_szServerHost;
+ unsigned int m_uServerPort;
+
+ KviStringSelector * m_pServerHostSelector;
+ KviStringSelector * m_pServerUrlSelector;
+ KviFileSelector * m_pServerConfigSelector;
+ KviUIntSelector *m_pServerPortSelector;
+
+protected:
+ void makeLink();
+ void setUrlHandlers();
+public slots:
+ void chooseOldDataPath();
+ void chooseDataPath();
+ void chooseIncomingPath();
+ virtual void accept();
+ virtual void reject();
+
+ void oldDirClicked();
+ void newDirClicked();
+
+ void oldDataTextChanged ( const QString & );
+ void newDataTextChanged ( const QString & );
+ void newIncomingTextChanged ( const QString & );
+};
+
+
+#endif //_SETUPWIZARD_H_