Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 19179 → Rev 19180

/trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
22,10 → 22,39
if (e->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(e);
if (keyEvent->key() == Qt::Key_Escape)
switch (keyEvent->key())
{
emit escapePressed();
return true;
case Qt::Key_Escape:
emit escapePressed();
return true;
case Qt::Key_D:
if (keyEvent->modifiers() & Qt::ControlModifier)
{
emit desktopPressed();
return true;
}
break;
case Qt::Key_H:
if (keyEvent->modifiers() & (Qt::ControlModifier|Qt::ShiftModifier))
{
emit homePressed();
return true;
}
break;
case Qt::Key_Up:
if (keyEvent->modifiers() & Qt::ControlModifier)
{
emit parentPressed();
return true;
}
break;
case Qt::Key_Down:
if (keyEvent->modifiers() & Qt::ControlModifier)
{
emit enterSelectedPressed();
return true;
}
break;
}
}
else
/trunk/Scribus/scribus/ui/filedialogeventcatcher.h
24,6 → 24,10
signals:
void escapePressed();
void dropLocation(QString dl);
void desktopPressed();
void homePressed();
void parentPressed();
void enterSelectedPressed();
};
 
#endif
/trunk/Scribus/scribus/ui/newfile.cpp
23,6 → 23,8
#include <QPushButton>
#include <QSpacerItem>
#include <QSpinBox>
#include <QStandardPaths>
#include <QStringList>
#include <QTabWidget>
#include <QToolTip>
 
385,6 → 387,10
lvi.next()->installEventFilter(keyCatcher);
connect(keyCatcher, SIGNAL(escapePressed()), this, SLOT(reject()));
connect(keyCatcher, SIGNAL(dropLocation(QString)), this, SLOT(locationDropped(QString)));
connect(keyCatcher, SIGNAL(desktopPressed()), this, SLOT(gotoDesktopDirectory()));
connect(keyCatcher, SIGNAL(homePressed()), this, SLOT(gotoHomeDirectory()));
connect(keyCatcher, SIGNAL(parentPressed()), this, SLOT(gotoParentDirectory()));
connect(keyCatcher, SIGNAL(enterSelectedPressed()), this, SLOT(gotoSelectedDirectory()));
connect(fileDialog, SIGNAL(filesSelected(const QStringList &)), this, SLOT(openFile()));
connect(fileDialog, SIGNAL(rejected()), this, SLOT(reject()));
}
704,3 → 710,39
}
}
 
void NewDoc::gotoParentDirectory()
{
QDir d(fileDialog->directory());
d.cdUp();
fileDialog->setDirectory(d);
}
 
 
void NewDoc::gotoSelectedDirectory()
{
QStringList s(fileDialog->selectedFiles());
if (s.count()>0)
{
QFileInfo fi(s.first());
qDebug()<<s.first()<<fi.absoluteFilePath();
if (fi.isDir())
fileDialog->setDirectory(fi.absoluteFilePath());
}
}
 
void NewDoc::gotoDesktopDirectory()
{
QString dp=QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
QFileInfo fi(dp);
if (fi.exists())
fileDialog->setDirectory(dp);
}
 
 
void NewDoc::gotoHomeDirectory()
{
QString dp=QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
QFileInfo fi(dp);
if (fi.exists())
fileDialog->setDirectory(dp);
}
/trunk/Scribus/scribus/ui/newfile.h
146,6 → 146,10
void openFile();
void adjustTitles(int tab);
void locationDropped(QString fileUrl);
void gotoParentDirectory();
void gotoSelectedDirectory();
void gotoDesktopDirectory();
void gotoHomeDirectory();
 
protected:
QVBoxLayout* TabbedNewDocLayout;
/trunk/Scribus/scribus/ui/scfilewidget.cpp
5,9 → 5,11
for which a new license (GPL+exception) is in place.
*/
 
#include <QDesktopServices>
#include <QDebug>
#include <QStandardPaths>
#include <QListView>
#include <QPushButton>
#include <QStringList>
#include <QUrl>
 
#include "filedialogeventcatcher.h"
30,7 → 32,9
QUrl volumes(QUrl::fromLocalFile("/Volumes"));
if (!urls.contains(volumes))
urls << volumes;
//desktop too? QUrl computer(QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)));
QUrl dt(QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)));
if (!urls.contains(dt))
urls << dt;
setSidebarUrls(urls);
#endif
 
41,6 → 45,10
lvi.next()->installEventFilter(keyCatcher);
connect(keyCatcher, SIGNAL(escapePressed()), this, SLOT(reject()));
connect(keyCatcher, SIGNAL(dropLocation(QString)), this, SLOT(locationDropped(QString)));
connect(keyCatcher, SIGNAL(desktopPressed()), this, SLOT(gotoDesktopDirectory()));
connect(keyCatcher, SIGNAL(homePressed()), this, SLOT(gotoHomeDirectory()));
connect(keyCatcher, SIGNAL(parentPressed()), this, SLOT(gotoParentDirectory()));
connect(keyCatcher, SIGNAL(enterSelectedPressed()), this, SLOT(gotoSelectedDirectory()));
 
QList<QPushButton *> b = findChildren<QPushButton *>();
QListIterator<QPushButton *> i(b);
78,3 → 86,39
selectFile(fi.fileName());
}
}
 
void ScFileWidget::gotoParentDirectory()
{
QDir d(directory());
d.cdUp();
setDirectory(d);
}
 
void ScFileWidget::gotoSelectedDirectory()
{
QStringList s(selectedFiles());
if (s.count()>0)
{
QFileInfo fi(s.first());
qDebug()<<s.first()<<fi.absoluteFilePath();
if (fi.isDir())
setDirectory(fi.absoluteFilePath());
}
}
 
void ScFileWidget::gotoDesktopDirectory()
{
QString dp=QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
QFileInfo fi(dp);
if (fi.exists())
setDirectory(dp);
}
 
void ScFileWidget::gotoHomeDirectory()
{
QString dp=QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
QFileInfo fi(dp);
if (fi.exists())
setDirectory(dp);
}
 
/trunk/Scribus/scribus/ui/scfilewidget.h
34,6 → 34,10
public slots:
void accept();
void locationDropped(QString fileUrl);
void gotoParentDirectory();
void gotoSelectedDirectory();
void gotoDesktopDirectory();
void gotoHomeDirectory();
};
 
#endif