aboutsummaryrefslogtreecommitdiff
path: root/lumina-search/main.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-04-27 10:33:15 -0400
committerKen Moore <ken@pcbsd.org>2015-04-27 10:33:15 -0400
commitf4943623c0af7e28f22c1da09bbb31ee593ea00a (patch)
tree14dd17ef4e9c77c0892b7c68009cb557c6881012 /lumina-search/main.cpp
parentAdd support for system-defined default non-mime applications in the luminaDes... (diff)
downloadlumina-f4943623c0af7e28f22c1da09bbb31ee593ea00a.tar.gz
lumina-f4943623c0af7e28f22c1da09bbb31ee593ea00a.tar.bz2
lumina-f4943623c0af7e28f22c1da09bbb31ee593ea00a.zip
Add new variability for lumina-search:
1) New CLI Usage Flags: lumina-search [-no-excludes] [-dir [<path>]] [-search <term>] These flags allow for a ton of variability with the utility: such as intantly setting the search dir/parameters, or starting a search for an app/dir/file right away. 2) Also put a new checkbox on the config UI to determine whether to save setttings as the new defaults or to use them temporarily. This allows for temporary setting of the search dir/excludes. 3) Make sure to list the current search dir and whether there are any excluded dirs ("Smart" mode) within the status bar when a file search is selected.
Diffstat (limited to 'lumina-search/main.cpp')
-rw-r--r--lumina-search/main.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/lumina-search/main.cpp b/lumina-search/main.cpp
index 305c388b..f03bf04a 100644
--- a/lumina-search/main.cpp
+++ b/lumina-search/main.cpp
@@ -8,6 +8,12 @@
#include <LuminaThemes.h>
#include <LuminaUtils.h>
+//==== INPUT FORMAT ====
+// lumina-search [-no-excludes] [-dir [directory]] [-search <term>]
+// -no-excludes: Don't exclude anything from this search
+// -dir [directory]: Setup a file/dir search within the current working dir (or specified dir)
+// -search <term>: Start a search with the given term
+//===================
int main(int argc, char ** argv)
{
//qDebug() << "Init App...";
@@ -21,6 +27,44 @@ int main(int argc, char ** argv)
MainUI w;
QObject::connect(&theme,SIGNAL(updateIcons()), &w, SLOT(setupIcons()) );
w.show();
+ if(argc>1){
+ bool startsearch = false;
+ for(int i=1; i<argc; i++){
+ QString val = QString(argv[i]).toLower();
+ if( val == "-no-excludes"){ w.disableExcludes(); }
+ else if(val=="-dir"){
+ //Check the next input value for a directory path
+ QString dir;
+ if( argc>(i+1) ){ dir = QString(argv[i+1]); }
+ //Check the input for validity
+ if(dir.startsWith("-")){dir.clear(); } //not a directory, just another input
+ else if(!dir.startsWith("/")){ //not an absolute path
+ dir = QDir::currentPath()+"/"+dir;
+ QFileInfo info(dir);
+ if( !info.exists() || !info.isDir() ){ dir.clear(); } //invalid relative dir
+ }
+
+ if(dir.isEmpty()){ dir= QDir::currentPath(); } //use the current directory
+ else{ i++; } //using the next input value - skip it for the next iteration
+ w.setSearchDirectory( dir );
+
+ }else if(val=="-search"){
+ //Check the next input value for a text string
+ QString text;
+ if( argc>(i+1) ){ text = QString(argv[i+1]); }
+ //Check the input for validity
+ if( !text.isEmpty() ){
+ i++; //using the next input value - skip it for the next iteration
+ w.setSearchTerm( text );
+ startsearch = true;
+ }
+ }
+ }//end loop over inputs
+ if(startsearch){
+ //A CLI search was requested, go ahead and start it now
+ QTimer::singleShot(10, &w, SLOT(startSearch()));
+ }
+ } //end check for input arguments
return a.exec();
}
bgstack15