Revision 1792 trunk/client/gui_qt/AutoImport.cpp

AutoImport.cpp (revision 1792)
3 3

                
4 4
#include "AutoImport.h"
5 5
#include "DialogImportNZB.h"
6
#include "mainwindow.h"
6 7

                
7
AutoImport::AutoImport(QNNTPGrabGlue *glue)
8
AutoImport::AutoImport(MainWindow *mainwindow, QNNTPGrabGlue *glue)
8 9
{
9 10
    this->glue = glue;
11
    this->mainwindow = mainwindow;
10 12

                
13
    connect(glue, SIGNAL(pluginEvent(QString,QString,QList)), SLOT(onPluginEvent(QString,QString,QList)));
14

                
11 15
    connect(&watcher, SIGNAL(directoryChanged(QString)), SLOT(directoryChanged(QString)));
12 16

                
13 17
    connect(&fileReadyTimer, SIGNAL(timeout()), SLOT(fileReadyTimer_timeout()));
... ...
85 89
    d.quickImport(collection_name, QString(contents), false);
86 90

                
87 91
    filesQueued.remove(path);
92

                
93
    QString msg = tr("The file '%1'\nwas successfully imported with the collection name '%2'").arg(path, collection_name);
94
    mainwindow->showNotification(tr("NZB File Imported"), msg);
88 95
}
96

                
97
void AutoImport::onPluginEvent(QString plugin_name, QString event_name, QList args)
98
{
99
    if (plugin_name != "Auto-import" || event_name != "nzb_imported") {
100
        return;
101
    }
102

                
103
    QString msg = tr("The file '%1'\non the NNTPGrab Server was successfully\nimported with the collection name '%2'").arg(args[0], args[1]);
104
    mainwindow->showNotification(tr("NZB File Imported"), msg);
105
}

Also available in: Unified diff