本文整理汇总了C++中CNotify::execLinkError方法的典型用法代码示例。如果您正苦于以下问题:C++ CNotify::execLinkError方法的具体用法?C++ CNotify::execLinkError怎么用?C++ CNotify::execLinkError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNotify
的用法示例。
在下文中一共展示了CNotify::execLinkError方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formatFilesystem
void CFileBrowser::formatFilesystem(void){
QString filename;
struct link_stat st;
int err;
int fmt;
QTreeWidgetItem* item;
CNotify notify;
item = ui->tree->currentItem();
filename = item->text(1);
//check to see if this is a directory or a file
err = link()->stat( item->text(1).toLocal8Bit().constData(),
&st);
if ( err < 0 ){
qDebug("Stat failed");
notify.execLinkError(link_errno);
return;
}
fmt = st.st_mode & LINK_S_IFMT;
switch(fmt){
case LINK_S_IFDIR:
err = link()->format(filename.toLocal8Bit().constData());
break;
default:
qDebug("Unknown file type");
break;
}
if ( err ){
notify.execLinkError(link_errno);
}
this->refresh();
CNotify::updateStatus("Formatted " + filename);
}
示例2: runApp
void CFileBrowser::runApp(void){
struct link_stat st;
int err;
CNotify notify;
QTreeWidgetItem* item;
item = ui->tree->currentItem();
if( item == 0 ){
notify.execError("Invalid Selection");
return;
}
err = link()->stat( item->text(1).toLocal8Bit().constData(),
&st);
if ( err < 0 ){
notify.execLinkError(link_errno);
return;
}
if ( (st.st_mode & LINK_S_IFMT) != LINK_S_IFREG ){
notify.execError("File is not executable");
return;
}
if( st.st_mode & (LINK_S_IXGRP|LINK_S_IXOTH|LINK_S_IXUSR) ){
//Execute a program on the target device
emit runApplication( ui->tree->currentItem()->text(1) );
} else {
notify.execError("File is not executable");
}
}
示例3: saveFileToDeviceSelected
void CFileBrowser::saveFileToDeviceSelected(QStringList filenames){
CNotify notify;
if( copyFilesToDevice(link(), filenames, ui->tree->currentItem()->text(1)) == false ){
notify.execLinkError(link_errno);
} else {
notify.updateStatus("File Saved");
refresh();
}
}
示例4: loadFileFromDeviceSelected
void CFileBrowser::loadFileFromDeviceSelected(QString filename){
QString src, dest;
QStringList path;
int err;
CNotify notify;
src = ui->tree->currentItem()->text(1);
path = src.split('/');
if ( path.count() ){
dest = filename + "/" + path[ path.count() -1 ];
err = link()->copy(src.toStdString(), dest.toStdString(), 0, false, updateProgress);
if ( err < 0 ){
notify.execLinkError(link_errno);
}
} else {
notify.execError("Invalid File");
}
CNotify::updateStatus("Uploaded to: " + dest);
}
示例5: loadDirectory
void CFileBrowser::loadDirectory(QTreeWidgetItem * treeItem){
int dirp;
int err;
QString dName;
QTreeWidgetItem * child;
QString currentDirectory;
struct link_dirent entry;
CNotify notify;
//First read the current directory or root if no directory has been selected
currentDirectory = treeItem->text(1);
qDebug("loadDirectory:%s", currentDirectory.toLocal8Bit().constData());
if ( ( treeItem->text(0) == "." ) ||
( treeItem->text(0) == ".." ) ){
//These are aliases to the current and parent directory and should not expanded
return;
}
//Check to see if the directory has already been loaded
if ( treeItem->text(2) == "false" ){
//mark the directory as having already been loaded
treeItem->setText(2, "true");
qDebug("Opendir %s", currentDirectory.toLocal8Bit().constData());
dirp = link()->opendir(currentDirectory.toLocal8Bit().constData());
qDebug("Open dir:%s at 0x%X", currentDirectory.toLocal8Bit().constData(), dirp );
if( dirp > 0 ){
while( link()->readdir_r(dirp, &entry, NULL) == 0 ){
dName = QString(entry.d_name);
if ( dName != "" ){
if ( (dName != ".") &&
(dName != "..") ){
child = new QTreeWidgetItem();
child->setText(0, dName);
if ( currentDirectory == "/" ){
child->setText(1, currentDirectory + dName);
} else {
child->setText(1, currentDirectory + "/" + dName);
}
child->setText(2, "false"); //Mark the new directory as having not been loaded
if ( ui->showHiddenFilesCheckBox->checkState() == Qt::Checked ){
treeItem->addChild(child);
} else if ( !dName.startsWith(".") ){
treeItem->addChild(child);
}
}
}
}
err = link()->closedir(dirp);
if ( err < 0 ){
notify.execLinkError(link_errno);
}
}
} else {
qDebug("Item %s already loaded", treeItem->text(2).toLocal8Bit().constData());
}
}