コード例 #1
0
ファイル: findresultstab.cpp プロジェクト: kluete/codelite
void FindResultsTab::OnRecentSearches(wxAuiToolBarEvent& e)
{
    // Show the menu
    wxMenu menu;
    clAuiToolStickness s(m_tb, e.GetId());
    const int firstID = 8000;
    int counter = 0;
    std::map<int, History> entries;
    std::for_each(m_history.Begin(), m_history.End(), [&](const std::pair<wxString, History>& p) {
        menu.Prepend(firstID + counter, p.first, "", wxITEM_CHECK)->Check(m_searchTitle == p.first);
        entries.insert(std::make_pair(firstID + counter, p.second));
        ++counter;
    });

    menu.AppendSeparator();
    int clearHistory = ::wxNewId();
    menu.Append(clearHistory, _("Clear History"));
    int sel = GetPopupMenuSelectionFromUser(menu, e.GetItemRect().GetBottomLeft());
    if(sel == wxID_NONE) return;
    if(sel == clearHistory) {
        m_history.Clear();

    } else if(entries.count(sel)) {
        const History& h = entries.find(sel)->second;
        LoadSearch(h);
    }
}
コード例 #2
0
void FindReplace::FindSearch(QList<SearchEditorModel::searchEntry *> search_entries)
{
    if (search_entries.isEmpty()) {
        ShowMessage(tr("No searches selected"));
        return;
    }

    SetLookWhereFromModifier();

    foreach (SearchEditorModel::searchEntry* search_entry, search_entries) {
        LoadSearch(search_entry);
        if (Find()) {
            break;
        };
    }
コード例 #3
0
void FindReplace::LoadSearchByName(QString name)
{
    LoadSearch(SearchEditorModel::instance()->GetEntryFromName(name));
}
コード例 #4
0
ファイル: copy-gets.cpp プロジェクト: billfm/billfm
int main( int    argc, char **argv )
{
 app_path=g_path_get_dirname(argv[0]);
 int operation=TASK_COPY;
 gtk_init( &argc, &argv );
 
 ClassString uid=g_strdup_printf("%d",geteuid());
 InitListDisk(g_get_home_dir(),uid.s);


 f=fopen("/tmp/billfm.txt","rt"); 
 if(!f)
 {
  printf("Not open file /tmp/billfm.txt !\n");
  exit(0);
 }

 NexString();

 if(!strcmp(buffer,"MOVE"))
 {
   operation=TASK_MOVE;
 } else 
 if(!strcmp(buffer,"COPY"))
 {
   operation=TASK_COPY;
 } else 
 if(!strcmp(buffer,"CREATE_DIR"))
 {
   operation=TASK_CREATE_DIR;
 } else 
 if(!strcmp(buffer,"CLEAR_TRASH"))
 {
   operation=TASK_CLEAR_TRASH;
 } else 
 if(!strcmp(buffer,"FIND"))
 {
   operation=TASK_FIND;
 } else 
 if(!strcmp(buffer,"SMB_MOUNT"))
 {
   operation=TASK_SMB_MOUNT;
 } else 
 if(!strcmp(buffer,"READ_TAR"))
 {
   operation=TASK_READ_TAR;
 } else 
 {
  printf("Operation unknow\n");
  exit(0);
 }

 NexString();
 DestDir=g_strdup(buffer);
// printf("dest %s\n",PanelGetDestDir());

	const char * dest_dir=PanelGetDestDir();
	if(operation==TASK_COPY)
	{
		LoadList();
		DialogCopy(operation, dest_dir,list_source); 
	} else
	if(operation==TASK_MOVE)
	{
		LoadList();
		DialogCopy(operation, dest_dir,list_source); 
	} else
	if(operation==TASK_CREATE_DIR)
	{
		CreateNewDirDialog(dest_dir);
	} else
	if(operation==TASK_CLEAR_TRASH)
	{
		NexString();
		const char * homedir =g_strdup(buffer);
		NexString();
		const char * uid =g_strdup(buffer);
		InitListDisk(homedir,uid);
		UtilsClearTrash();
	} else
	if(operation==TASK_FIND)
	{
		NexString();
		const char * mask =g_strdup(buffer);
		NexString();
		const char * text =g_strdup(buffer);
		NexString();
		const char * mode =g_strdup(buffer);
		LoadSearch(mask,text,DestDir,mode);
	} else
	if(operation==TASK_SMB_MOUNT)
	{
		NexString();
		const char * source =g_strdup(buffer);
		NexString();
		const char * opt =g_strdup(buffer);
		if(!strcmp(opt,"rw")) opt=rw_opt; else opt=ro_opt;
		ClassString com=g_strdup_printf("mount -t cifs \"%s\" \"%s\" -o %s", source,DestDir,opt);
		printf("%s\n",com.s);
		system(com.s);
	} else
	if(operation==TASK_READ_TAR)
	{
		chdir(DestDir);
		NexString();
		SourceTar =g_strdup(buffer);
		ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
		if(IsTar(SourceTar))
		{
			ClassString com=g_strdup_printf("tar -tvf '%s' > .dir.lst",SourceTar);
			system(com.s); 
			LoadGets(outfile.s,PrintTar);
		} else
		if(IsZip(SourceTar))
		{
			ClassString com=g_strdup_printf("unzip -l  '%s' > .dir.lst",SourceTar);
			system(com.s); 
			ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
			CountReadStrings=0;
			LoadGets(outfile.s,PrintZip);
		}
		if(IsRar(SourceTar))
		{
			ClassString com=g_strdup_printf("unrar vt  '%s' > .dir.lst",SourceTar);
			system(com.s); 
			ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
			CountReadStrings=0;
			RarPassword=0;
			LoadGets(outfile.s,PrintRar);
		}

		if(IsDeb(SourceTar))
		{
			ClassString com=g_strdup_printf("ar vt  '%s' > .dir.lst",SourceTar);
			system(com.s); 
			ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
			CountReadStrings=0;
			RarPassword=0;
			LoadGets(outfile.s,PrintDeb);
		}

	}
 fclose(f);
}