1
/***************************************************************************
2
* Copyright (C) 2004-2006 by Raul Fernandes *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
21
#include "stardictplugin.h"
24
#include <kgenericfactory.h>
39
K_EXPORT_COMPONENT_FACTORY( ktranslator_stardict,
40
KGenericFactory<StarDictPlugin>( "ktranslator_stardict" ) )
42
StarDictPlugin::StarDictPlugin( QObject *parent, const char*, const QStringList &args )
43
: KTranslator::DictionaryPlugin(parent, "StarDict" )
45
KLocale::setMainCatalogue("ktranslator");
46
dic = new StarDict( args[0] );
50
m_tooltip = i18n( "StarDict Dictionary\nBookname: %1\nAuthor: %2\nVersion: %3\nDescription: %4\nWords: %5" ).arg( dic->bookname() ).arg( dic->author() ).arg( dic->version() ).arg( dic->description() ).arg( dic->size() );
53
QString StarDictPlugin::search( const QString &word )
58
kdDebug() << "StarDict Plugin search()" << endl;
62
QString result = dic->search( word );
64
if( result.isEmpty() ) return QString ( "<dicName>%1</dicName><font color=#000000>%2</font>" ).arg( dictName ).arg( i18n( "Word not found" ) );
66
result = result.stripWhiteSpace().replace( '\n', "<br>" );
67
return QString( "<dicName>%1</dicName><definition>%3</definition>" ).arg( dictName ).arg( result );
71
QWidget *StarDictPlugin::confPage()
73
return new QLabel( "This plugin has no configurations", 0 );
77
void StarDictPlugin::applyConf( QWidget * )
83
int StarDictPlugin::size()