mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 00:41:23 +00:00
Coolo: added po and kfind-0.3.3
svn path=/trunk/kdebase/kfind/; revision=821
This commit is contained in:
parent
48de72c368
commit
28ebbf087c
|
@ -26,7 +26,7 @@ install-data-local:
|
|||
(cd pics && $(MAKE) install)
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(PICSDIR)/kfind.xpm
|
||||
rm -f $(PICSDIR)/$(TARGET).xpm
|
||||
rm -f '$(prefix)/apps/Utilities/KDE Find Tool.kdelnk'
|
||||
(cd doc && $(MAKE) uninstall)
|
||||
(cd pics && $(MAKE) uninstall)
|
||||
|
|
16
kfind/README
16
kfind/README
|
@ -16,14 +16,16 @@ Compilation
|
|||
-----------
|
||||
|
||||
It is necessary to set the environment variables QTDIR and KDEDIR.
|
||||
Then you have to install libkde(>=0.7) and kfm(>=0.5.8)!!! (unless you
|
||||
Then you have to install latest libkde and kfm!!! (unless you
|
||||
installed them already). Then you can simply do ./configure, make and
|
||||
make install.
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
o enable changing filetypes and archivers details in preferences dialog
|
||||
o some layout managment
|
||||
o find pattern history
|
||||
o context menus
|
||||
o write a better widget for viewing results which would enable multiple
|
||||
selection
|
||||
o and more ...
|
||||
|
@ -49,6 +51,16 @@ appreciate any suggestions and comments.
|
|||
|
||||
CHANGES
|
||||
-------
|
||||
ver. 0.3.3:
|
||||
|
||||
o uses KProcess
|
||||
o supports other languages then english (at this time german and czech)
|
||||
|
||||
ver. 0.3.2:
|
||||
|
||||
o uses KTopLevelWidget and KToolBar
|
||||
o new documentations
|
||||
|
||||
ver. 0.3.1:
|
||||
o new documentation contributed by Mark Roberts
|
||||
|
||||
|
|
102
kfind/kfind.cpp
102
kfind/kfind.cpp
|
@ -23,6 +23,7 @@
|
|||
#include <qdir.h>
|
||||
|
||||
#include <kmsgbox.h>
|
||||
#include <kprocess.h>
|
||||
|
||||
#include "kftabdlg.h"
|
||||
#include "kfwin.h"
|
||||
|
@ -37,6 +38,7 @@ Kfind::Kfind( QWidget *parent, const char *name, const char *searchPath = 0 )
|
|||
//prepare window for find results
|
||||
win = new KfindWindow(this,"window");
|
||||
win->hide(); //and hide it firstly
|
||||
winsize=1;
|
||||
|
||||
connect(win ,SIGNAL(resultSelected(bool)),
|
||||
this,SIGNAL(resultSelected(bool)));
|
||||
|
@ -54,6 +56,8 @@ Kfind::Kfind( QWidget *parent, const char *name, const char *searchPath = 0 )
|
|||
win,SLOT(addToArchive()));
|
||||
connect(this,SIGNAL(open()),
|
||||
win,SLOT(openBinding()));
|
||||
connect(&findProcess,SIGNAL(processExited(KProcess *)),
|
||||
this,SLOT(processResults()));
|
||||
|
||||
emit haveResults(false);
|
||||
resize(tabDialog->sizeHint()+QSize(0,5));
|
||||
|
@ -69,46 +73,22 @@ void Kfind::resizeEvent( QResizeEvent *e)
|
|||
//printf("Win height1 = %d\n",win->height());
|
||||
//printf("Kfind height1 = %d\n",height());
|
||||
//printf("tabDialog height1 = %d\n",(tabDialog->sizeHint()).height());
|
||||
|
||||
win->setGeometry(0,5+(tabDialog->sizeHint()).height()+5,width(),
|
||||
height()-tabDialog->height()-10);
|
||||
|
||||
//printf("Win height2 = %d\n",win->height());
|
||||
//printf("------------------------------\n");
|
||||
};
|
||||
|
||||
void Kfind::timerEvent( QTimerEvent * )
|
||||
{
|
||||
int status;
|
||||
|
||||
if (childPID==waitpid(childPID,&status,WNOHANG))
|
||||
{
|
||||
killTimer( timerID );
|
||||
|
||||
if (doProcess)
|
||||
{
|
||||
win->updateResults( outFile.data() );
|
||||
win->show();
|
||||
|
||||
emit haveResults(true);
|
||||
emit enableStatusBar(true);
|
||||
};
|
||||
|
||||
unlink( outFile.data() );
|
||||
|
||||
enableSearchButton(true);
|
||||
};
|
||||
};
|
||||
|
||||
void Kfind::startSearch()
|
||||
{
|
||||
QString buffer,pom;
|
||||
char **findargs;
|
||||
int args_number;
|
||||
int fromPos,toPos,i;
|
||||
|
||||
// printf("Starting Search\n");
|
||||
|
||||
int pos;
|
||||
buffer = tabDialog->createQuery();
|
||||
|
||||
//if ( winsize==1)
|
||||
// winsize=300;
|
||||
emit haveResults(false);
|
||||
emit resultSelected(false);
|
||||
win->clearList();
|
||||
|
@ -117,44 +97,28 @@ void Kfind::startSearch()
|
|||
{
|
||||
enableSearchButton(false);
|
||||
|
||||
findProcess.setExecutable("find");
|
||||
findProcess.clearArguments ();
|
||||
|
||||
int t = time( 0L );
|
||||
outFile.sprintf( "/tmp/kfindout%i", t );
|
||||
|
||||
buffer.append(pom.sprintf(" -fprint %s",outFile.data()));
|
||||
buffer=buffer.simplifyWhiteSpace();
|
||||
|
||||
args_number=buffer.contains(" ")+3;
|
||||
findargs= (char **) malloc(args_number*sizeof(char *));
|
||||
while( !buffer.isEmpty() )
|
||||
{
|
||||
pos = buffer.find(" ");
|
||||
pom = buffer.left(pos);
|
||||
|
||||
findargs[0]=(char *) malloc(5*sizeof(char));
|
||||
findargs[0]="find";
|
||||
i=0;
|
||||
fromPos=0;
|
||||
while(i<buffer.contains(" ")+1)
|
||||
{
|
||||
toPos=buffer.find(" ",fromPos);
|
||||
toPos=(toPos!=-1)?toPos:buffer.length();
|
||||
pom=buffer.mid(fromPos,toPos-fromPos);
|
||||
i++;
|
||||
findargs[i]=(char *) malloc((pom.length()+1)*sizeof(char));
|
||||
strcpy(findargs[i],(char*)pom.data());
|
||||
fromPos=toPos+1;
|
||||
};
|
||||
findargs[buffer.contains(" ")+2]=0L;
|
||||
findProcess << pom.data();
|
||||
|
||||
childPID=fork();
|
||||
if (childPID==0)
|
||||
{
|
||||
// printf("Hey I'm child process\n");
|
||||
// printf("CMD find %s\n",buffer.data());
|
||||
if (pos==-1)
|
||||
pos = buffer.length();
|
||||
buffer = buffer.remove(0,pos+1);
|
||||
};
|
||||
|
||||
execvp("find",findargs);
|
||||
printf("Error by creating child process!\n");
|
||||
exit(1);
|
||||
};
|
||||
|
||||
doProcess=true;
|
||||
timerID = startTimer( 1000 );
|
||||
findProcess.start();
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -164,7 +128,7 @@ void Kfind::stopSearch()
|
|||
|
||||
enableSearchButton(true);
|
||||
|
||||
kill(childPID,9);
|
||||
findProcess.kill();
|
||||
};
|
||||
|
||||
void Kfind::newSearch()
|
||||
|
@ -172,20 +136,32 @@ void Kfind::newSearch()
|
|||
// printf("Prepare for New Search\n");
|
||||
win->hide();
|
||||
win->clearList();
|
||||
// winsize=1;
|
||||
|
||||
tabDialog->setDefaults();
|
||||
|
||||
emit enableStatusBar(false);
|
||||
|
||||
doProcess=false;
|
||||
emit haveResults(false);
|
||||
emit resultSelected(false);
|
||||
|
||||
stopSearch();
|
||||
};
|
||||
|
||||
QSize Kfind::sizeHint()
|
||||
void Kfind::processResults()
|
||||
{
|
||||
return (tabDialog->sizeHint());
|
||||
win->updateResults( outFile.data() );
|
||||
win->show();
|
||||
|
||||
emit haveResults(true);
|
||||
emit enableStatusBar(true);
|
||||
|
||||
unlink( outFile.data() );
|
||||
|
||||
enableSearchButton(true);
|
||||
};
|
||||
|
||||
QSize Kfind::sizeHint()
|
||||
{
|
||||
return (tabDialog->sizeHint());//+QSize(0,winsize-1));
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "kftabdlg.h"
|
||||
#include "kfwin.h"
|
||||
|
||||
#include <kprocess.h>
|
||||
|
||||
class QPushButton;
|
||||
|
||||
class Kfind: public QWidget
|
||||
|
@ -25,7 +27,7 @@ private slots:
|
|||
void startSearch();
|
||||
void stopSearch();
|
||||
void newSearch();
|
||||
|
||||
void processResults();
|
||||
signals:
|
||||
void haveResults(bool);
|
||||
void resultSelected(bool);
|
||||
|
@ -43,16 +45,13 @@ signals:
|
|||
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent * );
|
||||
void timerEvent( QTimerEvent * );
|
||||
|
||||
private:
|
||||
KProcess findProcess;
|
||||
int winsize;
|
||||
KfindTabDialog *tabDialog;
|
||||
KfindWindow * win;
|
||||
|
||||
int timerID;
|
||||
int childPID;
|
||||
QString outFile;
|
||||
bool doProcess;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,25 +4,27 @@
|
|||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include <qpopmenu.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qkeycode.h>
|
||||
|
||||
#include <kapp.h>
|
||||
#include <ktopwidget.h>
|
||||
#include "ktopwidget.h"
|
||||
#include <kmenubar.h>
|
||||
#include <ktoolbar.h>
|
||||
#include <kstatusbar.h>
|
||||
#include <kmsgbox.h>
|
||||
#include <qsize.h>
|
||||
|
||||
#include <qpopmenu.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qkeycode.h>
|
||||
#include <qaccel.h>
|
||||
|
||||
#include "kfoptions.h"
|
||||
#include "kftabdlg.h"
|
||||
#include "kfind.h"
|
||||
#include "kfindtop.h"
|
||||
#include "kfindtop.h"
|
||||
#include <klocale.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "version.h"
|
||||
|
||||
KfindTop::KfindTop(const char *searchPath) : KTopLevelWidget()
|
||||
{
|
||||
|
@ -31,6 +33,7 @@ KfindTop::KfindTop(const char *searchPath) : KTopLevelWidget()
|
|||
_mainMenu = new KMenuBar(this, "_mainMenu");
|
||||
_mainMenu->show();
|
||||
setMenu(_mainMenu);
|
||||
_mainMenu->enableMoving(false);
|
||||
|
||||
_toolBar = new KToolBar( this, "_toolBar" );
|
||||
_toolBar->setBarPos( KToolBar::Top );
|
||||
|
@ -103,8 +106,10 @@ void KfindTop::about()
|
|||
{
|
||||
QString tmp;
|
||||
|
||||
tmp.sprintf("KFind %s\nFrontend to find utility
|
||||
\nMiroslav Flídr <flidr@kky.zcu.cz>",KFIND_VERSION);
|
||||
tmp.sprintf(trans.translate("_abouttext",
|
||||
"KFind %s\nFrontend to find utility
|
||||
\nMiroslav Flídr <flidr@kky.zcu.cz>"),
|
||||
KFIND_VERSION);
|
||||
|
||||
KMsgBox::message(this,"about box",tmp,KMsgBox::INFORMATION, "OK");
|
||||
};
|
||||
|
@ -116,47 +121,47 @@ void KfindTop::menuInit()
|
|||
_optionMenu = new QPopupMenu;
|
||||
_helpMenu = new QPopupMenu;
|
||||
|
||||
_mainMenu->insertItem( "&File" , _fileMenu);
|
||||
_mainMenu->insertItem( "&Edit" , _editMenu);
|
||||
_mainMenu->insertItem( "&Options", _optionMenu);
|
||||
_mainMenu->insertItem( trans.translate("&File"), _fileMenu);
|
||||
_mainMenu->insertItem( trans.translate("&Edit"), _editMenu);
|
||||
_mainMenu->insertItem( trans.translate("&Options"), _optionMenu);
|
||||
_mainMenu->insertSeparator();
|
||||
_mainMenu->insertItem( "&Help", _helpMenu );
|
||||
_mainMenu->insertItem( trans.translate("&Help"), _helpMenu );
|
||||
|
||||
|
||||
openWithM = _fileMenu->insertItem("Open" ,this,
|
||||
SIGNAL(open()),CTRL+Key_O );
|
||||
toArchM = _fileMenu->insertItem("Add to archive",this,
|
||||
SIGNAL(addToArchive()));
|
||||
openWithM = _fileMenu->insertItem(trans.translate("Open"),
|
||||
this,SIGNAL(open()), CTRL+Key_O );
|
||||
toArchM = _fileMenu->insertItem(trans.translate("Add to archive"),
|
||||
this,SIGNAL(addToArchive()));
|
||||
_fileMenu ->insertSeparator();
|
||||
deleteM = _fileMenu->insertItem("Delete" ,this,
|
||||
SIGNAL(deleteFile()));
|
||||
propsM = _fileMenu->insertItem("Properties" ,this,
|
||||
SIGNAL(properties()));
|
||||
deleteM = _fileMenu->insertItem(trans.translate("Delete"),
|
||||
this,SIGNAL(deleteFile()));
|
||||
propsM = _fileMenu->insertItem(trans.translate("Properties"),
|
||||
this,SIGNAL(properties()));
|
||||
_fileMenu ->insertSeparator();
|
||||
openFldrM = _fileMenu->insertItem("Open Containing Folder",this,
|
||||
SIGNAL(openFolder()));
|
||||
openFldrM = _fileMenu->insertItem(trans.translate("Open Containing Folder"),
|
||||
this,SIGNAL(openFolder()));
|
||||
_fileMenu ->insertSeparator();
|
||||
saveSearchM= _fileMenu->insertItem("Save Search" ,this,
|
||||
SIGNAL(saveResults()),CTRL+Key_S);
|
||||
saveSearchM= _fileMenu->insertItem(trans.translate("Save Search"),
|
||||
this,SIGNAL(saveResults()),CTRL+Key_S);
|
||||
_fileMenu ->insertSeparator();
|
||||
quitM = _fileMenu->insertItem("Quit" ,qApp,
|
||||
quitM = _fileMenu->insertItem(trans.translate("Quit"),qApp,
|
||||
SLOT(quit()),ALT+Key_Q);
|
||||
|
||||
for(int i=openWithM;i>quitM;i--)
|
||||
_fileMenu->setItemEnabled(i,FALSE);
|
||||
|
||||
int undo = _editMenu->insertItem("Undo" , this,
|
||||
SIGNAL(undo()) );
|
||||
int undo = _editMenu->insertItem(trans.translate("Undo"),
|
||||
this, SIGNAL(undo()) );
|
||||
_editMenu ->insertSeparator();
|
||||
int cut = _editMenu->insertItem("Cut" , this,
|
||||
SIGNAL(cut()) );
|
||||
int copy = _editMenu->insertItem("Copy" , this,
|
||||
SIGNAL(copy()) );
|
||||
int cut = _editMenu->insertItem(trans.translate("Cut"),
|
||||
this, SIGNAL(cut()) );
|
||||
int copy = _editMenu->insertItem(trans.translate("Copy"),
|
||||
this,SIGNAL(copy()) );
|
||||
_editMenu ->insertSeparator();
|
||||
int select_all = _editMenu->insertItem("Select All", this,
|
||||
SIGNAL(selectAll()) );
|
||||
int invert_sel = _editMenu->insertItem("Invert Selection",this,
|
||||
SIGNAL(invertSelection()) );
|
||||
int select_all = _editMenu->insertItem(trans.translate("Select All"),
|
||||
this,SIGNAL(selectAll()) );
|
||||
int invert_sel = _editMenu->insertItem(trans.translate("Invert Selection"),
|
||||
this,SIGNAL(invertSelection()) );
|
||||
|
||||
_editMenu->setItemEnabled( undo , FALSE );
|
||||
_editMenu->setItemEnabled( cut , FALSE );
|
||||
|
@ -166,12 +171,14 @@ void KfindTop::menuInit()
|
|||
|
||||
CHECK_PTR( _optionMenu );
|
||||
|
||||
_optionMenu->insertItem("Preferences ...",this,SLOT(prefs()));
|
||||
_optionMenu->insertItem(trans.translate("Preferences ..."),
|
||||
this,SLOT(prefs()));
|
||||
//_optionMenu->insertItem("Configure key bindings",this,SIGNAL(keys()));
|
||||
|
||||
_helpMenu->insertItem("Kfind help", this, SLOT(help()),ALT+Key_H );
|
||||
_helpMenu->insertItem(trans.translate("Kfind help"),
|
||||
this, SLOT(help()),ALT+Key_H );
|
||||
_helpMenu->insertSeparator();
|
||||
_helpMenu->insertItem("&About", this, SLOT( about() ) );
|
||||
_helpMenu->insertItem(trans.translate("About"), this, SLOT( about() ) );
|
||||
};
|
||||
|
||||
void KfindTop::toolBarInit()
|
||||
|
@ -184,17 +191,17 @@ void KfindTop::toolBarInit()
|
|||
icon.load(directory + "toolbar/viewzoom.xpm");
|
||||
_toolBar->insertButton( icon, 0, SIGNAL(clicked()),
|
||||
_kfind, SLOT(startSearch()),
|
||||
TRUE, "Start Search");
|
||||
TRUE, trans.translate("Start Search"));
|
||||
|
||||
icon.load(directory + "toolbar/reload.xpm");
|
||||
_toolBar->insertButton( icon, 1, SIGNAL(clicked()),
|
||||
_kfind, SLOT(newSearch()),
|
||||
TRUE, "New Search");
|
||||
TRUE, trans.translate("New Search"));
|
||||
|
||||
icon.load(directory + "toolbar/stop.xpm");
|
||||
_toolBar->insertButton( icon, 2, SIGNAL(clicked()),
|
||||
_kfind, SLOT(stopSearch()),
|
||||
FALSE, "Stop Search");
|
||||
FALSE, trans.translate("Stop Search"));
|
||||
|
||||
_toolBar->insertSeparator();
|
||||
|
||||
|
@ -202,43 +209,43 @@ void KfindTop::toolBarInit()
|
|||
icon.load(directory + "toolbar/idea.xpm");
|
||||
_toolBar->insertButton( icon, 3,SIGNAL(clicked()),
|
||||
_kfind,SIGNAL(open()),
|
||||
FALSE, "Open with...");
|
||||
FALSE, trans.translate("Open"));
|
||||
|
||||
icon.load(directory + "toolbar/archive.xpm");
|
||||
_toolBar->insertButton( icon, 4,SIGNAL(clicked()),
|
||||
_kfind,SIGNAL(addToArchive()),
|
||||
FALSE, "Add to Archive");
|
||||
FALSE, trans.translate("Add to archive"));
|
||||
|
||||
icon.load(directory + "toolbar/delete.xpm");
|
||||
_toolBar->insertButton( icon, 5,SIGNAL(clicked()),
|
||||
_kfind,SIGNAL(deleteFile()),
|
||||
FALSE, "Delete");
|
||||
FALSE, trans.translate("Delete"));
|
||||
|
||||
icon.load(directory + "toolbar/info.xpm");
|
||||
_toolBar->insertButton( icon, 6,SIGNAL(clicked()),
|
||||
_kfind,SIGNAL(properties()),
|
||||
FALSE, "Properties");
|
||||
FALSE, trans.translate("Properties"));
|
||||
|
||||
icon.load(directory + "toolbar/fileopen.xpm");
|
||||
_toolBar->insertButton( icon, 7,SIGNAL(clicked()),
|
||||
_kfind,SIGNAL(openFolder()),
|
||||
FALSE, "Open Containing Folder");
|
||||
FALSE, trans.translate("Open Containing Folder"));
|
||||
|
||||
icon.load(directory + "toolbar/save.xpm");
|
||||
_toolBar->insertButton( icon, 8,SIGNAL(clicked()),
|
||||
_kfind,SIGNAL(saveResults()),
|
||||
FALSE, "Save Search Results");
|
||||
FALSE, trans.translate("Save Search Results"));
|
||||
|
||||
_toolBar->insertSeparator();
|
||||
icon.load(directory + "toolbar/contents.xpm");
|
||||
_toolBar->insertButton( icon, 9, SIGNAL( clicked() ),
|
||||
this, SLOT( help() ),
|
||||
TRUE, "Help");
|
||||
TRUE, trans.translate("Help"));
|
||||
|
||||
icon.load(directory + "toolbar/exit.xpm");
|
||||
_toolBar->insertButton( icon, 10, SIGNAL( clicked() ),
|
||||
KApplication::getKApplication(), SLOT( quit() ),
|
||||
TRUE, "Quit");
|
||||
TRUE, trans.translate("Quit"));
|
||||
};
|
||||
|
||||
void KfindTop::enableSaveResults(bool enable)
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#ifndef KFINDTOP_H
|
||||
#define KFINDTOP_H
|
||||
|
||||
#include <ktopwidget.h>
|
||||
#include "ktopwidget.h"
|
||||
#include "klocale.h"
|
||||
|
||||
class QPopupMenu;
|
||||
class KMenuBar;
|
||||
|
@ -72,6 +73,7 @@ private:
|
|||
Kfind *_kfind;
|
||||
KfindTabDialog *_kfindTabDialog;
|
||||
|
||||
KLocale trans;
|
||||
int openWithM;
|
||||
int toArchM;
|
||||
int deleteM;
|
||||
|
|
|
@ -30,11 +30,14 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
#include "kftypes.h"
|
||||
#include "kfarch.h"
|
||||
#include "kfoptions.h"
|
||||
#include "kfsave.h"
|
||||
|
||||
|
||||
extern QList<KfFileType> *types;
|
||||
extern KfSaveOptions *saving;
|
||||
extern QList<KfArchiver> *archivers;
|
||||
|
@ -45,7 +48,7 @@ KfOptions::KfOptions( QWidget *parent=0, const char *name=0 ):QTabDialog( parent
|
|||
insertPages();
|
||||
|
||||
setCancelButton();
|
||||
setCaption("Preferences");
|
||||
setCaption(trans.translate("Preferences"));
|
||||
|
||||
this->setMinimumSize(400,330);
|
||||
this->setMaximumSize(400,330);
|
||||
|
@ -61,11 +64,15 @@ void KfOptions::insertPages()
|
|||
// First page of tab preferences dialog
|
||||
pages[0]= new QWidget(this,"page1");
|
||||
|
||||
formatL = new QLabel("File format:" ,pages[0],"formatL");
|
||||
fileL = new QLabel("Save results to file:",pages[0],"fileL");
|
||||
kfindfileL = new QLabel("Save results to file ~/.kfind-results.html"
|
||||
,pages[0],"kfindfileL");
|
||||
browseB = new QPushButton("Browse" ,pages[0],"browseB");
|
||||
formatL = new QLabel(trans.translate("File format:"),
|
||||
pages[0],"formatL");
|
||||
fileL = new QLabel(trans.translate("Save results to file:"),
|
||||
pages[0],"fileL");
|
||||
kfindfileL = new QLabel(trans.translate(
|
||||
"Save results to file ~/.kfind-results.html"),
|
||||
pages[0],"kfindfileL");
|
||||
browseB = new QPushButton(trans.translate("Browse"),
|
||||
pages[0],"browseB");
|
||||
formatBox = new QComboBox( pages[0],"formatBox");
|
||||
fileE = new QLineEdit( pages[0],"fileE");
|
||||
kfindfileB = new QRadioButton( pages[0]);
|
||||
|
@ -77,15 +84,16 @@ void KfOptions::insertPages()
|
|||
bg->setExclusive(TRUE);
|
||||
|
||||
formatBox->insertItem("HTML");
|
||||
formatBox->insertItem("Plain Text");
|
||||
|
||||
formatBox->insertItem(trans.translate("Plain Text"));
|
||||
formatBox->setFixedSize(formatBox ->sizeHint());
|
||||
|
||||
formatL ->setFixedSize(formatL ->sizeHint());
|
||||
fileL ->setFixedSize(fileL ->sizeHint());
|
||||
fileE ->setFixedSize(160,25);
|
||||
kfindfileL ->setFixedSize(kfindfileL ->sizeHint());
|
||||
kfindfileB ->setFixedSize(kfindfileB ->sizeHint());
|
||||
selectfileB->setFixedSize(selectfileB->sizeHint());
|
||||
browseB ->setFixedSize(browseB ->sizeHint());
|
||||
browseB ->setFixedSize(browseB ->sizeHint());
|
||||
fileE ->setFixedSize(344-(10+10+fileL->width()+browseB->width()),25);
|
||||
|
||||
kfindfileB ->move(10,20);
|
||||
selectfileB->move(10,50);
|
||||
|
@ -105,7 +113,7 @@ void KfOptions::insertPages()
|
|||
connect( browseB ,SIGNAL(clicked()),
|
||||
this, SLOT(selectFile()) );
|
||||
|
||||
addTab(pages[0],"Saving");
|
||||
addTab(pages[0],trans.translate("Saving"));
|
||||
|
||||
// Second page of tab preferences dialog
|
||||
pages[1]= new QWidget(this,"page2");
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#ifndef KFWITGETS_H
|
||||
#define KFWIDGETS_H
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
class QButtonGroup;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
|
@ -44,7 +46,9 @@ private slots:
|
|||
private:
|
||||
/// Inserts all pages in the dialog.
|
||||
void insertPages();
|
||||
|
||||
|
||||
KLocale trans;
|
||||
|
||||
/// Store pointers to dialog pages
|
||||
QWidget *pages[3];
|
||||
|
||||
|
|
|
@ -41,12 +41,12 @@ KfindTabDialog::KfindTabDialog( QWidget *parent, const char *name, const char *s
|
|||
//Page One of KfTAbDialog
|
||||
pages[0] = new QWidget( this, "page1" );
|
||||
|
||||
namedL = new QLabel("&Named:" ,pages[0],"named");
|
||||
namedL = new QLabel(trans.translate("&Named:") ,pages[0],"named");
|
||||
nameBox = new QComboBox(TRUE ,pages[0],"combo1");
|
||||
lookinL = new QLabel("&Look in:" ,pages[0],"named");
|
||||
lookinL = new QLabel(trans.translate("&Look in:"),pages[0],"named");
|
||||
dirBox = new QComboBox(FALSE ,pages[0],"combo2");
|
||||
subdirsCb = new QCheckBox( pages[0]);
|
||||
browseB = new QPushButton("&Browse ...",pages[0]);
|
||||
browseB = new QPushButton(trans.translate("&Browse ..."),pages[0]);
|
||||
|
||||
nameBox->insertItem( "*" );
|
||||
dirBox ->insertItem( searchPath );
|
||||
|
@ -58,18 +58,20 @@ KfindTabDialog::KfindTabDialog( QWidget *parent, const char *name, const char *s
|
|||
dirBox ->insertItem( "/var" );
|
||||
dirBox ->insertItem( "/mnt" );
|
||||
|
||||
subdirsCb->setText( "Include &subfolders" );
|
||||
|
||||
subdirsCb->setText( trans.translate("Include &subfolders") );
|
||||
|
||||
int wTmpNamed = (namedL->sizeHint()).width();
|
||||
int wTmpLook = (lookinL->sizeHint()).width();
|
||||
int wTmp = (wTmpNamed > wTmpLook) ? wTmpNamed:wTmpLook;
|
||||
if ((nameBox->style())==WindowsStyle)
|
||||
{
|
||||
namedL ->setFixedSize(60,25);
|
||||
lookinL ->setFixedSize(60,25);
|
||||
namedL ->setFixedSize(wTmp+10,25);
|
||||
lookinL ->setFixedSize(wTmp+10,25);
|
||||
}
|
||||
else
|
||||
{
|
||||
namedL ->setFixedSize(60,30);
|
||||
lookinL ->setFixedSize(60,30);
|
||||
namedL ->setFixedSize(wTmp+10,30);
|
||||
lookinL ->setFixedSize(wTmp+10,30);
|
||||
};
|
||||
|
||||
subdirsCb->setFixedSize(subdirsCb->sizeHint());
|
||||
|
@ -86,7 +88,7 @@ KfindTabDialog::KfindTabDialog( QWidget *parent, const char *name, const char *s
|
|||
connect( browseB, SIGNAL(clicked()),
|
||||
this, SLOT(getDirectory()) );
|
||||
|
||||
addTab( pages[0], " Name&Location " );
|
||||
addTab( pages[0], trans.translate(" Name&Location ") );
|
||||
|
||||
//Page Two of KfTAbDialog
|
||||
pages[1] = new QWidget( this, "page2" );
|
||||
|
@ -98,19 +100,20 @@ KfindTabDialog::KfindTabDialog( QWidget *parent, const char *name, const char *s
|
|||
rb2[0] = new QRadioButton( pages[1] );
|
||||
rb2[1] = new QRadioButton( pages[1] );
|
||||
rb2[2] = new QRadioButton( pages[1] );
|
||||
andL = new QLabel ("and", pages[1],"and");
|
||||
monthL = new QLabel ("month(s)", pages[1],"months");
|
||||
dayL = new QLabel ("day(s)", pages[1],"days");
|
||||
andL = new QLabel (trans.translate("and"), pages[1],"and");
|
||||
monthL = new QLabel (trans.translate("month(s)"), pages[1],"months");
|
||||
dayL = new QLabel (trans.translate("day(s)"), pages[1],"days");
|
||||
le[0] = new QLineEdit( pages[1], "lineEdit1" );
|
||||
le[1] = new QLineEdit( pages[1], "lineEdit2" );
|
||||
le[2] = new QLineEdit( pages[1], "lineEdit3" );
|
||||
le[3] = new QLineEdit( pages[1], "lineEdit4" );
|
||||
|
||||
rb1[0]->setText( "&All files" );
|
||||
rb1[1]->setText( "Find all files created or &modified:" );
|
||||
rb2[0]->setText( "&between" );
|
||||
rb2[1]->setText( "during the previou&s " );
|
||||
rb2[2]->setText( "&during the previous " );
|
||||
rb1[0]->setText( trans.translate("&All files") );
|
||||
rb1[1]->setText( trans.translate("_findall",
|
||||
"Find all files created or &modified:") );
|
||||
rb2[0]->setText( trans.translate("&between") );
|
||||
rb2[1]->setText( trans.translate("during the previou&s ") );
|
||||
rb2[2]->setText( trans.translate("&during the previous ") );
|
||||
le[0] ->setText(date2String(QDate(1980,1,1)));
|
||||
le[1] ->setText(date2String(QDate::currentDate()));
|
||||
le[2] ->setText("1");
|
||||
|
@ -118,11 +121,11 @@ KfindTabDialog::KfindTabDialog( QWidget *parent, const char *name, const char *s
|
|||
|
||||
rb1[0]->setChecked (TRUE);
|
||||
|
||||
rb1[0]->setMinimumSize(rb1[0]->sizeHint()) ;
|
||||
rb1[1]->setMinimumSize(rb1[1]->sizeHint()) ;
|
||||
rb2[0]->setMinimumSize(rb2[0]->sizeHint()) ;
|
||||
rb2[1]->setMinimumSize(rb2[1]->sizeHint()) ;
|
||||
rb2[2]->setMinimumSize(rb2[2]->sizeHint()) ;
|
||||
rb1[0]->setFixedSize(rb1[0]->sizeHint().width(),25) ;
|
||||
rb1[1]->setFixedSize(rb1[1]->sizeHint().width(),25) ;
|
||||
rb2[0]->setFixedSize(rb2[0]->sizeHint().width(),25) ;
|
||||
rb2[1]->setFixedSize(rb2[1]->sizeHint().width(),25) ;
|
||||
rb2[2]->setFixedSize(rb2[2]->sizeHint().width(),25) ;
|
||||
|
||||
bg[0]->insert( rb1[0] );
|
||||
bg[0]->insert( rb1[1] );
|
||||
|
@ -157,20 +160,20 @@ KfindTabDialog::KfindTabDialog( QWidget *parent, const char *name, const char *s
|
|||
this, SLOT(isCheckedValid()) );
|
||||
connect( le[3], SIGNAL(returnPressed()),
|
||||
this, SLOT(isCheckedValid()) );
|
||||
|
||||
addTab( pages[1], " Date Modified " );
|
||||
|
||||
addTab( pages[1], trans.translate(trans.translate(" Date Modified ")) );
|
||||
|
||||
//Page Tree of KfTAbDialog
|
||||
pages[2] = new QWidget( this, "page3" );
|
||||
|
||||
typeL = new QLabel("Of &type:" ,pages[2],"type");
|
||||
typeBox = new QComboBox(FALSE ,pages[2],"typeBox");
|
||||
textL = new QLabel("&Containing Text:",pages[2],"text");
|
||||
textEdit = new QLineEdit( pages[2], "textEdit" );
|
||||
sizeL = new QLabel("&Size is:" ,pages[2],"size");
|
||||
sizeBox = new QComboBox(FALSE ,pages[2],"sizeBox");
|
||||
sizeEdit = new QLineEdit( pages[2], "sizeEdit" );
|
||||
kbL = new QLabel("KB" ,pages[2],"kb");
|
||||
typeL =new QLabel(trans.translate("Of &type:") ,pages[2],"type");
|
||||
typeBox =new QComboBox(FALSE ,pages[2],"typeBox");
|
||||
textL =new QLabel(trans.translate("&Containing Text:"),pages[2],"text");
|
||||
textEdit=new QLineEdit( pages[2], "textEdit" );
|
||||
sizeL =new QLabel(trans.translate("&Size is:") ,pages[2],"size");
|
||||
sizeBox =new QComboBox(FALSE ,pages[2],"sizeBox");
|
||||
sizeEdit=new QLineEdit( pages[2], "sizeEdit" );
|
||||
kbL =new QLabel("KB" ,pages[2],"kb");
|
||||
|
||||
|
||||
typeL->setAlignment(namedL->alignment()|ShowPrefix);
|
||||
|
@ -188,24 +191,26 @@ KfindTabDialog::KfindTabDialog( QWidget *parent, const char *name, const char *s
|
|||
textEdit ->setEnabled(FALSE);
|
||||
sizeEdit ->setEnabled(TRUE);
|
||||
|
||||
KfFileType *typ;
|
||||
KfFileType *typ;
|
||||
|
||||
typeBox->insertItem("All Files and Folders");
|
||||
for ( typ = types->first(); typ != 0L; typ = types->next() )
|
||||
if (typ->getComment("")!="")
|
||||
typeBox->insertItem(typ->getComment(""));
|
||||
else
|
||||
typeBox->insertItem(typ->getName());
|
||||
typeBox->insertItem(trans.translate("_alltypes",
|
||||
"All Files and Folders"));
|
||||
for ( typ = types->first(); typ != 0L; typ = types->next() )
|
||||
if (typ->getComment("")!="")
|
||||
typeBox->insertItem(typ->getComment(""));
|
||||
else
|
||||
typeBox->insertItem(typ->getName());
|
||||
|
||||
sizeBox ->insertItem( "(none)" );
|
||||
sizeBox ->insertItem( "At Least" );
|
||||
sizeBox ->insertItem( "At Most" );
|
||||
sizeBox ->insertItem( trans.translate("(none)") );
|
||||
sizeBox ->insertItem( trans.translate("At Least") );
|
||||
sizeBox ->insertItem( trans.translate("At Most") );
|
||||
sizeBox ->setFixedSize(sizeBox->sizeHint());
|
||||
sizeEdit->setText("1");
|
||||
|
||||
connect( sizeEdit, SIGNAL(returnPressed()),
|
||||
this , SLOT(checkSize()) );
|
||||
|
||||
addTab( pages[2], " Advanced " );
|
||||
addTab( pages[2], trans.translate(trans.translate(" Advanced ")) );
|
||||
};
|
||||
|
||||
void KfindTabDialog::resizeEvent( QResizeEvent *ev )
|
||||
|
@ -249,12 +254,12 @@ void KfindTabDialog::resizeEvent( QResizeEvent *ev )
|
|||
|
||||
le[0]->setGeometry( 100, 60, 80, 20 );
|
||||
le[1]->setGeometry( 220, 60, 80, 20 );
|
||||
le[2]->setGeometry( 60+rb2[1]->width(), 85, 40, 20 );
|
||||
le[3]->setGeometry( 60+rb2[2]->width(), 110, 40, 20 );
|
||||
le[2]->setGeometry( 90+rb2[1]->width(), 85, 40, 20 );
|
||||
le[3]->setGeometry( 90+rb2[2]->width(), 110, 40, 20 );
|
||||
|
||||
andL->move(190,55);
|
||||
monthL->move(25+rb2[1]->width()+10+80,80);
|
||||
dayL->move(25+rb2[2]->width()+10+80,105);
|
||||
monthL->move(le[2]->x()+le[2]->width()+15,80);
|
||||
dayL->move(le[3]->x()+le[3]->width()+15,105);
|
||||
|
||||
|
||||
//Page Tree of KfTAbDialog
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define KFTABDLG_H
|
||||
|
||||
#include <ktabctl.h>
|
||||
#include <klocale.h>
|
||||
|
||||
class QButtonGroup;
|
||||
class QPushButton;
|
||||
|
@ -54,6 +55,8 @@ private:
|
|||
QString date2String(QDate);
|
||||
QDate string2Date(QString);
|
||||
|
||||
KLocale trans;
|
||||
|
||||
bool modifiedFiles;
|
||||
bool betweenDates;
|
||||
bool prevMonth;
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <kfmclient_ipc.h>
|
||||
|
||||
#include <kmsgbox.h>
|
||||
#include <kprocess.h>
|
||||
|
||||
#include "kfwin.h"
|
||||
//#include "kftypes.h"
|
||||
#include "kfarch.h"
|
||||
|
@ -330,9 +332,8 @@ void KfindWindow::execAddToArchive(KfArchiver *arch,QString archname)
|
|||
{
|
||||
QFileInfo archiv(archname);
|
||||
QString buffer,pom;
|
||||
char **arch_args;
|
||||
int args_number;
|
||||
int pos,i;
|
||||
KProcess archProcess;
|
||||
int pos;
|
||||
|
||||
if ( archiv.exists() )
|
||||
buffer = arch->getOnUpdate();
|
||||
|
@ -341,13 +342,15 @@ void KfindWindow::execAddToArchive(KfArchiver *arch,QString archname)
|
|||
|
||||
buffer=buffer.simplifyWhiteSpace();
|
||||
|
||||
args_number=buffer.contains(" ")+1;
|
||||
//printf("args number = %d\n",args_number);
|
||||
pos = buffer.find(" ");
|
||||
pom = buffer.left(pos);
|
||||
if (pos==-1)
|
||||
pos = buffer.length();
|
||||
buffer = buffer.remove(0,pos+1);
|
||||
|
||||
arch_args= (char **) malloc(args_number*sizeof(char *));
|
||||
archProcess.setExecutable(pom.data());
|
||||
archProcess.clearArguments ();
|
||||
|
||||
i=0;
|
||||
// i<=args_number
|
||||
while( !buffer.isEmpty() )
|
||||
{
|
||||
pos = buffer.find(" ");
|
||||
|
@ -358,7 +361,7 @@ void KfindWindow::execAddToArchive(KfArchiver *arch,QString archname)
|
|||
QFileInfo *fileInfo = new QFileInfo(lbx->text(lbx->currentItem()));
|
||||
pom.sprintf("%s/",(fileInfo->dirPath(TRUE)).data());
|
||||
|
||||
printf("Dir = %s\n",pom.data());
|
||||
// printf("Dir = %s\n",pom.data());
|
||||
};
|
||||
|
||||
if ( pom=="%a" )
|
||||
|
@ -373,27 +376,15 @@ void KfindWindow::execAddToArchive(KfArchiver *arch,QString archname)
|
|||
pom = fileInfo->fileName();
|
||||
};
|
||||
|
||||
arch_args[i]=(char *) malloc(pom.length()*sizeof(char));
|
||||
strcpy(arch_args[i],pom.data());
|
||||
archProcess << pom.data();
|
||||
|
||||
if (pos==-1)
|
||||
pos = buffer.length();
|
||||
buffer = buffer.remove(0,pos+1);
|
||||
i++;
|
||||
};
|
||||
|
||||
// for(i=0;i<args_number;i++)
|
||||
// printf("Arg[%d] = %s\n",i,arch_args[i]);
|
||||
if (fork()==0)
|
||||
{
|
||||
execvp(arch_args[0],arch_args);
|
||||
printf("Error by creating child process!\n");
|
||||
exit(1);
|
||||
};
|
||||
|
||||
for(i=0;i<args_number;i++)
|
||||
free(arch_args[i]);
|
||||
free(arch_args);
|
||||
if ( !archProcess.start(KProcess::DontCare) )
|
||||
printf("Error by creating child process!\n");
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@ int main( int argc, char ** argv )
|
|||
|
||||
KApplication *app = new KApplication( argc, argv, "kfind" );
|
||||
|
||||
// QFont default_font("-*-helvetica-medium-r-*-*-*-*-*-*-*-*-iso8859-2");
|
||||
// default_font.setRawMode( TRUE );
|
||||
// QApplication::setFont(default_font );
|
||||
|
||||
(void)signal(SIGCHLD, SIG_DFL);
|
||||
|
||||
//Scan for saving options in kfind resource file
|
||||
|
|
Loading…
Reference in a new issue