Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full announcement and email support #60

Merged
merged 7 commits into from
May 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Sync-my-L2P.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ SOURCES += main.cpp\
qslog/QsLogDestFile.cpp \
qslog/QsLogDestFunctor.cpp \
logger.cpp \
info.cpp
info.cpp \
message.cpp

HEADERS += mymainwindow.h \
parser.h \
Expand All @@ -54,7 +55,8 @@ HEADERS += mymainwindow.h \
qslog/QsLogDisableForThisFile.h \
qslog/QsLogLevel.h \
logger.h \
info.h
info.h \
message.h

FORMS += mymainwindow.ui \
mymainwindow.ui \
Expand All @@ -64,7 +66,8 @@ FORMS += mymainwindow.ui \
autoclosedialog.ui \
logindialog.ui \
logger.ui \
info.ui
info.ui \
message.ui

OTHER_FILES += \
Sync-my-L2P.icns \
Expand Down
57 changes: 56 additions & 1 deletion browser.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "browser.h"
#include "ui_browser.h"
#include "message.h"

#include "options.h"

Expand Down Expand Up @@ -950,6 +951,17 @@ void Browser::on_dataTreeView_doubleClicked(const QModelIndex &index)

QDesktopServices::openUrl(QUrl(fileUrl));
}
else if (item->type() == messageItem)
{
// Erzeugt das Popup-Fester mit der anzuzeigenden Nachricht
message messages;

messages.updateSubject(item->data(topicRole).toString());
messages.updateMessage(item->data(bodyRole).toString().toUtf8());
messages.updateAuthor(item->data(authorRole).toString());
messages.updateDate(item->data(dateRole).toDateTime().toString("ddd dd.MM.yyyy hh:mm"));
messages.exec();
}
}

void Browser::on_dataTreeView_customContextMenuRequested(const QPoint &pos)
Expand Down Expand Up @@ -978,16 +990,33 @@ void Browser::on_dataTreeView_customContextMenuRequested(const QPoint &pos)
}

// Öffnen des Elements lokal oder im L2P
if (RightClickedItem->type() != messageItem)
{
newCustomContextMenu.addAction(tr("Öffnen"), this, SLOT(openFile()));

}
// Kopieren der URL
if(RightClickedItem->type() == courseItem || RightClickedItem->type() == fileItem)
{
newCustomContextMenu.addAction(tr("Link kopieren"), this, SLOT(copyUrlToClipboardSlot()));
}

// Öffnen der Nachricht
if(RightClickedItem->type()== messageItem)
{
newCustomContextMenu.addAction(tr("Nachricht anzeigen"), this, SLOT(openMessage()));

}

// Öffnen der Nachricht im Quelltext
if(RightClickedItem->type()== messageItem)
{
newCustomContextMenu.addAction(tr("Nachricht im Quelltext anzeigen"), this, SLOT(openSourceMessage()));

}

// Anzeigen des Menus an der Mausposition
newCustomContextMenu.exec(ui->dataTreeView->mapToGlobal(pos));

}

void Browser::openCourse()
Expand All @@ -996,6 +1025,32 @@ void Browser::openCourse()
QDesktopServices::openUrl(lastRightClickItem->data(urlRole).toUrl());
}

void Browser::openMessage()
{
// Erzeugt das Popup-Fester mit der anzuzeigenden Nachricht
message messages;

messages.updateSubject(lastRightClickItem->data(topicRole).toString());
messages.updateMessage(lastRightClickItem->data(bodyRole).toString().toUtf8());
messages.updateAuthor(lastRightClickItem->data(authorRole).toString());
messages.updateDate(lastRightClickItem->data(dateRole).toDateTime().toString("ddd dd.MM.yyyy hh:mm"));

messages.exec();
}

void Browser::openSourceMessage()
{
// Erzeugt das Popup-Fester mit der anzuzeigenden Nachricht
message messages;

messages.updateSubject(lastRightClickItem->data(topicRole).toString());
messages.updateMessage(lastRightClickItem->data(bodyRole).toString().toHtmlEscaped());
messages.updateAuthor(lastRightClickItem->data(authorRole).toString());
messages.updateDate(lastRightClickItem->data(dateRole).toDateTime().toString("ddd dd.MM.yyyy hh:mm"));

messages.exec();
}

void Browser::openFile()
{
QString baseUrl = "https://www3.elearning.rwth-aachen.de";
Expand Down
2 changes: 2 additions & 0 deletions browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public slots:

private slots:
void openFile();
void openMessage();
void openSourceMessage();
void openCourse();
void coursesRecieved(QNetworkReply*);
void filesRecieved(QNetworkReply*);
Expand Down
1 change: 1 addition & 0 deletions icons/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
<file>audio.png</file>
<file>picture.png</file>
<file>archive.png</file>
<file>mail.png</file>
</qresource>
</RCC>
Binary file added icons/mail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion info.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <QDialog>


namespace Ui {
class Info;
}
Expand Down
36 changes: 36 additions & 0 deletions message.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "message.h"
#include "ui_message.h"

message::message(QWidget *parent) :
QDialog(parent),
ui(new Ui::message)
{
ui->setupUi(this);
ui->retranslateUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
}

void message::updateAuthor(QString author)
{
ui->author_label->setText(author);
}

void message::updateSubject(QString subject)
{
ui->subject_label->setText(subject);
}

void message::updateDate(QString date)
{
ui->dates_label->setText(date);
}

void message::updateMessage(QString body)
{
ui->message_body->setText(body);
}

message::~message()
{
delete ui;
}
30 changes: 30 additions & 0 deletions message.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef MESSAGE_H
#define MESSAGE_H

#include <QDialog>

namespace Ui {
class message;
}

class message : public QDialog
{
Q_OBJECT

public:
explicit message(QWidget *parent = 0);
~message();

private:
Ui::message *ui;

public slots:
void updateSubject(QString subject);
void updateDate(QString date);
void updateMessage(QString body);
void updateAuthor(QString author);


};

#endif // MESSAGE_H
Loading