- Remove KFindPart as it is unused since KDE SC 4.0

(the Konqueror implementation wasn't ported to KDE SC 4; and nobody is willing to do so yet)
  (also, Nepomuk kioslaves + dolphinpart integration should replace kfindpart soon)
- Cleanup CMakeLists file


svn path=/trunk/KDE/kdebase/apps/; revision=1092460
This commit is contained in:
Darío Andrés Rodríguez 2010-02-19 00:27:49 +00:00
parent dbac0c2664
commit e20d9e42ae
7 changed files with 6 additions and 748 deletions

View file

@ -1,17 +1,9 @@
set(libkfindcommon_SRCS kftabdlg.cpp kfind.cpp kquery.cpp kdatecombo.cpp)
set(kfindpart_PART_SRCS kfindpart.cpp ${libkfindcommon_SRCS})
kde4_add_plugin(kfindpart WITH_PREFIX ${kfindpart_PART_SRCS})
target_link_libraries(kfindpart ${KDE4_KPARTS_LIBS})
install(TARGETS kfindpart DESTINATION ${PLUGIN_INSTALL_DIR} )
########### next target ###############
set(kfind_SRCS kfindtreeview.cpp kfinddlg.cpp main.cpp ${libkfindcommon_SRCS})
set(kfind_SRCS main.cpp
kfinddlg.cpp
kftabdlg.cpp
kquery.cpp
kdatecombo.cpp
kfindtreeview.cpp)
kde4_add_app_icon(kfind_SRCS "hi*-app-kfind.png")
@ -21,11 +13,8 @@ target_link_libraries(kfind konq ${KDE4_KFILE_LIBS})
install(TARGETS kfind ${INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
install( FILES kfind.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES findpart.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
install( FILES kfindpart.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
kde4_install_icons( ${ICON_INSTALL_DIR} )

View file

@ -1,89 +0,0 @@
[Desktop Entry]
Type=ServiceType
X-KDE-ServiceType=Konqueror/FindPart
X-KDE-Derived=Browser/View
Name=Find Part
Name[af]=Soek Deel
Name[ar]=ابحث عن جزء
Name[as]=ি ি
Name[be]=Модуль пошуку
Name[be@latin]=Pošuk
Name[bg]=Търсене на модули
Name[bn]=
Name[br]=Kavout perzh
Name[ca]=Cerca la part
Name[ca@valencia]=Cerca la part
Name[cs]=Najít soubor
Name[csb]=Mòduł szëkbë
Name[cy]=Canfod Rhan
Name[da]=Find del
Name[de]=Einbettungsfähiges Programm (Komponente) suchen
Name[el]=Part Αναζήτηση
Name[en_GB]=Find Part
Name[eo]=Trovokomponanto
Name[es]=Buscar parte
Name[et]=Failide otsimise komponent
Name[eu]=Bilatu partea
Name[fa]=یافتن جزء
Name[fi]=Etsi osa
Name[fr]=Composant de recherche
Name[fy]=In diel sykje
Name[ga]=Aimsigh Páirt
Name[gl]=Compoñente de procuras
Name[gu]=
Name[he]=רכיב חיפוש
Name[hi]=ि
Name[hne]=ि
Name[hr]=Pronađi dio
Name[hsb]=Find Part
Name[hu]=Keresési objektum
Name[id]=Cari Bagian
Name[is]=Finna hluti
Name[it]=Componente di ricerca
Name[ja]=
Name[ka]=
Name[kk]=Табу бөлімі
Name[km]=
Name[kn]=
Name[ko]=
Name[ku]=Parçeyê Bibîne
Name[lt]=Surasti dalį
Name[lv]=Meklēt daļu
Name[mai]=ि
Name[mk]=Пронајди дел
Name[ml]=
Name[mr]=
Name[ms]=Cari Bahagian
Name[nb]=Finn del
Name[nds]=Söök-Komponent
Name[ne]=
Name[nl]=Gedeelte zoeken
Name[nn]=Finn del
Name[or]=
Name[pa]=ਿ
Name[pl]=Moduł szukania
Name[pt]=Componente de Pesquisa
Name[pt_BR]=Componente de Busca
Name[ro]=Componentă de căutare
Name[ru]=Поиск по содержимому
Name[se]=Oza osiid
Name[si]=
Name[sk]=Nájsť súbory
Name[sl]=Iskalna komponenta
Name[sr]=Део за тражење
Name[sr@ijekavian]=Дио за тражење
Name[sr@ijekavianlatin]=Dio za traženje
Name[sr@latin]=Deo za traženje
Name[sv]=Sökdel
Name[ta]=ி ிி
Name[te]=
Name[tg]=Find Part
Name[th]=
Name[tr]=Find Part
Name[uk]=Складова пошуку
Name[vi]=Phn tìm
Name[wa]=Trover pårt
Name[xh]=Fumana Indawana
Name[x-test]=xxFind Partxx
Name[zh_CN]=
Name[zh_TW]=

View file

@ -1,173 +0,0 @@
/*******************************************************************
* kfind.cpp
*
* 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 the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* KFind (c) 1998-2003 The KDE Developers
Martin Hartig
Stephan Kulow <coolo@kde.org>
Mario Weilguni <mweilguni@sime.com>
Alex Zepeda <zipzippy@sonic.net>
Miroslav Flídr <flidr@kky.zcu.cz>
Harri Porten <porten@kde.org>
Dima Rogozin <dima@mercury.co.il>
Carsten Pfeiffer <pfeiffer@kde.org>
Hans Petter Bieker <bieker@kde.org>
Waldo Bastian <bastian@kde.org>
Beppe Grimaldi <grimalkin@ciaoweb.it>
Eric Coquelle <coquelle@caramail.com>
**********************************************************************/
#include <QtGui/QLayout>
#include <QtGui/QLineEdit>
#include <QtGui/QCheckBox>
#include <kpushbutton.h>
#include <kvbox.h>
#include <kdialog.h>
#include <kdebug.h>
#include <klocale.h>
#include <kstandardguiitem.h>
#include <kdirlister.h>
#include <KLineEdit>
#include "kftabdlg.h"
#include "kquery.h"
#include "kfind.moc"
Kfind::Kfind(QWidget *parent)
: QWidget( parent )
{
kDebug() << "Kfind::Kfind " << this;
QBoxLayout * mTopLayout = new QBoxLayout( QBoxLayout::LeftToRight, this );
// create tabwidget
tabWidget = new KfindTabWidget( this );
mTopLayout->addWidget(tabWidget);
// create button box
KVBox * mButtonBox = new KVBox( this );
QVBoxLayout *lay = (QVBoxLayout*)mButtonBox->layout();
lay->addStretch(1);
mTopLayout->addWidget(mButtonBox);
mSearch = new KPushButton( KStandardGuiItem::find(), mButtonBox );
mButtonBox->setSpacing( (tabWidget->sizeHint().height()-4*mSearch->sizeHint().height()) / 4);
connect( mSearch, SIGNAL(clicked()), this, SLOT( startSearch() ) );
mStop = new KPushButton( KStandardGuiItem::cancel(), mButtonBox );
connect( mStop, SIGNAL(clicked()), this, SLOT( stopSearch() ) );
mSave = new KPushButton( KStandardGuiItem::saveAs(), mButtonBox );
connect( mSave, SIGNAL(clicked()), this, SLOT( saveResults() ) );
KPushButton * mClose = new KPushButton( KStandardGuiItem::close(), mButtonBox );
connect( mClose, SIGNAL(clicked()), this, SIGNAL( destroyMe() ) );
// react to search requests from widget
connect( tabWidget, SIGNAL(startSearch()), this, SLOT( startSearch() ) );
mSearch->setEnabled(true); // Enable "Search"
mStop->setEnabled(false); // Disable "Stop"
mSave->setEnabled(false); // Disable "Save..."
dirlister=new KDirLister();
}
Kfind::~Kfind()
{
stopSearch();
dirlister->stop();
delete dirlister;
kDebug() << "Kfind::~Kfind";
}
void Kfind::setURL( const KUrl &url )
{
tabWidget->setURL( url );
}
void Kfind::startSearch()
{
tabWidget->setQuery(query);
emit started();
//emit resultSelected(false);
//emit haveResults(false);
mSearch->setEnabled(false); // Disable "Search"
mStop->setEnabled(true); // Enable "Stop"
mSave->setEnabled(false); // Disable "Save..."
tabWidget->beginSearch();
dirlister->openUrl(KUrl(tabWidget->dirBox->currentText().trimmed()));
query->start();
}
void Kfind::stopSearch()
{
// will call KFindPart::slotResult, which calls searchFinished here
query->kill();
}
void Kfind::searchFinished()
{
mSearch->setEnabled(true); // Enable "Search"
mStop->setEnabled(false); // Disable "Stop"
// ## TODO mSave->setEnabled(true); // Enable "Save..."
tabWidget->endSearch();
setFocus();
}
void Kfind::saveResults()
{
// TODO
}
void Kfind::setFocus()
{
tabWidget->setFocus();
}
void Kfind::saveState( QDataStream *stream )
{
query->kill();
*stream << tabWidget->nameBox->currentText();
*stream << tabWidget->dirBox->currentText();
*stream << tabWidget->typeBox->currentIndex();
*stream << tabWidget->textEdit->text();
*stream << (int)( tabWidget->subdirsCb->isChecked() ? 0 : 1 );
}
void Kfind::restoreState( QDataStream *stream )
{
QString namesearched, dirsearched,containing;
int typeIdx;
int subdirs;
*stream >> namesearched;
*stream >> dirsearched;
*stream >> typeIdx;
*stream >> containing;
*stream >> subdirs;
tabWidget->nameBox->addItem( namesearched, 0);
tabWidget->dirBox->addItem ( dirsearched, 0);
tabWidget->typeBox->setCurrentIndex(typeIdx);
tabWidget->textEdit->setText ( containing );
tabWidget->subdirsCb->setChecked( ( subdirs==0 ? true : false ));
}

View file

@ -1,71 +0,0 @@
/*******************************************************************
* kfind.h
*
* 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 the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************/
#ifndef KFIND_H
#define KFIND_H
#include <QtGui/QWidget>
class KPushButton;
class KQuery;
class KUrl;
class KfindTabWidget;
class KDirLister;
class Kfind: public QWidget
{
Q_OBJECT
public:
Kfind(QWidget * parent = 0);
~Kfind();
void setURL( const KUrl &url );
void setQuery(KQuery * q) { query = q; }
void searchFinished();
void saveState( QDataStream *stream );
void restoreState( QDataStream *stream );
public Q_SLOTS:
void startSearch();
void stopSearch();
void saveResults();
Q_SIGNALS:
void haveResults(bool);
void resultSelected(bool);
void started();
void destroyMe();
private:
void setFocus();
KfindTabWidget *tabWidget;
KPushButton *mSearch;
KPushButton *mStop;
KPushButton *mSave;
KQuery *query;
public:
KDirLister *dirlister;
};
#endif

View file

@ -1,208 +0,0 @@
/* This file is part of the KDE projects
Copyright (C) 2000 David Faure <faure@kde.org>
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 the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kfindpart.h"
#include "kfind.h"
#include "kquery.h"
#include <kparts/genericfactory.h>
#include <kdebug.h>
#include <klocale.h>
#include <kfileitem.h>
#include <kdirlister.h>
#include <kcomponentdata.h>
#include <QtCore/QDir>
typedef KParts::GenericFactory<KFindPart> KFindFactory;
K_EXPORT_COMPONENT_FACTORY( libkfindpart, KFindFactory )
KFindPart::KFindPart( QWidget * parentWidget, QObject *parent, const QStringList & /*args*/ )
: KParts::ReadOnlyPart(parent)
{
setComponentData( KFindFactory::componentData() );
// setBrowserExtension( new KonqDirPartBrowserExtension( this ) );
kDebug() << "KFindPart::KFindPart " << this;
m_kfindWidget = new Kfind( parentWidget );
m_kfindWidget->setMaximumHeight(m_kfindWidget->minimumSizeHint().height());
#if 0 // TODO port?
const KFileItem item = ((KonqDirPart*)parent)->currentItem();
kDebug() << "Kfind: currentItem: " << ( !item.isNull() ? item.url().path().toLocal8Bit() : QString("null") );
QDir d;
if( !item.isNull() && d.exists( item.url().path() ))
m_kfindWidget->setURL( item.url() );
#endif
setWidget( m_kfindWidget );
connect( m_kfindWidget, SIGNAL(started()),
this, SLOT(slotStarted()) );
connect( m_kfindWidget, SIGNAL(destroyMe()),
this, SLOT(slotDestroyMe()) );
connect(m_kfindWidget->dirlister,SIGNAL(deleteItem(const KFileItem&)), this, SLOT(removeFile(const KFileItem&)));
connect(m_kfindWidget->dirlister,SIGNAL(newItems(const KFileItemList&)), this, SLOT(newFiles(const KFileItemList&)));
//setXMLFile( "kfind.rc" );
query = new KQuery(this);
connect(query, SIGNAL(addFile(const KFileItem &, const QString&)),
SLOT(addFile(const KFileItem &, const QString&)));
connect(query, SIGNAL(result(int)),
SLOT(slotResult(int)));
m_kfindWidget->setQuery(query);
m_bShowsResult = false;
}
KFindPart::~KFindPart()
{
m_lstFileItems.clear();
}
KAboutData *KFindPart::createAboutData()
{
return new KAboutData( "kfindpart", 0, ki18nc( "Name of the component that finds things", "Find Component" ), "1.0" );
}
bool KFindPart::openUrl( const KUrl &url )
{
m_kfindWidget->setURL( url );
return true;
}
void KFindPart::slotStarted()
{
kDebug() << "KFindPart::slotStarted";
m_bShowsResult = true;
m_lstFileItems.clear(); // clear our internal list
emit started();
emit clear();
}
void KFindPart::addFile(const KFileItem &item, const QString& /*matchingLine*/)
{
m_lstFileItems.append( item );
KFileItemList lstNewItems;
lstNewItems.append(item);
emit newItems(lstNewItems);
/*
win->insertItem(item);
if (!isResultReported)
{
emit haveResults(true);
isResultReported = true;
}
*/
}
/* An item has been removed, so update konqueror's view */
void KFindPart::removeFile(const KFileItem &item)
{
KFileItemList listiter;
emit started();
emit clear();
m_lstFileItems.removeAll( item ); //not working ?
foreach(const KFileItem &iter, m_lstFileItems) {
if(iter.url() != item.url())
listiter.append(iter);
}
if (listiter.count())
emit newItems(listiter);
emit finished();
}
void KFindPart::newFiles(const KFileItemList&)
{
if(m_bShowsResult)
return;
emit started();
emit clear();
if (m_lstFileItems.count())
emit newItems(m_lstFileItems);
emit finished();
}
void KFindPart::slotResult(int errorCode)
{
if (errorCode == 0)
emit finished();
//setStatusMsg(i18n("Ready."));
else if (errorCode == KIO::ERR_USER_CANCELED)
emit canceled();
//setStatusMsg(i18n("Canceled."));
else
emit canceled(); // TODO ?
//setStatusMsg(i18n("Error."));
m_bShowsResult=false;
m_kfindWidget->searchFinished();
}
void KFindPart::slotDestroyMe()
{
m_kfindWidget->stopSearch();
emit clear(); // this is necessary to clear the delayed-mimetypes items list
m_lstFileItems.clear(); // clear our internal list
emit findClosed();
}
void KFindPart::saveState( QDataStream& stream )
{
//KonqDirPart::saveState(stream);
m_kfindWidget->saveState( &stream );
//Now we'll save the search result
stream << m_lstFileItems.count();
foreach(const KFileItem &fileitem, m_lstFileItems)
{
stream << fileitem;
}
}
void KFindPart::restoreState( QDataStream& stream )
{
//KonqDirPart::restoreState(stream);
int nbitems;
KUrl itemUrl;
m_kfindWidget->restoreState( &stream );
stream >> nbitems;
slotStarted();
for(int i=0;i<nbitems;i++)
{
KFileItem item( KFileItem::Unknown, KFileItem::Unknown, KUrl() );
stream >> item;
m_lstFileItems.append(item);
}
if (nbitems)
emit newItems(m_lstFileItems);
emit finished();
}
#include "kfindpart.moc"

View file

@ -1,94 +0,0 @@
[Desktop Entry]
Type=Service
Name=Find Part
Name[af]=Soek Deel
Name[ar]=ابحث عن جزء
Name[as]=ি ি
Name[be]=Модуль пошуку
Name[be@latin]=Pošuk
Name[bg]=Търсене на модули
Name[bn]=
Name[br]=Kavout perzh
Name[ca]=Cerca la part
Name[ca@valencia]=Cerca la part
Name[cs]=Najít soubor
Name[csb]=Mòduł szëkbë
Name[cy]=Canfod Rhan
Name[da]=Find del
Name[de]=Einbettungsfähiges Programm (Komponente) suchen
Name[el]=Part Αναζήτηση
Name[en_GB]=Find Part
Name[eo]=Trovokomponanto
Name[es]=Buscar parte
Name[et]=Failide otsimise komponent
Name[eu]=Bilatu partea
Name[fa]=یافتن جزء
Name[fi]=Etsi osa
Name[fr]=Composant de recherche
Name[fy]=In diel sykje
Name[ga]=Aimsigh Páirt
Name[gl]=Compoñente de procuras
Name[gu]=
Name[he]=רכיב חיפוש
Name[hi]=ि
Name[hne]=ि
Name[hr]=Pronađi dio
Name[hsb]=Find Part
Name[hu]=Keresési objektum
Name[id]=Cari Bagian
Name[is]=Finna hluti
Name[it]=Componente di ricerca
Name[ja]=
Name[ka]=
Name[kk]=Табу бөлімі
Name[km]=
Name[kn]=
Name[ko]=
Name[ku]=Parçeyê Bibîne
Name[lt]=Surasti dalį
Name[lv]=Meklēt daļu
Name[mai]=ि
Name[mk]=Пронајди дел
Name[ml]=
Name[mr]=
Name[ms]=Cari Bahagian
Name[nb]=Finn del
Name[nds]=Söök-Komponent
Name[ne]=
Name[nl]=Gedeelte zoeken
Name[nn]=Finn del
Name[or]=
Name[pa]=ਿ
Name[pl]=Moduł szukania
Name[pt]=Componente de Pesquisa
Name[pt_BR]=Componente de Busca
Name[ro]=Componentă de căutare
Name[ru]=Поиск по содержимому
Name[se]=Oza osiid
Name[si]=
Name[sk]=Nájsť súbory
Name[sl]=Iskalna komponenta
Name[sr]=Део за тражење
Name[sr@ijekavian]=Дио за тражење
Name[sr@ijekavianlatin]=Dio za traženje
Name[sr@latin]=Deo za traženje
Name[sv]=Sökdel
Name[ta]=ி ிி
Name[te]=
Name[tg]=Find Part
Name[th]=
Name[tr]=Find Part
Name[uk]=Складова пошуку
Name[vi]=Phn tìm
Name[wa]=Trover pårt
Name[xh]=Fumana Indawana
Name[x-test]=xxFind Partxx
Name[zh_CN]=
Name[zh_TW]=
MimeType=
X-KDE-ServiceTypes=Konqueror/FindPart
X-KDE-Library=libkfindpart
X-KDE-BrowserView-AllowAsDefault=true
X-KDE-BrowserView-HideFromMenus=true
X-KDE-BrowserView-PassiveMode=true
InitialPreference=10

View file

@ -1,96 +0,0 @@
/* This file is part of the KDE projects
Copyright (C) 2000 David Faure <faure@kde.org>
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 the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef kfindpart__h
#define kfindpart__h
#include <kparts/browserextension.h>
#include <kparts/part.h>
#include <kfileitem.h>
#include <kdebug.h>
class KQuery;
class KAboutData;
class Kfind;
class KFindPart : public KParts::ReadOnlyPart
{
friend class KFindPartBrowserExtension;
Q_OBJECT
Q_PROPERTY( bool showsResult READ showsResult )
public:
KFindPart( QWidget * parentWidget, QObject *parent, const QStringList & /*args*/ );
virtual ~KFindPart();
static KAboutData *createAboutData();
virtual bool openUrl( const KUrl &url );
virtual bool closeUrl() { return true; }
virtual bool openFile() { return false; }
bool showsResult() const { return m_bShowsResult; }
virtual void saveState( QDataStream &stream );
virtual void restoreState( QDataStream &stream );
// "Cut" icons : disable those whose URL is in lst, enable the rest //added for konqdirpart
//virtual void disableIcons( const KUrl::List & ){}
//virtual const KFileItem * currentItem(){return 0;}
Q_SIGNALS:
// Konqueror connects directly to those signals
void started(); // started a search
void clear(); // delete all items
void newItems(const KFileItemList&); // found this/these item(s)
void finished(); // finished searching
void canceled(); // the user canceled the search
void findClosed(); // close us
void deleteItem( const KFileItem &item);
protected Q_SLOTS:
void slotStarted();
void slotDestroyMe();
void addFile(const KFileItem &item, const QString& matchingLine);
/* An item has been removed, so update konqueror's view */
void removeFile(const KFileItem &item);
void slotResult(int errorCode);
void newFiles(const KFileItemList&);
#if 0
// slots connected to the directory lister //added for konqdirpart
// virtual void slotStarted();
virtual void slotCanceled(){}
virtual void slotCompleted(){}
virtual void slotNewItems( const KFileItemList& ){}
virtual void slotDeleteItem( const KFileItem& ){}
virtual void slotRefreshItems( const QList<QPair<KFileItem, KFileItem> >& ){}
virtual void slotClear(){}
virtual void slotRedirection( const KUrl & ){}
#endif
private:
Kfind * m_kfindWidget;
KQuery *query;
bool m_bShowsResult; // whether the dirpart shows the results of a search or not
/**
* The internal storage of file items
*/
KFileItemList m_lstFileItems;
};
#endif