⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfolder.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 3 页
字号:
   XtManageChild(delWin);   XMapRaised(ishApp->display, XtWindow(XtParent(delWin)));} // End DeleteFolders/*--------------------------------------------------------------- *  Callback to delete the folders in delFolderList */voidMainWinP::FinishFolderDel(Widget, MainWinP *This, XtPointer){   This->pub->BusyCursor(True);   ishApp->Broadcast("");//// If the current folder will be closed, close any open reading windows//   if ( This->delFolderList->includes(This->pub->curFolder) ) {      unsigned	count = ishApp->readWinList.size();      for (int i=0; i<count; i++) {	 ReadWinC	*readWin = (ReadWinC*)*ishApp->readWinList[i];	 readWin->Hide();      }      This->pub->curFolder = NULL;   }//// Loop through folders and delete them//   u_int	count = This->delFolderList->size();   StringC	statMsg;   for (int i=0; i<count; i++) {      FolderC	*folder = (*This->delFolderList)[i];      statMsg = folder->abbrev;//// Remove folder from user folder list//      ishApp->folderPrefs->RemoveFolder(folder);//// Delete folder//      folder->delFiles = True;      delete folder;      statMsg += " deleted";      ishApp->Broadcast(statMsg);   } // End for each folder   This->delFolderList->removeAll();//// If the current folder was closed, switch to the in-box.//   if ( !This->pub->curFolder )      This->pub->ActivateSystemFolder();   This->folderVBox->Refresh();   This->pub->BusyCursor(False);} // End FinishFolderDel/*--------------------------------------------------------------- *  Callback to handle folder-select all */voidMainWinP::DoFolderSel(Widget, MainWinP *This, XtPointer){   This->pub->BusyCursor(True);   This->folderVBox->SelectItemsOnly(This->folderVBox->VisItems());   This->pub->BusyCursor(False);}/*--------------------------------------------------------------- *  Callback to handle folder-deselect all */voidMainWinP::DoFolderDesel(Widget, MainWinP *This, XtPointer){   This->pub->BusyCursor(True);   This->folderVBox->DeselectAllItems();   This->pub->BusyCursor(False);}/*--------------------------------------------------------------- *  Callback to handle folder-new */voidMainWinP::DoFolderNew(Widget, MainWinP *This, XtPointer){//// Make sure directory is accessible//   StringC	dir = ishApp->appPrefs->FolderDir();   if ((!ishApp->appPrefs->usingImap) || (ishApp->folderPrefs->UsingLocal())) {      if ( access(dir, R_OK) != 0 ) {	 dir = ishApp->home;	 if ( access(dir, R_OK) != 0 )	    dir = ".";      }   }   if ( !This->newFolderWin ) {      FileChooserWinC	*win = new FileChooserWinC(*This->pub, "newFolderWin");      win->SingleSelect(True);      win->AddOkCallback((CallbackFn*)FinishFolderNew, This);      win->HideList();      This->newFolderWin = win;   } // End if window needs to be created    if ((!ishApp->appPrefs->usingImap) || (!ishApp->folderPrefs->UsingLocal())) {	This->newFolderWin->SetDirectory(dir);	This->newFolderWin->SetDefaultDir(ishApp->appPrefs->FolderDir());    }    // if    else {	This->newFolderWin->SetDirectory("");	This->newFolderWin->SetDefaultDir("");    }   This->newFolderWin->ShowDirsInFileList (ishApp->folderPrefs->usingMh);   This->newFolderWin->ShowFilesInFileList(ishApp->folderPrefs->usingUnix ||					   ishApp->folderPrefs->usingMmdf);   This->newFolderWin->Show(*This->pub);} // End DoFolderNew/*--------------------------------------------------------------- *  Callback routine to handle press of Ok in file selection box for new */voidMainWinP::FinishFolderNew(StringListC *list, MainWinP *This){   StringC	name = *(*list)[0];   if ( name.size() == 0 ) {      StringC	msg = "Please enter a folder name.";      set_invalid(This->newFolderWin->SelectTF(), True, True);      This->pub->PopupMessage(msg);      This->newFolderWin->HideOk(False);      return;   }//// Don't allow spaces in the name//   if ( name.Contains(' ') || name.Contains('\t') ) {      StringC	msg = "Spaces are not allowed in folder names.";      set_invalid(This->newFolderWin->SelectTF(), True, True);      This->pub->PopupMessage(msg);      This->newFolderWin->HideOk(False);      return;   }   ishApp->ExpandFolderName(name);   if ( debuglev > 0 ) cout <<"Trying to create folder: " <<name <<endl;//// See if the folder already exists//   FolderTypeT	type = ishApp->folderPrefs->FolderType(name);   if ( type != UNKNOWN_FOLDER && type != IMAP_FOLDER ) {      StringC	msg = name;      msg += " already exists";      This->pub->PopupMessage(msg);      This->newFolderWin->HideOk(False);      return;   }   FolderC *newFolder = ishApp->folderPrefs->GetFolder(name, /*createOk=*/True);   if ( newFolder ) {      ishApp->folderPrefs->AddOpenFolder(newFolder);      This->pub->ShowFolder(newFolder);      ishApp->appPrefs->AddRecentFolder(newFolder->name);   }   else {      StringC	errmsg("Could not create folder: ");      errmsg += name;      errmsg += ".\n";      if ( errno != 0 ) errmsg += SystemErrorMessage(errno);      This->pub->PopupMessage(errmsg);   }   This->pub->BusyCursor(False);} // End FinishFolderNew/*----------------------------------------------------------------------- *  Handle resize of extra frame in open folders dialog */static voidHandleOpenExpose(Widget w, XtPointer, XEvent *ev, Boolean*){   if ( ev->type != MapNotify ) return;//// Fix sizes of pane//   Dimension	ht;   XtVaGetValues(w, XmNheight, &ht, NULL);   XtVaSetValues(w, XmNpaneMinimum, ht, XmNpaneMaximum, ht, 0);}/*--------------------------------------------------------------- *  Callback to handle folder-open */voidMainWinP::DoFolderOpen(Widget, MainWinP *This, XtPointer){   StringC	dir = ishApp->appPrefs->FolderDir();   if ( !IsImapName(dir) ) {//// Make sure directory is accessible//      if ( access(dir, R_OK) != 0 ) {	 int	err = errno;	 StringC	msg("Could not open folder diretory: ");	 msg += dir + ".\n" + SystemErrorMessage(err);	 This->pub->PopupMessage(msg);	 dir = ishApp->home;	 if ( access(dir, R_OK) != 0 ) {	    err = errno;	    msg = "Could not open folder directory: " + dir		+ ".\n" + SystemErrorMessage(err);	    This->pub->PopupMessage(msg);	    return;	 }      }   } // End if not an IMAP directory   if ( !This->openSelectWin ) {      This->openSelectWin = new FileChooserWinC(*This->pub, "openSelectWin");//// Add pane for activation.  Put it in the last position.//      Cardinal	childCount;      XtVaGetValues(This->openSelectWin->PanedWin(), XmNnumChildren,      		    &childCount, NULL);      WArgList	args;      args.PositionIndex(childCount+1);      args.ShadowThickness(0);      Widget centerFrame =	 XmCreateFrame(This->openSelectWin->PanedWin(), "centerFrame", ARGS);      args.Reset();      args.ChildType(XmFRAME_TITLE_CHILD);      args.ChildHorizontalAlignment(XmALIGNMENT_CENTER);      Widget frame = XmCreateFrame(centerFrame, "activateFrame", ARGS);      args.Reset();      args.Orientation(XmHORIZONTAL);      args.Packing(XmPACK_TIGHT);      Widget radio = XmCreateRadioBox(frame, "activateRadio", ARGS);      This->openOnlyTB = XmCreateToggleButton(radio, "openOnlyTB", 0,0);      This->openActTB  = XmCreateToggleButton(radio, "openActTB",  0,0);      XtManageChild(This->openOnlyTB);      XtManageChild(This->openActTB);      XtManageChild(radio);	// frame children      XtManageChild(frame);      XtManageChild(centerFrame);//// Add a callback so we can fix the size of the pane we just added//      XtAddEventHandler(centerFrame, StructureNotifyMask, False,			HandleOpenExpose, NULL);      XmToggleButtonSetState(This->openActTB, True, True);      This->openSelectWin->HandleHelp(This->openOnlyTB);      This->openSelectWin->HandleHelp(This->openActTB);      This->openSelectWin->SingleSelect(False);      This->openSelectWin->AddVerifyCallback((CallbackFn*)VerifyOpenFiles,This);      This->openSelectWin->AddOkCallback    ((CallbackFn*)FinishOpen,     This);      This->openSelectWin->HideList();   } // End if window not yet created    if ( (!ishApp->appPrefs->usingImap) ||	(!ishApp->folderPrefs->UsingLocal()) ) {	This->openSelectWin->SetDirectory(dir);	This->openSelectWin->SetDefaultDir(ishApp->appPrefs->FolderDir());    }    else {	This->openSelectWin->SetDirectory("");	This->openSelectWin->SetDefaultDir("");    }   This->openSelectWin->ShowDirsInFileList (ishApp->folderPrefs->usingMh);   This->openSelectWin->ShowFilesInFileList(ishApp->folderPrefs->usingUnix ||   					    ishApp->folderPrefs->usingMmdf);   This->openSelectWin->Show(*This->pub);} // End DoFolderOpen/*--------------------------------------------------------------- *  Callback routine to double check file list in file chooser */voidMainWinP::VerifyOpenFiles(StringListC *list, MainWinP *This){   FileChooserWinC	*fileWin = This->openSelectWin;   StringC		dname = fileWin->Directory();   if ( !fileWin->UsingImap() ) {//// Set directory to one in file chooser//      chdir(dname);//// Remove lock files and unreadable files//      u_int	count = list->size();      for (int i=count-1; i>=0; i--) {	 StringC	*name = (*list)[i];	 if ( name->EndsWith(".lock") || access(*name, R_OK) != 0 )	    list->remove(i);      }      chdir(ishApp->startupDir);   } // End if not using IMAP//// Remove folders that are already open//   if ( !dname.EndsWith("/") ) dname += "/";   u_int	count = ishApp->folderPrefs->OpenFolders().size();   StringC	fname;   for (int i=0; i<count; i++) {      FolderC	*folder = ishApp->folderPrefs->OpenFolders()[i];      CharC	name    = folder->name;//// See if folder is in same directory as file chooser//      if ( name.StartsWith(dname) ) {	 name.CutBeg(dname.size());	 fname = name;	 int	index = list->indexOf(fname);	 if ( index != list->NULL_INDEX ) list->remove(index);      }   }} // End VerifyOpenFiles/*--------------------------------------------------------------- *  Callback routine to handle press of Ok in file selection box for open */voidMainWinP::FinishOpen(StringListC *list, MainWinP *This){   This->pub->BusyCursor(True);//// Temporarily postpone changes to the recent folders menu//   This->deferRecentMenu = True;   This->openSelectWin->HideOk(True);   StringC	name;   Boolean	needAct = XmToggleButtonGetState(This->openActTB);   unsigned	count   = list->size();   for (int i=0; i<count; i++) {      StringC	*name = (*list)[i];      FolderC	*folder = ishApp->folderPrefs->GetFolder(*name,							 /*createOk=*/False);      if ( folder ) {	 This->pub->ShowFolder(folder);	 ishApp->appPrefs->AddRecentFolder(folder->name);	 if ( needAct && folder->opened ) {//// Close any unpinned reading windows//	    count = ishApp->readWinList.size();	    for (i=0; i<count; i++) {	       ReadWinC	*readWin = (ReadWinC*)*ishApp->readWinList[i];	       if ( !readWin->Pinned() ) readWin->Hide();	    }//// Switch folders//	    This->pub->curFolder->Deactivate();	    folder->Activate();	    if ( folder->active ) {	       This->pub->SetCurrentFolder(folder);	       needAct = False;	    }	    else {	       folder->Deactivate();	       This->pub->curFolder->Activate();	    }	 } // End if we need to activate a folder      } // End if folder opened      else {	 This->openSelectWin->HideOk(False);	 StringC	errmsg("Could not open folder: ");	 errmsg += *name;	 errmsg += ".\n";	 if ( errno != 0 ) errmsg += SystemErrorMessage(errno);	 This->pub->PopupMessage(errmsg);      }   } // End for each name in list   This->folderVBox->Refresh();   This->msgVBox->Refresh();   This->pub->BusyCursor(False);//// Update recent folder menus now//   This->deferRecentMenu = False;   if ( ishApp->appPrefs->recentFolderTime > This->recentMenuTime )      This->BuildRecentFolderMenus();} // End FinishOpen

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -