Commit 62e35493 authored by Denis Khachko's avatar Denis Khachko

Rescent files

parent c303d9e1
......@@ -44,14 +44,20 @@ void Plugin::rebuildRescentMenu()
QStringList lastFiles= mySettings()->value("Courses/LastFiles","").toString().split(";");
qDebug()<<lastFiles;
if(lastFiles.count()==0)rescentMenu->setEnabled(false);else rescentMenu->setEnabled(true);
bool hasAnyItem=false;
for(int i=0;i<lastFiles.count();i++) {
if(lastFiles[i]=="")continue;
QAction *action = rescentMenu->addAction("&"+QString::number(i+1)+" "+lastFiles[i],MW,SLOT(openRescent()));
if(lastFiles[i].trimmed()=="")continue;
QAction *action = rescentMenu->addAction(QFileInfo(lastFiles[i]).fileName(),MW,SLOT(openRescent()));
action->setProperty("fullName", lastFiles[i]);
hasAnyItem = true;
Q_UNUSED(action);
}
rescentMenu->setEnabled(hasAnyItem);
};
QString Plugin::getText()
{
......
......@@ -354,12 +354,8 @@ void MainWindowTask::openRescent()
QAction *s = qobject_cast<QAction*>(sender());
QString txt = s->text();
txt.remove(0,1);
QStringList words = txt.split(" ");
if(words.count()<2)return;
QString RobotFile=words[1];
loadCourseFromFile(RobotFile);
loadCourseFromFile(s->property ( "fullName" ).toString());
// if( LoadFromFile(RobotFile)!=0)QMessageBox::information( mainWidget(), "", QString::fromUtf8("Ошибка открытия файла! ")+RobotFile, 0,0,0);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment