aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Fabio Bas2010-03-19 14:24:09 +0000
committerGravatar Fabio Bas2010-03-19 14:24:09 +0000
commitf112ff76dd05cd57e1441b33be28c94a5afafc97 (patch)
tree64cba79a294b4116e6e526f93a0b8d6fc70d5ca9
parentfix for missing first console on kvirc startup (diff)
downloadKVIrc-f112ff76dd05cd57e1441b33be28c94a5afafc97.tar.gz
KVIrc-f112ff76dd05cd57e1441b33be28c94a5afafc97.tar.bz2
KVIrc-f112ff76dd05cd57e1441b33be28c94a5afafc97.zip
fixed lcd object documentation
fixed help for local help files (script documentation) git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4154 17fca916-40b9-46aa-a4ea-0a15b648b75c
-rw-r--r--src/modules/help/libkvihelp.cpp46
-rw-r--r--src/modules/objects/class_lcd.cpp6
-rw-r--r--src/modules/objects/class_lcd.h14
3 files changed, 41 insertions, 25 deletions
diff --git a/src/modules/help/libkvihelp.cpp b/src/modules/help/libkvihelp.cpp
index c46df04d8..9d634afe8 100644
--- a/src/modules/help/libkvihelp.cpp
+++ b/src/modules/help/libkvihelp.cpp
@@ -90,31 +90,47 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c)
KVSM_PARAMETER("document",KVS_PT_STRING,KVS_PF_OPTIONAL | KVS_PF_APPENDREMAINING,szParam)
KVSM_PARAMETERS_END(c)
- szDoc=szParam;
- g_pApp->getGlobalKvircDirectory(szHelpDir,KviApp::Help);
- dirHelp = QDir(szHelpDir);
-
// no document => index
- if(szDoc.isEmpty())
+ if(szParam.isEmpty())
{
- szDoc = dirHelp.absoluteFilePath("index.html");
- //qDebug ("No file, use default at path %s",szDoc.toUtf8().data());
+ szParam = dirHelp.absoluteFilePath("index.html");
+ qDebug ("No file, use default at path %s",szDoc.toUtf8().data());
}
+ /*
+ * Path checking order:
+ * 1) absolute path
+ * 2) local help (in user directory)
+ * 3) global help (in kvirc directory)
+ */
+
// try absolute path
- QFileInfo * f= new QFileInfo(szDoc);
+ QFileInfo * f= new QFileInfo(szParam);
if(!f->exists())
{
- //try relative path
- szDoc = dirHelp.absoluteFilePath(szDoc);
- //qDebug("No abs path, trying relative path: %s",szDoc.toUtf8().data());
+ // try relative path (to local help)
+ g_pApp->getLocalKvircDirectory(szHelpDir,KviApp::Help);
+ dirHelp = QDir(szHelpDir);
+ szDoc = dirHelp.absoluteFilePath(szParam);
+ qDebug("No abs path, trying local relative path: %s",szDoc.toUtf8().data());
f->setFile(szDoc);
+
+ if(!f->exists())
+ {
+ //try relative path (to global help)
+ g_pApp->getGlobalKvircDirectory(szHelpDir,KviApp::Help);
+ dirHelp = QDir(szHelpDir);
+
+ szDoc = dirHelp.absoluteFilePath(szParam);
+ qDebug("No local relative, trying global relative path: %s",szDoc.toUtf8().data());
+ f->setFile(szDoc);
+ }
}
+ // Search in help
if(!f->exists())
{
- //try search
- //qDebug("No rel path, trying search..");
+ qDebug("No path, trying search..");
if(g_pDocIndex)
{
if (!g_pDocIndex->documentList().count())
@@ -150,12 +166,12 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c)
}
}
+ // Everything failed => error
if(!f->exists())
{
- //everything failed => error
szDoc = dirHelp.absoluteFilePath("nohelpavailable.html");
- //qDebug("Document not found, defaulting to error page: %s",szDoc.toUtf8().data());
+ qDebug("Document not found, defaulting to error page: %s",szDoc.toUtf8().data());
f->setFile(szDoc);
}
diff --git a/src/modules/objects/class_lcd.cpp b/src/modules/objects/class_lcd.cpp
index 518e93bbd..d04c304bf 100644
--- a/src/modules/objects/class_lcd.cpp
+++ b/src/modules/objects/class_lcd.cpp
@@ -47,11 +47,11 @@
It can display a number in just about any size. It can display decimal,
hexadecimal, octal or binary numbers.
@functions:
- !fn: $setDisplayStr(<number:string>)
+ !fn: $displayStr(<number:string>)
Displays the number represented by the string s.
- !fn: $setDisplayInt(<number:integer>)
+ !fn: $displayInt(<number:integer>)
Sets the displayed value rounded to the nearest integer to number.
- !fn: $setDisplayDouble(<number:double>)
+ !fn: $displayDouble(<number:double>)
Sets the displayed value to number (double).
!fn: $setMode(<mode:string>)
Sets the current display mode (number base): valid mode are HEX,BIN,OCT,DEC.
diff --git a/src/modules/objects/class_lcd.h b/src/modules/objects/class_lcd.h
index a3b274bdb..2b6daa78e 100644
--- a/src/modules/objects/class_lcd.h
+++ b/src/modules/objects/class_lcd.h
@@ -40,13 +40,13 @@ protected:
virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
bool displayStr(KviKvsObjectFunctionCall *c);
- bool setMode(KviKvsObjectFunctionCall *c);
- bool setSegmentStyle(KviKvsObjectFunctionCall *c);
- bool setNumDigits(KviKvsObjectFunctionCall *c);
- bool setSmallDecimalPoint(KviKvsObjectFunctionCall *c);
- bool checkOverflow(KviKvsObjectFunctionCall *c);
- bool displayInt(KviKvsObjectFunctionCall *c);
- bool displayDouble(KviKvsObjectFunctionCall *c);
+ bool setMode(KviKvsObjectFunctionCall *c);
+ bool setSegmentStyle(KviKvsObjectFunctionCall *c);
+ bool setNumDigits(KviKvsObjectFunctionCall *c);
+ bool setSmallDecimalPoint(KviKvsObjectFunctionCall *c);
+ bool checkOverflow(KviKvsObjectFunctionCall *c);
+ bool displayInt(KviKvsObjectFunctionCall *c);
+ bool displayDouble(KviKvsObjectFunctionCall *c);
};
#endif // !_CLASS_LCD_H_