summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2012-03-19 16:12:51 +0100
committerThomas Hartmann <Thomas.Hartmann@nokia.com>2012-03-26 16:20:46 +0200
commitbbd5d2ddfe688303574c9bf760e89b9490f3efb5 (patch)
treec92115cebd5d9e5c0822c35ff0657888d71ef0ea /src/plugins/texteditor
parentd86b2abc0bc71f8748356c1a0eb7eb7c60226873 (diff)
downloadqt-creator-bbd5d2ddfe688303574c9bf760e89b9490f3efb5.tar.gz
Wizards: allow forcing of first letter to be a capital letter
This adds a flags that enforces capitalization of filenames. Change-Id: Ie6660f1985a2e96fd68549c5ced1b37c33f064cc Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r--src/plugins/texteditor/texteditorplugin.cpp55
1 files changed, 2 insertions, 53 deletions
diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp
index fa3a3a70cc..d10a75d65f 100644
--- a/src/plugins/texteditor/texteditorplugin.cpp
+++ b/src/plugins/texteditor/texteditorplugin.cpp
@@ -65,8 +65,6 @@
#include <QtPlugin>
#include <QMainWindow>
#include <QShortcut>
-#include <QDir>
-#include <QTemporaryFile>
using namespace TextEditor;
using namespace TextEditor::Internal;
@@ -100,54 +98,6 @@ TextEditorPlugin *TextEditorPlugin::instance()
return m_instance;
}
-static const char wizardCategoryC[] = "U.General";
-
-static inline QString wizardDisplayCategory()
-{
- return TextEditorPlugin::tr("General");
-}
-
-// A wizard that quickly creates a scratch buffer
-// based on a temporary file without prompting for a path.
-class ScratchFileWizard : public Core::IWizard
-{
-public:
- virtual WizardKind kind() const { return FileWizard; }
- virtual QIcon icon() const { return QIcon(); }
- virtual QString description() const
- { return TextEditorPlugin::tr("Creates a scratch buffer using a temporary file."); }
- virtual QString displayName() const
- { return TextEditorPlugin::tr("Scratch Buffer"); }
- virtual QString id() const
- { return QLatin1String("Z.ScratchFile"); }
- virtual QString category() const
- { return QLatin1String(wizardCategoryC); }
- virtual QString displayCategory() const
- { return wizardDisplayCategory(); }
- virtual QString descriptionImage() const
- { return QString(); }
- virtual Core::FeatureSet requiredFeatures() const
- { return Core::FeatureSet(); }
- virtual WizardFlags flags() const
- { return Core::IWizard::PlatformIndependent; }
-
- virtual void runWizard(const QString &path, QWidget *parent, const QString &platform);
-};
-
-void ScratchFileWizard::runWizard(const QString &, QWidget *, const QString &)
-{
- QString tempPattern = QDir::tempPath();
- if (!tempPattern.endsWith(QLatin1Char('/')))
- tempPattern += QLatin1Char('/');
- tempPattern += QLatin1String("scratchXXXXXX.txt");
- QTemporaryFile file(tempPattern);
- file.setAutoRemove(false);
- QTC_ASSERT(file.open(), return; );
- file.close();
- Core::EditorManager *em = Core::EditorManager::instance();
- em->openEditor(file.fileName(), Core::Id(), Core::EditorManager::ModeSwitch);
-}
-
// ExtensionSystem::PluginInterface
bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
@@ -160,15 +110,14 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
wizardParameters.setDescription(tr("Creates a text file. The default file extension is <tt>.txt</tt>. "
"You can specify a different extension as part of the filename."));
wizardParameters.setDisplayName(tr("Text File"));
- wizardParameters.setCategory(QLatin1String(wizardCategoryC));
- wizardParameters.setDisplayCategory(wizardDisplayCategory());
+ wizardParameters.setCategory(QLatin1String("U.General"));
+ wizardParameters.setDisplayCategory(tr("General"));
wizardParameters.setFlags(Core::IWizard::PlatformIndependent);
TextFileWizard *wizard = new TextFileWizard(QLatin1String(Constants::C_TEXTEDITOR_MIMETYPE_TEXT),
QLatin1String("text$"),
wizardParameters);
// Add text file wizard
addAutoReleasedObject(wizard);
- addAutoReleasedObject(new ScratchFileWizard);
m_settings = new TextEditorSettings(this);