Skip to content

Commit

Permalink
Modify Assignments, Email and Announcment parser
Browse files Browse the repository at this point in the history
The parser finds now more than one attachment or assignments.
  • Loading branch information
Stefan Ahlers committed Jan 25, 2015
1 parent 56fec79 commit 2e84915
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ void Parser::parseFiles(QNetworkReply *reply, QMap<QNetworkReply*, Structureelem
urlParts.removeFirst();
urlParts.removeFirst();
urlParts.removeLast();

}
else if(responseCategory == 1)
{
Expand Down Expand Up @@ -176,6 +175,15 @@ void Parser::parseFiles(QNetworkReply *reply, QMap<QNetworkReply*, Structureelem
urlParts.removeFirst();
urlParts.removeFirst();
urlParts.removeLast();

Structureelement *dir = Utils::getDirectoryItem(currentCourse, urlParts);

Structureelement* newFile = new Structureelement(filename, QUrl(url), timestamp, filesize,
currentCourse->data(cidRole).toString(),
fileItem);

// Element hinzufügen
dir->appendRow(newFile);
}
}
else if(responseCategory == 3)
Expand Down Expand Up @@ -222,6 +230,15 @@ void Parser::parseFiles(QNetworkReply *reply, QMap<QNetworkReply*, Structureelem
urlParts.removeLast();
urlParts.removeLast();

Structureelement *dir = Utils::getDirectoryItem(currentCourse, urlParts);

Structureelement* newFile = new Structureelement(filename, QUrl(url), timestamp, filesize,
currentCourse->data(cidRole).toString(),
fileItem);

// Element hinzufügen
dir->appendRow(newFile);

}
}
else {
Expand All @@ -233,13 +250,17 @@ void Parser::parseFiles(QNetworkReply *reply, QMap<QNetworkReply*, Structureelem
QLOG_INFO() << file["name"];
}

Structureelement *dir = Utils::getDirectoryItem(currentCourse, urlParts);
// Wegen der inneren foreach-Schleife in den Kategorien 2,4 und 5 ist diese Übergabe nur noch für die Kategorie 1 und 3
if(responseCategory == 1 || responseCategory == 3){

Structureelement* newFile = new Structureelement(filename, QUrl(url), timestamp, filesize,
Structureelement *dir = Utils::getDirectoryItem(currentCourse, urlParts);

Structureelement* newFile = new Structureelement(filename, QUrl(url), timestamp, filesize,
currentCourse->data(cidRole).toString(),
fileItem);

// Element hinzufügen
dir->appendRow(newFile);
// Element hinzufügen
dir->appendRow(newFile);
}
}
}

0 comments on commit 2e84915

Please sign in to comment.