result list: show preview and edit links only when they can be used
This commit is contained in:
parent
516a588d04
commit
b42df0c260
@ -1 +1 @@
|
|||||||
1.3.1
|
1.3.1pre2
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# @(#$Id: Makefile,v 1.9 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes
|
# @(#$Id: Makefile,v 1.10 2006-03-29 13:08:08 dockes Exp $ (C) 2005 J.F.Dockes
|
||||||
depth = ..
|
depth = ..
|
||||||
include $(depth)/mk/sysconf
|
include $(depth)/mk/sysconf
|
||||||
|
|
||||||
@ -32,6 +32,14 @@ trinternfile.o : internfile.cpp
|
|||||||
$(CXX) $(ALL_CXXFLAGS) -DTEST_INTERNFILE -c -o trinternfile.o \
|
$(CXX) $(ALL_CXXFLAGS) -DTEST_INTERNFILE -c -o trinternfile.o \
|
||||||
internfile.cpp
|
internfile.cpp
|
||||||
|
|
||||||
|
RCLCONFIG_OBJS= trrclconfig.o $(BIGLIB) $(MIMELIB)
|
||||||
|
rclconfig : $(RCLCONFIG_OBJS)
|
||||||
|
$(CXX) $(ALL_CXXFLAGS) -o rclconfig $(RCLCONFIG_OBJS) \
|
||||||
|
$(LIBICONV) $(LIBSYS)
|
||||||
|
trrclconfig.o : rclconfig.cpp
|
||||||
|
$(CXX) $(ALL_CXXFLAGS) -DTEST_RCLCONFIG -c -o trrclconfig.o \
|
||||||
|
rclconfig.cpp
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o $(PROGS)
|
rm -f *.o $(PROGS)
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.25 2006-03-29 11:18:14 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.26 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -17,6 +17,7 @@ static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.25 2006-03-29 11:18:14 dockes E
|
|||||||
* Free Software Foundation, Inc.,
|
* Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
#ifndef TEST_RCLCONFIG
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -384,3 +385,39 @@ void RclConfig::initFrom(const RclConfig& r)
|
|||||||
defcharset = r.defcharset;
|
defcharset = r.defcharset;
|
||||||
guesscharset = r.guesscharset;
|
guesscharset = r.guesscharset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else // -> Test
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <list>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "debuglog.h"
|
||||||
|
#include "rclinit.h"
|
||||||
|
#include "rclconfig.h"
|
||||||
|
|
||||||
|
int main(int, const char **)
|
||||||
|
{
|
||||||
|
string reason;
|
||||||
|
RclConfig *config = recollinit(0, 0, reason);
|
||||||
|
if (config == 0 || !config->ok()) {
|
||||||
|
cerr << "Configuration problem: " << reason << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
list<string> names = config->getConfNames("");
|
||||||
|
names.sort();
|
||||||
|
names.unique();
|
||||||
|
for (list<string>::iterator it = names.begin(); it != names.end();it++) {
|
||||||
|
string value;
|
||||||
|
config->getConfParam(*it, value);
|
||||||
|
cout << *it << " -> [" << value << "]" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TEST_RCLCONFIG
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _RCLCONFIG_H_INCLUDED_
|
#ifndef _RCLCONFIG_H_INCLUDED_
|
||||||
#define _RCLCONFIG_H_INCLUDED_
|
#define _RCLCONFIG_H_INCLUDED_
|
||||||
/* @(#$Id: rclconfig.h,v 1.18 2006-03-29 11:18:14 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: rclconfig.h,v 1.19 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -110,7 +110,10 @@ class RclConfig {
|
|||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
std::list<string> getConfNames(const string &sk) {
|
||||||
|
return m_conf->getNames(sk);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_ok;
|
int m_ok;
|
||||||
string m_reason; // Explanation for bad state
|
string m_reason; // Explanation for bad state
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: mimehandler.cpp,v 1.17 2006-03-20 16:05:41 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: mimehandler.cpp,v 1.18 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -98,3 +98,15 @@ MimeHandler *getMimeHandler(const string &mtype, RclConfig *cfg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Can this mime type be interned (according to config) ?
|
||||||
|
bool canIntern(const std::string mtype, RclConfig *cfg)
|
||||||
|
{
|
||||||
|
if (mtype.empty())
|
||||||
|
return false;
|
||||||
|
string hs = cfg->getMimeHandlerDef(mtype);
|
||||||
|
if (hs.empty())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _MIMEHANDLER_H_INCLUDED_
|
#ifndef _MIMEHANDLER_H_INCLUDED_
|
||||||
#define _MIMEHANDLER_H_INCLUDED_
|
#define _MIMEHANDLER_H_INCLUDED_
|
||||||
/* @(#$Id: mimehandler.h,v 1.11 2006-01-30 11:15:27 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: mimehandler.h,v 1.12 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -71,4 +71,7 @@ class MimeHandler {
|
|||||||
*/
|
*/
|
||||||
extern MimeHandler *getMimeHandler(const std::string &mtyp, RclConfig *cfg);
|
extern MimeHandler *getMimeHandler(const std::string &mtyp, RclConfig *cfg);
|
||||||
|
|
||||||
|
/// Can this mime type be interned ?
|
||||||
|
extern bool canIntern(const std::string mimetype, RclConfig *cfg);
|
||||||
|
|
||||||
#endif /* _MIMEHANDLER_H_INCLUDED_ */
|
#endif /* _MIMEHANDLER_H_INCLUDED_ */
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.6 2006-03-29 11:18:14 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.7 2006-03-29 13:08:08 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -21,6 +21,7 @@ static char rcsid[] = "@(#$Id: rclreslist.cpp,v 1.6 2006-03-29 11:18:14 dockes E
|
|||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "transcode.h"
|
#include "transcode.h"
|
||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
|
#include "mimehandler.h"
|
||||||
|
|
||||||
#include "rclreslist.h"
|
#include "rclreslist.h"
|
||||||
#include "moc_rclreslist.cpp"
|
#include "moc_rclreslist.cpp"
|
||||||
@ -316,12 +317,19 @@ void RclResList::showResultPage()
|
|||||||
result += string(perbuf) + sizebuf + "<b>" + doc.title + "</b><br>";
|
result += string(perbuf) + sizebuf + "<b>" + doc.title + "</b><br>";
|
||||||
result += doc.mimetype + " ";
|
result += doc.mimetype + " ";
|
||||||
result += string(datebuf) + " ";
|
result += string(datebuf) + " ";
|
||||||
|
|
||||||
|
|
||||||
|
// Set up the preview and edit links
|
||||||
char vlbuf[100];
|
char vlbuf[100];
|
||||||
sprintf(vlbuf, "\"P%d\"", m_winfirst+i);
|
if (canIntern(doc.mimetype, rclconfig)) {
|
||||||
result += string("<a href=") + vlbuf + ">" + "Preview" + "</a>"
|
sprintf(vlbuf, "\"P%d\"", m_winfirst+i);
|
||||||
+ " ";
|
result += string("<a href=") + vlbuf + ">" + "Preview" + "</a>"
|
||||||
sprintf(vlbuf, "E%d", m_winfirst+i);
|
+ " ";
|
||||||
result += string("<a href=") + vlbuf + ">" + "Edit" + "</a>";
|
}
|
||||||
|
if (!rclconfig->getMimeViewerDef(doc.mimetype).empty()) {
|
||||||
|
sprintf(vlbuf, "E%d", m_winfirst+i);
|
||||||
|
result += string("<a href=") + vlbuf + ">" + "Edit" + "</a>";
|
||||||
|
}
|
||||||
result += string("<br>");
|
result += string("<br>");
|
||||||
|
|
||||||
if (!img_name.empty()) {
|
if (!img_name.empty()) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# @(#$Id: mimeconf,v 1.14 2006-03-28 09:38:12 dockes Exp $ (C) 2004 J.F.Dockes
|
# @(#$Id: mimeconf,v 1.15 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes
|
||||||
|
|
||||||
# Recoll : associations of mime types to processing filters.
|
# Recoll : associations of mime types to processing filters.
|
||||||
# There are different sections for decompression, 'interning' for indexing
|
# There are different sections for decompression, 'interning' for indexing
|
||||||
@ -75,6 +75,8 @@ image/vnd.djvu = djview %f
|
|||||||
application/x-dvi = xdvi %f
|
application/x-dvi = xdvi %f
|
||||||
|
|
||||||
audio/mpeg = xmms %f
|
audio/mpeg = xmms %f
|
||||||
|
image/png = xv %f
|
||||||
|
image/jpeg = xv %f
|
||||||
|
|
||||||
# Icons to be used in the result list.
|
# Icons to be used in the result list.
|
||||||
[icons]
|
[icons]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# @(#$Id: mimemap,v 1.13 2006-03-28 09:38:13 dockes Exp $ (C) 2004 J.F.Dockes
|
# @(#$Id: mimemap,v 1.14 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes
|
||||||
|
|
||||||
# Recoll: associations of file name extensions to mime types
|
# Recoll: associations of file name extensions to mime types
|
||||||
.txt = text/plain
|
.txt = text/plain
|
||||||
@ -50,16 +50,19 @@
|
|||||||
.rtf = text/rtf
|
.rtf = text/rtf
|
||||||
|
|
||||||
.mp3 = audio/mpeg
|
.mp3 = audio/mpeg
|
||||||
|
.png = image/png
|
||||||
|
.jpg = image/jpeg
|
||||||
|
|
||||||
# A list of stuff that we don't want to touch at all (for now). Having the
|
# A list of stuff that we don't want to touch at all (for now). Having the
|
||||||
# suffixes listed in there speeds up things quite a lot by avoiding
|
# suffixes listed in there speeds up things quite a lot by avoiding
|
||||||
# unneeded decompression or 'file' calls
|
# unneeded decompression or 'file' calls. File names still get indexed if
|
||||||
|
# indexallfilenames is set
|
||||||
recoll_noindex = .tar.gz .tgz .tar.bz2 .tbz .log.gz .md5 .map \
|
recoll_noindex = .tar.gz .tgz .tar.bz2 .tbz .log.gz .md5 .map \
|
||||||
.c .h .cpp .m4 .tcl .js .sh .pl .awk .php .php3 \
|
.c .h .cpp .m4 .tcl .js .sh .pl .awk .php .php3 \
|
||||||
.o .lib .dll .a \
|
.o .lib .dll .a \
|
||||||
.dat .bak .rdf .log .db .ini .msf \
|
.dat .bak .rdf .log .db .ini .msf \
|
||||||
.gnm .gnumeric .tex \
|
.gnm .gnumeric .tex \
|
||||||
.jpg .gif .bmp .xpm .png \
|
.gif .bmp .xpm \
|
||||||
,v ~ #
|
,v ~ #
|
||||||
|
|
||||||
[~/.gaim]
|
[~/.gaim]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user