Subversion Repositories Scribus

Rev

Rev 14243 | Rev 18154 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10242 subik 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
15422 craig 7
 
8
#include <QDesktopServices>
10242 subik 9
#include <QPushButton>
15422 craig 10
#include <QUrl>
10242 subik 11
 
12
#include "scfilewidget.h"
13
 
14
 
15422 craig 15
ScFileWidget::ScFileWidget(QWidget * parent) : QFileDialog(parent, Qt::Widget)
10242 subik 16
{
17
        setSizeGripEnabled(false);
18
        setModal(false);
19
        setViewMode(QFileDialog::List);
20
        setWindowFlags(Qt::Widget);
15422 craig 21
 
22
#ifdef Q_OS_MAC
23
        QList<QUrl> urls;
24
        QUrl computer(QUrl::fromLocalFile(QLatin1String("")));
25
        if (!urls.contains(computer))
26
                urls << computer;
27
        QUrl volumes(QUrl::fromLocalFile("/Volumes"));
28
        if (!urls.contains(volumes))
29
                urls << volumes;
30
        //desktop too?  QUrl computer(QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)));
31
        setSidebarUrls(urls);
32
#endif
33
 
10250 fschmid 34
        QList<QPushButton *> b = findChildren<QPushButton *>();
10245 cbradney 35
        QListIterator<QPushButton *> i(b);
36
        while (i.hasNext())
37
                i.next()->setVisible(false);
10242 subik 38
        setMinimumSize(QSize(480, 310));
39
        setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
40
}
41
 
42
QString ScFileWidget::selectedFile()
43
{
44
        QStringList l(selectedFiles());
45
        if (l.count() == 0)
46
                return QString();
47
        return l.at(0);
48
}
14198 fschmid 49
 
50
/* Hack to make the previews in our Fildialogs useable again
51
   needed e.g on OpenSuse patched Qt versions */
52
void ScFileWidget::accept()
53
{
14243 jghali 54
#ifndef Q_WS_X11
55
        QFileDialog::accept();
56
#endif
14198 fschmid 57
}