diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 08d8bc1c11f..fc25a11aa25 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -76,6 +76,7 @@ #include #include #include +#include #include #include @@ -102,10 +103,9 @@ extern "C" void handleSigInt(int sig) using namespace Core; using namespace Core::Internal; -namespace { - enum { debugMainWindow = 0 }; -} +static const char *uriListMimeFormatC = "text/uri-list"; +enum { debugMainWindow = 0 }; MainWindow::MainWindow() : QMainWindow(), @@ -156,15 +156,15 @@ MainWindow::MainWindow() : QCoreApplication::setOrganizationName(QLatin1String("Nokia")); QSettings::setDefaultFormat(QSettings::IniFormat); QString baseName = qApp->style()->objectName(); -#ifdef Q_WS_X11 - if (baseName == "windows") { +#ifdef Q_WS_X11 + if (baseName == QLatin1String("windows")) { // Sometimes we get the standard windows 95 style as a fallback // e.g. if we are running on a KDE4 desktop QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION"); if (desktopEnvironment == "kde") - baseName = "plastique"; + baseName = QLatin1String("plastique"); else - baseName = "cleanlooks"; + baseName = QLatin1String("cleanlooks"); } #endif qApp->setStyle(new ManhattanStyle(baseName)); @@ -201,6 +201,7 @@ MainWindow::MainWindow() : #endif statusBar()->setProperty("p_styled", true); + setAcceptDrops(true); } void MainWindow::setSidebarVisible(bool visible) @@ -360,6 +361,55 @@ void MainWindow::closeEvent(QCloseEvent *event) event->accept(); } +// Check for desktop file manager file drop events + +static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0) +{ + if (files) + files->clear(); + // Extract dropped files from Mime data. + if (!d->hasFormat(QLatin1String(uriListMimeFormatC))) + return false; + const QList urls = d->urls(); + if (urls.empty()) + return false; + // Try to find local files + bool hasFiles = false; + const QList::const_iterator cend = urls.constEnd(); + for (QList::const_iterator it = urls.constBegin(); it != cend; ++it) { + const QString fileName = it->toLocalFile(); + if (!fileName.isEmpty()) { + hasFiles = true; + if (files) { + files->push_back(fileName); + } else { + break; // No result list, sufficient for checking + } + } + } + return hasFiles; +} + +void MainWindow::dragEnterEvent(QDragEnterEvent *event) +{ + if (isDesktopFileManagerDrop(event->mimeData())) { + event->accept(); + } else { + event->ignore(); + } +} + +void MainWindow::dropEvent(QDropEvent *event) +{ + QStringList files; + if (isDesktopFileManagerDrop(event->mimeData(), &files)) { + event->accept(); + openFiles(files); + } else { + event->ignore(); + } +} + IContext *MainWindow::currentContextObject() const { return m_activeContext; diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index c0203a2af37..912c84482fa 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -139,8 +139,10 @@ public slots: void showOptionsDialog(const QString &category = QString(), const QString &page = QString()); protected: - void changeEvent(QEvent *e); - void closeEvent(QCloseEvent *event); + virtual void changeEvent(QEvent *e); + virtual void closeEvent(QCloseEvent *event); + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dropEvent(QDropEvent *event); private slots: void openFile(); diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp index 7cd17e3ddcd..21a25471101 100644 --- a/src/plugins/coreplugin/welcomemode.cpp +++ b/src/plugins/coreplugin/welcomemode.cpp @@ -150,6 +150,7 @@ WelcomeMode::WelcomeMode() : updateWelcomePage(welcomePageData); l->addWidget(m_d->m_webview); + m_d->m_webview->setAcceptDrops(false); #else m_d->m_label->setWordWrap(true); diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp index f9f23d0668f..8330a02065c 100644 --- a/src/plugins/find/findtoolwindow.cpp +++ b/src/plugins/find/findtoolwindow.cpp @@ -104,10 +104,17 @@ void FindToolWindow::setCurrentFilter(int index) QWidget *configWidget = m_configWidgets.at(i); if (!configWidget) continue; - if (i == index) + if (i == index) { m_ui.configWidget->layout()->addWidget(configWidget); - else + bool enabled = m_filters.at(i)->isEnabled(); + m_ui.matchCase->setEnabled(enabled); + m_ui.wholeWords->setEnabled(enabled); + m_ui.searchTerm->setEnabled(enabled); + m_ui.searchButton->setEnabled(enabled); + configWidget->setEnabled(enabled); + } else { configWidget->setParent(0); + } } } diff --git a/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml b/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml index cd600867735..83a3ff27f1c 100644 --- a/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml +++ b/src/plugins/qtscripteditor/QtScriptEditor.mimetypes.xml @@ -6,5 +6,6 @@ Qt Script file + diff --git a/src/plugins/subversion/changenumberdialog.cpp b/src/plugins/subversion/changenumberdialog.cpp deleted file mode 100644 index dad23a7490c..00000000000 --- a/src/plugins/subversion/changenumberdialog.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** -** Non-Open Source Usage -** -** Licensees may use this file in accordance with the Qt Beta Version -** License Agreement, Agreement version 2.2 provided with the Software or, -** alternatively, in accordance with the terms contained in a written -** agreement between you and Nokia. -** -** GNU General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the packaging -** of this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt GPL Exception -** version 1.3, included in the file GPL_EXCEPTION.txt in this package. -** -***************************************************************************/ - -#include - -#include "changenumberdialog.h" - -using namespace Subversion::Internal; - -ChangeNumberDialog::ChangeNumberDialog(QWidget *parent) - : QDialog(parent) -{ - m_ui.setupUi(this); - m_ui.numberLineEdit->setValidator(new QIntValidator(0, 1000000, this)); -} - -int ChangeNumberDialog::number() const -{ - if (m_ui.numberLineEdit->text().isEmpty()) - return -1; - bool ok; - return m_ui.numberLineEdit->text().toInt(&ok); -} diff --git a/src/plugins/subversion/changenumberdialog.h b/src/plugins/subversion/changenumberdialog.h deleted file mode 100644 index 933860e45c2..00000000000 --- a/src/plugins/subversion/changenumberdialog.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** -** Non-Open Source Usage -** -** Licensees may use this file in accordance with the Qt Beta Version -** License Agreement, Agreement version 2.2 provided with the Software or, -** alternatively, in accordance with the terms contained in a written -** agreement between you and Nokia. -** -** GNU General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the packaging -** of this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt GPL Exception -** version 1.3, included in the file GPL_EXCEPTION.txt in this package. -** -***************************************************************************/ - -#ifndef CHANGENUMBERDIALOG_H -#define CHANGENUMBERDIALOG_H - -#include "ui_changenumberdialog.h" - -#include - -namespace Subversion { -namespace Internal { - -class ChangeNumberDialog : public QDialog -{ - Q_OBJECT -public: - ChangeNumberDialog(QWidget *parent = 0); - int number() const; - -private: - Ui::ChangeNumberDialog m_ui; -}; - -} // namespace Subversion -} // namespace Internal - -#endif // CHANGENUMBERDIALOG_H diff --git a/src/plugins/subversion/changenumberdialog.ui b/src/plugins/subversion/changenumberdialog.ui deleted file mode 100644 index ff3e6517508..00000000000 --- a/src/plugins/subversion/changenumberdialog.ui +++ /dev/null @@ -1,79 +0,0 @@ - - Subversion::Internal::ChangeNumberDialog - - - - 0 - 0 - 319 - 76 - - - - Change Number - - - - 9 - - - 6 - - - - - - - - Change Number: - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Subversion::Internal::ChangeNumberDialog - accept() - - - 59 - 24 - - - 160 - 38 - - - - - buttonBox - rejected() - Subversion::Internal::ChangeNumberDialog - reject() - - - 59 - 24 - - - 160 - 38 - - - - - diff --git a/src/plugins/subversion/subversion.pro b/src/plugins/subversion/subversion.pro index 7de5499fa76..993d22eb6a3 100644 --- a/src/plugins/subversion/subversion.pro +++ b/src/plugins/subversion/subversion.pro @@ -14,7 +14,6 @@ HEADERS += annotationhighlighter.h \ subversionoutputwindow.h \ settingspage.h \ subversioneditor.h \ - changenumberdialog.h \ subversionsubmiteditor.h \ subversionsettings.h @@ -24,11 +23,9 @@ SOURCES += annotationhighlighter.cpp \ subversionoutputwindow.cpp \ settingspage.cpp \ subversioneditor.cpp \ - changenumberdialog.cpp \ subversionsubmiteditor.cpp \ subversionsettings.cpp -FORMS += settingspage.ui \ - changenumberdialog.ui +FORMS += settingspage.ui RESOURCES += subversion.qrc diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 115259bc5f6..c5484053d76 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -38,7 +38,6 @@ #include "subversionoutputwindow.h" #include "subversionsubmiteditor.h" -#include "changenumberdialog.h" #include "subversionconstants.h" #include "subversioncontrol.h" @@ -70,6 +69,9 @@ #include #include #include +#include + +#include using namespace Subversion::Internal; @@ -96,6 +98,7 @@ const char * const SubversionPlugin::ANNOTATE_CURRENT = "Subversion.AnnotateCu const char * const SubversionPlugin::SEPARATOR3 = "Subversion.Separator3"; const char * const SubversionPlugin::STATUS = "Subversion.Status"; const char * const SubversionPlugin::UPDATE = "Subversion.Update"; +const char * const SubversionPlugin::DESCRIBE = "Subversion.Describe"; static const VCSBase::VCSBaseEditorParameters editorParameters[] = { { @@ -186,6 +189,7 @@ SubversionPlugin::SubversionPlugin() : m_annotateCurrentAction(0), m_statusAction(0), m_updateProjectAction(0), + m_describeAction(0), m_submitCurrentLogAction(0), m_submitDiffAction(0), m_submitUndoAction(0), @@ -248,6 +252,16 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { Subversion::Constants::SUBVERSIONCOMMITEDITOR }; +static inline Core::Command *createSeparator(QObject *parent, + Core::ActionManager *ami, + const char*id, + const QList &globalcontext) +{ + QAction *tmpaction = new QAction(parent); + tmpaction->setSeparator(true); + return ami->registerAction(tmpaction, id, globalcontext); +} + bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments); @@ -330,10 +344,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); subversionMenu->addAction(command); - QAction *tmpaction = new QAction(this); - tmpaction->setSeparator(true); - subversionMenu->addAction(ami->registerAction(tmpaction, - SubversionPlugin::SEPARATOR0, globalcontext)); + subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR0, globalcontext)); m_diffProjectAction = new QAction(tr("Diff Project"), this); command = ami->registerAction(m_diffProjectAction, SubversionPlugin::DIFF_PROJECT, @@ -349,10 +360,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); subversionMenu->addAction(command); - tmpaction = new QAction(this); - tmpaction->setSeparator(true); - subversionMenu->addAction(ami->registerAction(tmpaction, - SubversionPlugin::SEPARATOR1, globalcontext)); + subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR1, globalcontext)); m_commitAllAction = new QAction(tr("Commit All Files"), this); command = ami->registerAction(m_commitAllAction, SubversionPlugin::COMMIT_ALL, @@ -368,10 +376,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile())); subversionMenu->addAction(command); - tmpaction = new QAction(this); - tmpaction->setSeparator(true); - subversionMenu->addAction(ami->registerAction(tmpaction, - SubversionPlugin::SEPARATOR2, globalcontext)); + subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR2, globalcontext)); m_filelogCurrentAction = new QAction(tr("Filelog Current File"), this); command = ami->registerAction(m_filelogCurrentAction, @@ -389,10 +394,12 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe SLOT(annotateCurrentFile())); subversionMenu->addAction(command); - tmpaction = new QAction(this); - tmpaction->setSeparator(true); - subversionMenu->addAction(ami->registerAction(tmpaction, - SubversionPlugin::SEPARATOR3, globalcontext)); + m_describeAction = new QAction(tr("Describe..."), this); + command = ami->registerAction(m_describeAction, SubversionPlugin::DESCRIBE, globalcontext); + connect(m_describeAction, SIGNAL(triggered()), this, SLOT(slotDescribe())); + subversionMenu->addAction(command); + + subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR3, globalcontext)); m_statusAction = new QAction(tr("Project Status"), this); command = ami->registerAction(m_statusAction, SubversionPlugin::STATUS, @@ -536,7 +543,7 @@ SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QStri void SubversionPlugin::updateActions() { - QString fileName = currentFileName(); + const QString fileName = currentFileName(); const bool hasFile = !fileName.isEmpty(); m_addAction->setEnabled(hasFile); @@ -549,6 +556,7 @@ void SubversionPlugin::updateActions() m_filelogCurrentAction->setEnabled(hasFile); m_annotateCurrentAction->setEnabled(hasFile); m_statusAction->setEnabled(true); + m_describeAction->setEnabled(true); QString baseName; if (hasFile) @@ -856,7 +864,20 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) const int number = changeNr.toInt(&ok); if (!ok || number < 2) return; - QStringList args(QLatin1String("diff")); + // Run log to obtain message (local utf8) + QString description; + QStringList args(QLatin1String("log")); + args.push_back(QLatin1String("-r")); + args.push_back(changeNr); + args.push_back(topLevel); + const SubversionResponse logResponse = runSvn(args, subversionShortTimeOut, false); + if (logResponse.error) + return; + description = logResponse.stdOut; + + // Run diff (encoding via source codec) + args.clear(); + args.push_back(QLatin1String("diff")); args.push_back(QLatin1String("-r")); QString diffArg; QTextStream(&diffArg) << (number - 1) << ':' << number; @@ -867,20 +888,40 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) const SubversionResponse response = runSvn(args, subversionShortTimeOut, false, codec); if (response.error) return; + description += response.stdOut; // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file const QString id = diffArg + source; if (Core::IEditor *editor = locateEditor("describeChange", id)) { - editor->createNew(response.stdOut); - Core::EditorManager::instance()->activateEditor(editor); + editor->createNew(description); + Core::EditorManager::instance()->setCurrentEditor(editor); } else { const QString title = tr("svn describe %1#%2").arg(QFileInfo(source).fileName(), changeNr); - Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::DiffOutput, source, codec); + Core::IEditor *newEditor = showOutputInEditor(title, description, VCSBase::DiffOutput, source, codec); newEditor->setProperty("describeChange", id); } } +void SubversionPlugin::slotDescribe() +{ + const QStringList topLevels = currentProjectsTopLevels(); + if (topLevels.size() != 1) + return; + + QInputDialog inputDialog(Core::ICore::instance()->mainWindow()); + inputDialog.setWindowFlags(inputDialog.windowFlags() & ~Qt::WindowContextHelpButtonHint); + inputDialog.setInputMode(QInputDialog::IntInput); + inputDialog.setIntRange(2, INT_MAX); + inputDialog.setWindowTitle(tr("Describe")); + inputDialog.setLabelText(tr("Revision number:")); + if (inputDialog.exec() != QDialog::Accepted) + return; + + const int revision = inputDialog.intValue(); + describe(topLevels.front(), QString::number(revision)); +} + void SubversionPlugin::submitCurrentLog() { Core::EditorManager::instance()->closeEditors(QList() diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index f589468e40f..fc1c4063a88 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -119,6 +119,7 @@ private slots: void annotateCurrentFile(); void projectStatus(); void describe(const QString &source, const QString &changeNr); + void slotDescribe(); void updateProject(); void submitCurrentLog(); void diffFiles(const QStringList &); @@ -165,6 +166,7 @@ private: QAction *m_annotateCurrentAction; QAction *m_statusAction; QAction *m_updateProjectAction; + QAction *m_describeAction; QAction *m_submitCurrentLogAction; QAction *m_submitDiffAction; @@ -187,6 +189,7 @@ private: static const char * const SEPARATOR3; static const char * const STATUS; static const char * const UPDATE; + static const char * const DESCRIBE; static SubversionPlugin *m_subversionPluginInstance; diff --git a/src/shared/help/helpviewer.cpp b/src/shared/help/helpviewer.cpp index ab95e62b8cd..b22726da610 100644 --- a/src/shared/help/helpviewer.cpp +++ b/src/shared/help/helpviewer.cpp @@ -167,7 +167,7 @@ private: HelpPage::HelpPage(CentralWidget *central, QHelpEngine *engine, QObject *parent) : QWebPage(parent), centralWidget(central), helpEngine(engine) -{ +{ } QWebPage *HelpPage::createWindow(QWebPage::WebWindowType) @@ -215,7 +215,7 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *, HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) : QWebView(parent), helpEngine(engine), parentWidget(parent) -{ +{ setPage(new HelpPage(parent, helpEngine, this)); page()->setNetworkAccessManager(new HelpNetworkAccessManager(engine, this)); @@ -238,6 +238,7 @@ HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this, SIGNAL(highlighted(QString))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); + setAcceptDrops(false); } void HelpViewer::setSource(const QUrl &url) diff --git a/src/shared/qrceditor/qrceditor.pri b/src/shared/qrceditor/qrceditor.pri index 3efd26553f7..47e54c936e1 100644 --- a/src/shared/qrceditor/qrceditor.pri +++ b/src/shared/qrceditor/qrceditor.pri @@ -1,14 +1,7 @@ -QT_BUILD_TREE=$$(QT_BUILD_TREE) -isEmpty(QT_BUILD_TREE):QT_BUILD_TREE=$$(QTDIR) -QT_QRC_BUILD_TREE = $$fromfile($$QT_BUILD_TREE/.qmake.cache,QT_SOURCE_TREE) - -INCLUDEPATH *= $$QT_QRC_BUILD_TREE/tools/designer/src/lib/shared INCLUDEPATH *= $$PWD $$PWD/.. QT *= xml -DEFINES *= QT_NO_SHARED_EXPORT - # Input SOURCES += \ $$PWD/resourcefile.cpp \ @@ -21,7 +14,6 @@ HEADERS += \ $$PWD/resourceview.h \ $$PWD/qrceditor.h \ $$PWD/undocommands_p.h \ - \ $$PWD/../namespace_global.h \ FORMS += $$PWD/qrceditor.ui diff --git a/src/shared/qrceditor/resourcefile_p.h b/src/shared/qrceditor/resourcefile_p.h index 4a7d510dc48..2ec3fe47e4b 100644 --- a/src/shared/qrceditor/resourcefile_p.h +++ b/src/shared/qrceditor/resourcefile_p.h @@ -42,18 +42,10 @@ #include #include -#include "shared_global_p.h" - QT_BEGIN_NAMESPACE namespace qdesigner_internal { -#ifdef BUILD_VSIP -# define RESOURCE_EXPORT -#else -# define RESOURCE_EXPORT QDESIGNER_SHARED_EXPORT -#endif - struct File; struct Prefix; @@ -125,7 +117,7 @@ typedef QList PrefixList; Represents the structure of a Qt Resource File (.qrc) file. */ -class RESOURCE_EXPORT ResourceFile +class ResourceFile { public: ResourceFile(const QString &file_name = QString()); @@ -199,7 +191,7 @@ private: Wraps a \l ResourceFile as a single-column tree model. */ -class RESOURCE_EXPORT ResourceModel : public QAbstractItemModel +class ResourceModel : public QAbstractItemModel { Q_OBJECT