aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/addon/managementdialog.cpp
diff options
context:
space:
mode:
authorGravatar Elvio Basello2008-05-14 16:18:26 +0000
committerGravatar Elvio Basello2008-05-14 16:18:26 +0000
commit5282c76613ec040d7d47eed4e8b1fd0c8aafcdb7 (patch)
tree5960c64104f8e34fde85185e464a7479047079a0 /src/modules/addon/managementdialog.cpp
parentadded missing .desktop file installation rules (diff)
downloadKVIrc-5282c76613ec040d7d47eed4e8b1fd0c8aafcdb7.tar.gz
KVIrc-5282c76613ec040d7d47eed4e8b1fd0c8aafcdb7.tar.bz2
KVIrc-5282c76613ec040d7d47eed4e8b1fd0c8aafcdb7.zip
more work on addon manager (wip);
added file filters; git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1777 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/addon/managementdialog.cpp')
-rw-r--r--src/modules/addon/managementdialog.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/modules/addon/managementdialog.cpp b/src/modules/addon/managementdialog.cpp
index d968b25c1..646e7698a 100644
--- a/src/modules/addon/managementdialog.cpp
+++ b/src/modules/addon/managementdialog.cpp
@@ -24,6 +24,7 @@
#include "managementdialog.h"
#include "packaddondialog.h"
+#include "addonfunctions.h"
#include "kvi_app.h"
#include "kvi_locale.h"
@@ -277,17 +278,32 @@ void KviScriptManagementDialog::getMoreScripts()
void KviScriptManagementDialog::installScript()
{
- QString buffer;
+ QString szFileName, szError;
- if(!KviFileDialog::askForOpenFileName(buffer,__tr2qs("Please select the addon installation file"),QString::null,"install.kvs",false,true))return;
+ if(!KviFileDialog::askForOpenFileName(szFileName,__tr2qs("Please select the addon installation file"),QString::null,KVI_FILTER_SCRIPTS,false,true))return;
- buffer.replace("\\","\\\\");
+ szFileName.replace("\\","\\\\");
- QString szCmd = "parse \"";
- szCmd += buffer;
- szCmd += "\"";
-
- KviKvsScript::run(szCmd,g_pActiveWindow);
+ // Switch between script and addon
+ if(szFileName.endsWith(".kvs"))
+ {
+ QString szCmd = "parse \"";
+ szCmd += szFileName;
+ szCmd += "\"";
+
+ KviKvsScript::run(szCmd,g_pActiveWindow);
+ } else if(szFileName.endsWith(".kva")){
+ if(!KviAddonFunctions::installAddonPackage(szFileName,szError,this))
+ {
+ KviMessageBox::information(szError);
+ return;
+ }
+ } else {
+ // Just for sanity check. We should NEVER enter here
+ QString szError;
+ KviAddonFunctions::notAValidAddonPackage(szError);
+ QMessageBox::critical(this,__tr2qs_ctx("Install Addon - KVIrc","addon"),szError,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
+ }
fillListView();
currentChanged(0,0);