Skip to content

Commit

Permalink
Merge pull request #60 from justin-time/messageSupport
Browse files Browse the repository at this point in the history
Full announcement and email support
  • Loading branch information
Sync-my-L2P authored and Sync-my-L2P committed May 16, 2015
2 parents 854dfed + d921572 commit fb231ea
Show file tree
Hide file tree
Showing 14 changed files with 471 additions and 19 deletions.
9 changes: 6 additions & 3 deletions Sync-my-L2P.pro
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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 @@ -55,7 +56,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 @@ -65,7 +67,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 @@ -954,6 +955,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 @@ -982,16 +994,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 @@ -1000,6 +1029,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

0 comments on commit fb231ea

Please sign in to comment.