📄 appprefc.c
字号:
BooleanAppPrefC::WriteRecentFolders(){ StringListC lineList; ReadResFile(lineList); Update(lineList, "recentFolders", recentFolders);//// Write the information back to the file// return WriteResFile(lineList);} // End WriteRecentFolders/*--------------------------------------------------------------- * Method to write window position resources to a file */BooleanAppPrefC::WriteWindowPositions(){ StringListC lineList; ReadResFile(lineList); Position x, y; Dimension w, h; XtVaGetValues(*ishApp->mainWin, XmNx, &x, XmNy, &y, NULL); Update(lineList, "mainShell.x", x); Update(lineList, "mainShell.y", y); XtVaGetValues(ishApp->mainWin->FolderVBox().ScrollForm(), XmNwidth, &w, XmNheight, &h, NULL); Update(lineList, "mainShell.mainWindow*folderBox*scrollForm.width", w); Update(lineList, "mainShell.mainWindow*folderBox*scrollForm.height", h);#if 0 XtVaGetValues(ishApp->mainWin->MsgVBox().ScrollForm(), XmNwidth, &w, XmNheight, &h, NULL); Update(lineList, "mainShell.mainWindow*msgBox*scrollForm.width", w); Update(lineList, "mainShell.mainWindow*msgBox*scrollForm.height", h);#else int count = ishApp->mainWin->FieldView().VisibleItemCount(); if ( count > 0 ) Update(lineList, "mainShell.mainWindow*msgBox*visibleItemCount", count);#endif if ( ishApp->sendWinList.size() > 0 ) { SendWinC *sendWin = (SendWinC *)*ishApp->sendWinList[0]; XtVaGetValues(*sendWin, XmNx, &x, XmNy, &y, NULL); Update(lineList, "sendWin.x", x); Update(lineList, "sendWin.y", y); } if ( ishApp->readWinList.size() > 0 ) { ReadWinC *readWin = (ReadWinC *)*ishApp->readWinList[0]; XtVaGetValues(*readWin, XmNx, &x, XmNy, &y, NULL); Update(lineList, "readWin.x", x); Update(lineList, "readWin.y", y); }//// Write the information back to the file// return WriteResFile(lineList);} // End WriteWindowPositions/*--------------------------------------------------------------- * Method to write version information to the rc file */BooleanAppPrefC::WriteVersion(){ StringListC lineList; ReadResFile(lineList); Update(lineList, "versionNumber", versionNumber);//// Write the information back to the file// return WriteResFile(lineList);} // End WriteVersion/*------------------------------------------------------------------------ * Method to add a folder name to the list of recent folders and update * the timestamp. */voidAppPrefC::AddRecentFolder(StringC name){ ishApp->AbbreviateFolderName(name);//// If the name is already at the top of the list, return.// int index = recentFolders.indexOf(name); if ( index == 0 ) return;//// If the name is elsewhere in the list, remove it so it will get added to// the top// if ( index > 0 ) recentFolders.remove(index);//// Add the name to the top of the list// recentFolders.prepend(name);//// Remove a name if there are too many// if ( recentFolders.size() > recentFolderCount ) recentFolders.remove(recentFolders.size()-1); recentFolderTime = time(0);//// Call people who may want to know about this// CallCallbacks(recentChangedCalls, this);} // End AddRecentFolder/*------------------------------------------------------------------------ * Method to edit the preferences */voidAppPrefC::Edit(Widget parent){ halApp->BusyCursor(True); if ( !prefWin ) prefWin = new AppPrefWinC(parent); prefWin->Show(); halApp->BusyCursor(False);}/*------------------------------------------------------------------------ * Method to set folder directory */voidAppPrefC::SetFolderDir(const char *dir){ if ( orig.folderDir == dir ) return; folderDir = orig.folderDir = dir; ShellExpand(folderDir, True/*oneWord*/); // pre-pend home directory to relative path names if ( !folderDir.StartsWith("/") ) { // don't pre-pend if IMAP folder and using mixed local/remote folders if ( (!IsImapName(folderDir)) || (!ishApp->folderPrefs->UsingLocal()) ) folderDir = ishApp->home + "/" + folderDir; } if ( folderDir.size() > 1 && folderDir.EndsWith("/") ) folderDir.CutEnd(1); ishApp->mainWin->FolderDirChanged();//// Update all reading windows// u_int count = ishApp->readWinList.size(); for (int i=0; i<count; i++) { ReadWinC *readWin = (ReadWinC *)*ishApp->readWinList[i]; readWin->FolderDirChanged(); } if ( debuglev > 0 ) cout <<"New folder directory is: " <<folderDir <<endl;} // End SetFolderDir/*------------------------------------------------------------------------ * Method to set default save folder */voidAppPrefC::SetSaveFile(const char *name){ if ( orig.saveFile == name ) return; saveFile = orig.saveFile = name; ishApp->ExpandFolderName(saveFile);}/*------------------------------------------------------------------------ * Method to set save pattern directory name */voidAppPrefC::SetSaveDir(const char *name){ if ( orig.saveDir == name ) return; saveDir = orig.saveDir = name; ishApp->ExpandFolderName(saveDir);}/*------------------------------------------------------------------------ * Method to set automounter root prefix */voidAppPrefC::SetAutomountRoot(const char *name){ if ( orig.automountRoot == name ) return; automountRoot = orig.automountRoot = name; ShellExpand(automountRoot, True/*oneWord*/);}/*------------------------------------------------------------------------ * Method to set archive folder name */voidAppPrefC::SetArchiveFolder(const char *name){ if ( orig.archiveFolder == name ) return; archiveFolder = orig.archiveFolder = name; ishApp->ExpandFolderName(archiveFolder);}#if 0/*------------------------------------------------------------------------ * Method to set IMAP server name */voidAppPrefC::SetImap(Boolean using, const char *name){ if ( using == usingImap && imapServer && imapServer->name == name ) return; delete imapServer; usingImap = using; if ( usingImap ) { imapServer = new ImapServerC(name);//// Update inBox and folderDir with server name if necessary// if ( !ishApp->folderPrefs->usingUnix && !ishApp->folderPrefs->usingMh && !ishApp->folderPrefs->usingMmdf ) { if ( ishApp->inBox.StartsWith('{') ) { int pos = ishApp->inBox.PosOf('}'); ishApp->inBox(1,pos-1) = name; } else { ishApp->inBox = "{" + ImapServerName() + "}" + ishApp->inBox; } if ( folderDir.StartsWith('{') ) { int pos = folderDir.PosOf('}'); folderDir(1,pos-1) = name; } else { folderDir = "{" + ImapServerName() + "}" + folderDir; } } // End if not using local folders } // End if using IMAP} // End SetImap/*------------------------------------------------------------------------ * Method to query IMAP server name */CharCAppPrefC::ImapServerName(){ if ( imapServer ) return imapServer->name; else return "";}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -