"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/FilePanel.cpp" between
xfe-1.42.tar.gz and xfe-1.43.tar.gz

About: Xfe (X File Explorer) is a file manager and browser (using the FOX toolkit).

FilePanel.cpp  (xfe-1.42):FilePanel.cpp  (xfe-1.43)
skipping to change at line 4201 skipping to change at line 4201
break; break;
} }
} }
// History limit reached // History limit reached
if (OpenNum > OPEN_HIST_SIZE) if (OpenNum > OPEN_HIST_SIZE)
{ {
OpenNum--; OpenNum--;
} }
// Restore original history order
opendialog->clearItems();
for (int i = 0; i < OpenNum; i++)
{
opendialog->appendItem(OpenHistory[i]);
}
// New string // New string
if (newstr) if (newstr)
{ {
// FIFO // FIFO
strlcpy(OpenHistory[0], cmd.text(), cmd.length()+1); strlcpy(OpenHistory[0], cmd.text(), cmd.length()+1);
for (int i = 1; i < OpenNum; i++) for (int i = 1; i < OpenNum; i++)
{ {
strlcpy(OpenHistory[i], opendialog->getHistoryItem(i-1).text(), opendialog->getHistoryItem(i-1).length()+1); strlcpy(OpenHistory[i], opendialog->getHistoryItem(i-1).text(), opendialog->getHistoryItem(i-1).length()+1);
} }
} }
skipping to change at line 4544 skipping to change at line 4551
allowPopupScroll = true; // Allow keyboard scrolling allowPopupScroll = true; // Allow keyboard scrolling
menu->popup(NULL, x, y); menu->popup(NULL, x, y);
getApp()->runModalWhileShown(menu); getApp()->runModalWhileShown(menu);
allowPopupScroll = false; allowPopupScroll = false;
return(1); return(1);
} }
// Read all executable file names that are located into the script directory // Read all executable file names that are located into the script directory
// Sort entries alphabetically // Sort entries alphabetically, directories first
int FilePanel::readScriptDir(FXMenuPane* scriptsmenu, FXString dir) int FilePanel::readScriptDir(FXMenuPane* scriptsmenu, FXString dir)
{ {
DIR* dp; DIR* dp;
struct dirent** namelist; struct dirent** namelist;
// Open directory // Open directory
if ((dp = opendir(dir.text())) == NULL) if ((dp = opendir(dir.text())) == NULL)
{ {
return(0); return(0);
} }
// Eventually add a / at the end of the directory name // Eventually add a / at the end of the directory name
if (dir[dir.length()-1] != '/') if (dir[dir.length()-1] != '/')
{ {
dir = dir+"/"; dir = dir+"/";
} }
// Read directory and sort entries alphabetically // First, read only directory entries and sort them alphabetically
int n = scandir(dir.text(), &namelist, NULL, alphasort); int n;
n = scandir(dir.text(), &namelist, NULL, alphasort);
if (n < 0) if (n < 0)
{ {
perror("scandir"); perror("scandir");
} }
else else
{ {
for (int k = 0; k < n; k++) for (int k = 0; k < n; k++)
{ {
// Avoid hidden directories and '.' and '..' // Avoid hidden directories and '.' and '..'
if (namelist[k]->d_name[0] != '.') if (namelist[k]->d_name[0] != '.')
skipping to change at line 4587 skipping to change at line 4595
// Recurse if non empty directory // Recurse if non empty directory
if (::isDirectory(pathname)) if (::isDirectory(pathname))
{ {
if (!::isEmptyDir(pathname)) if (!::isEmptyDir(pathname))
{ {
FXMenuPane* submenu = new FXMenuPane(this); FXMenuPane* submenu = new FXMenuPane(this);
new FXMenuCascade(scriptsmenu, namelist[k]->d_name, NULL , submenu); new FXMenuCascade(scriptsmenu, namelist[k]->d_name, NULL , submenu);
readScriptDir(submenu, pathname); readScriptDir(submenu, pathname);
} }
} }
// Add only executable files to the list
else if (isReadExecutable(pathname))
{
new FXMenuCommand(scriptsmenu, namelist[k]->d_name + FXStrin
g("\t\t") + pathname, miniexecicon, this, FilePanel::ID_RUN_SCRIPT);
}
} }
free(namelist[k]); free(namelist[k]);
} }
free(namelist); free(namelist);
} }
// Then, read only executable files and sort them alphabetically
n = scandir(dir.text(), &namelist, NULL, alphasort);
if (n < 0)
{
perror("scandir");
}
else
{
for (int k = 0; k < n; k++)
{
// Add only executable files to the list
FXString pathname = dir + namelist[k]->d_name;
if (!::isDirectory(pathname) && isReadExecutable(pathname
))
{
new FXMenuCommand(scriptsmenu, namelist[k]->d_nam
e + FXString("\t\t") + pathname, miniexecicon, this, FilePanel::ID_RUN_SCRIPT);
}
free(namelist[k]);
}
free(namelist);
}
// Close directory // Close directory
(void)closedir(dp); (void)closedir(dp);
return(1); return(1);
} }
// Run Terminal in the selected directory // Run Terminal in the selected directory
long FilePanel::onCmdXTerm(FXObject*, FXSelector, void*) long FilePanel::onCmdXTerm(FXObject*, FXSelector, void*)
{ {
int ret; int ret;
skipping to change at line 5882 skipping to change at line 5905
getApp()->endWaitCursor(); getApp()->endWaitCursor();
MessageBox::error(this, BOX_OK, _("Error"), "%s", text); MessageBox::error(this, BOX_OK, _("Error"), "%s", text);
return(0); return(0);
} }
getApp()->endWaitCursor(); getApp()->endWaitCursor();
// Get package name, or detect when the file isn't in a package // Get package name, or detect when the file isn't in a package
FXString str = text; FXString str = text;
if (pkg_format == DEB_PKG) // DEB based distribution if (pkg_format == DEB_PKG) // DEB based distribution
{ {
FXString substr = str.section(':', 1); int idx = str.find(" "); // Split output at first whitespa
if (substr.length()-2 == file.length()) // No other word than the file n ce
ame FXString pkgname = str.left(idx-1); // Remove trailing colon
FXString fname = str.right(str.length()-idx);
fname.trim(); // Remove leading space and trail
ing newline
if (streq(fname.text(), file.text())) // No other word than the file na
me
{ {
str = str.section(':', 0); // (plus ' ' at the beginning an d '\n' at the end) str = pkgname.text();
} }
else else
{ {
str = ""; str = "";
} }
} }
if (pkg_format == RPM_PKG) // RPM based distribution if (pkg_format == RPM_PKG) // RPM based distribution
{ {
if (str.find(' ') != -1) // Space character exists in the string if (str.find(' ') != -1) // Space character exists in the string
{ {
 End of changes. 8 change blocks. 
15 lines changed or deleted 44 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)