Revision 1794

trunk/client/gui_qt/AutoImport.cpp (revision 1794)
92 92

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

                
96
    /* Remove or move the file if necessary */
97
    QNNTPGrabGlue::ConfigOpts opts = glue->configGetOpts();
98
    if (opts.move_file_after_auto_import) {
99
        /* Create a folder named 'Imported' and move the file there */
100
         QDir d;
101
         QFileInfo info(file);
102
         d.mkdir(info.canonicalPath() + "/Imported");
103
         file.rename(info.canonicalPath() + "/Imported/" + info.fileName());
104
    } else {
105
        /* Remove the file */
106
        file.remove();
107
    }
95 108
}
96 109

                
97 110
void AutoImport::onPluginEvent(QString plugin_name, QString event_name, QList args)
trunk/client/gui_qt/gui_qt.pro (revision 1794)
125 125
    -framework SystemConfiguration \
126 126
    -lz
127 127
mac:CONFIG += debug
128
unix:!mac:!win32*:QT += dbus
trunk/client/gui_qt/mainwindow.cpp (revision 1794)
307 307

                
308 308
void MainWindow::showNotification(QString title, QString msg)
309 309
{
310
#ifdef Q_OS_MAC
311
    /* Due to QTBUG-7638 a tray icon needs to be shown on
312
     * OSX before a Growl notification can be shown */
313
    bool wasVisible = trayIcon.isVisible();
314
    if (!wasVisible) {
315
        trayIcon.show();
316
    }
317
#endif
318

                
310 319
    trayIcon.showMessage(title, msg);
320

                
321
#ifdef Q_OS_MAC
322
    if (!wasVisible) {
323
        trayIcon.hide();
324
    }
325
#endif
311 326
}
312 327

                
313 328
void MainWindow::setShowNotificationOnFileDownloaded(bool enabled)
trunk/client/gui_qt/WidgetConfigAutoImport.cpp (revision 1794)
76 76

                
77 77
    if (glue->getIsStandalone()) {
78 78
        /* Update the local configuration */
79
        ui->chkEnableAutoImportLocal->setChecked(opts.enable_auto_import);
80
        if (opts.enable_auto_import) {
81
            //QModelIndex idx = model->setRootPath(opts.auto_import_directory);
82
            QModelIndex idx = model->index(opts.auto_import_directory);
83
            ui->treeViewAutoImportLocal->scrollTo(idx);
84
            ui->treeViewAutoImportLocal->setCurrentIndex(idx);
79
        if (ui->chkEnableAutoImportLocal->isChecked() != opts.enable_auto_import) {
80
            ui->chkEnableAutoImportLocal->setChecked(opts.enable_auto_import);
81
            if (opts.enable_auto_import) {
82
                //QModelIndex idx = model->setRootPath(opts.auto_import_directory);
83
                QModelIndex idx = model->index(opts.auto_import_directory);
84
                ui->treeViewAutoImportLocal->scrollTo(idx);
85
                ui->treeViewAutoImportLocal->setCurrentIndex(idx);
86
            }
87

                
88
#ifdef Q_OS_MAC
89
            /* Directory monitoring using GLib doesn't work on OSX
90
             * so we use Qt to perform directory monitoring */
91
            if (opts.enable_auto_import) {
92
                auto_import.enableWatch(opts.auto_import_directory);
93
            } else {
94
                auto_import.disableWatch();
95
            }
96
#endif
85 97
        }
86 98
    } else {
87 99
        /* Update the remote configuration */
88
        ui->chkEnableAutoImportServer->setChecked(opts.enable_auto_import);
89
        if (opts.enable_auto_import) {
90
            ui->editAutoImportServer->setText(opts.auto_import_directory);
91
            ui->btnAutoImportServerApply->setEnabled(false);
100
        if (ui->chkEnableAutoImportServer->isChecked() != opts.enable_auto_import) {
101
            ui->chkEnableAutoImportServer->setChecked(opts.enable_auto_import);
102
            if (opts.enable_auto_import) {
103
                ui->editAutoImportServer->setText(opts.auto_import_directory);
104
                ui->btnAutoImportServerApply->setEnabled(false);
105
            }
92 106
        }
93 107
    }
94 108
}

Also available in: Unified diff