"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/fileplugin.cpp" between
krename-4.0.9.tar.gz and krename-4.90.90.tar.gz

About: KRename is a batch file-renamer (KDE).

fileplugin.cpp  (krename-4.0.9):fileplugin.cpp  (krename-4.90.90)
skipping to change at line 20 skipping to change at line 20
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#include "fileplugin.h" #include "fileplugin.h"
#include <kapplication.h> #include <KIconLoader>
#include <kiconloader.h> #include <KLocalizedString>
#include <klistwidget.h>
#include <klocale.h>
#include <kservice.h> #include <kservice.h>
#include <QListWidget>
#include <QLabel> #include <QLabel>
#include <QHBoxLayout> #include <QHBoxLayout>
FilePlugin::FilePlugin( PluginLoader* loader, KService* service ) FilePlugin::FilePlugin(PluginLoader *loader, KService *service)
: Plugin( loader ) : Plugin(loader),
m_name(service->name()),
m_comment(QString()),
m_icon(service->icon())
{ {
m_name = service->name();
m_icon = service->icon();
m_comment = QString::null;
} }
FilePlugin::FilePlugin( PluginLoader* loader ) FilePlugin::FilePlugin(PluginLoader *loader)
: Plugin( loader ) : Plugin(loader),
m_name("FilePlugin")
{ {
m_name = "FilePlugin";
} }
FilePlugin::~FilePlugin() FilePlugin::~FilePlugin()
{ {
} }
bool FilePlugin::supports( const QString & token ) bool FilePlugin::supports(const QString &token)
{ {
QString lower = token.toLower(); QString lower = token.toLower();
for( int i = 0; i < m_keys.count(); i++ ) for (int i = 0; i < m_keys.count(); i++)
// TODO: Maybe we can optimize by putting all tokens // TODO: Maybe we can optimize by putting all tokens
// already converted to lowercase into m_keys // already converted to lowercase into m_keys
if( QRegExp( m_keys[i].toLower() ).exactMatch( lower ) ) if (QRegExp(m_keys[i].toLower()).exactMatch(lower)) {
return true; return true;
}
return false; return false;
} }
const QPixmap FilePlugin::icon() const const QPixmap FilePlugin::icon() const
{ {
return KIconLoader::global()->loadIcon( m_icon, KIconLoader::NoGroup, KIconL oader::SizeSmall ); return KIconLoader::global()->loadIcon(m_icon, KIconLoader::NoGroup, KIconLo ader::SizeSmall);
} }
void FilePlugin::createUI( QWidget* parent ) const void FilePlugin::createUI(QWidget *parent) const
{ {
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSize Policy::Expanding ); QSpacerItem *spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizeP olicy::Expanding);
QVBoxLayout* l = new QVBoxLayout( parent ); QVBoxLayout *l = new QVBoxLayout(parent);
QHBoxLayout* hbox = new QHBoxLayout( parent ); QHBoxLayout *hbox = new QHBoxLayout;
QLabel* pix = new QLabel( parent ); QLabel *pix = new QLabel(parent);
pix->setPixmap( KIconLoader::global()->loadIcon( m_icon, KIconLoader::Deskto pix->setPixmap(KIconLoader::global()->loadIcon(m_icon, KIconLoader::Desktop)
p ) ); );
hbox->addWidget( pix ); hbox->addWidget(pix);
hbox->addWidget( new QLabel( "<qt><b>"+name()+"</b></qt>", parent ) ); hbox->addWidget(new QLabel("<qt><b>" + name() + "</b></qt>", parent));
hbox->addItem( spacer ); hbox->addItem(spacer);
QLabel* comment = new QLabel( m_comment, parent ); QLabel *comment = new QLabel(m_comment, parent);
comment->setWordWrap( true ); comment->setWordWrap(true);
l->addLayout( hbox ); l->addLayout(hbox);
l->addWidget( comment ); l->addWidget(comment);
l->addWidget( new QLabel( i18n("Supported tokens:"), parent ) ); l->addWidget(new QLabel(i18n("Supported tokens:"), parent));
KListWidget* list = new KListWidget( parent ); QListWidget *list = new QListWidget(parent);
//list->setColumnMode( KListBox::FitToWidth );
const QStringList & keys = supportedTokens(); const QStringList &keys = supportedTokens();
for( int i = 0; i < keys.count(); i++ ) for (int i = 0; i < keys.count(); i++) {
list->insertItem( 0, "[" + keys[i] + "]" ); list->insertItem(0, '[' + keys[i] + ']');
}
l->addWidget( list ); l->addWidget(list);
l->setStretchFactor( list, 2 ); l->setStretchFactor(list, 2);
} }
 End of changes. 21 change blocks. 
38 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)