[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevplatform
From: Niko Sams <niko.sams () gmail ! com>
Date: 2009-06-29 19:28:15
Message-ID: 1246303695.532355.17576.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 989234 by nsams:
Add FormattingOptions to ProjectController::prettyFileName to get
plain text.
Adapt StackItem to use this method instead of copying the method there.
M +1 -7 debugger/interfaces/stackitem.cpp
M +7 -3 interfaces/iprojectcontroller.h
M +14 -6 shell/projectcontroller.cpp
M +1 -1 shell/projectcontroller.h
--- trunk/KDE/kdevplatform/debugger/interfaces/stackitem.cpp #989233:989234
@@ -38,13 +38,7 @@
{
mId=id;
mLocation=qMakePair(location, line);
-
- KUrl url(location);
- IProject* project = ICore::self()->projectController()->findProjectForUrl(url);
- QString prefixText = url.upUrl().pathOrUrl(KUrl::AddTrailingSlash);
- if(project)
- prefixText = project->name() + "/" + \
project->relativeUrl(url.upUrl()).path(KUrl::AddTrailingSlash);
- QString l = prefixText + url.fileName();
+ QString l = ICore::self()->projectController()->prettyFileName(KUrl(location), \
IProjectController::FormatPlain); setData(QVector<QVariant>() << QString::number(id)
<< name
<< QString(l+':'+QString::number(line)));
--- trunk/KDE/kdevplatform/interfaces/iprojectcontroller.h #989233:989234
@@ -88,13 +88,17 @@
virtual KUrl projectsBaseDirectory() const = 0;
+ enum FormattingOptions {
+ FormatHtml,
+ FormatPlain
+ };
/**
- * Returns a pretty short representation of the given url, considering the \
currently loaded projects,
- * and with some added html highlighting:
+ * Returns a pretty short representation of the given url, considering the \
currently loaded projects:
* When the file is part of a currently loaded project, that projects name is \
shown as prefix instead of the
* the full file path.
+ * @param format formatting used for the string
*/
- Q_SCRIPTABLE virtual QString prettyFileName(KUrl url) const = 0;
+ Q_SCRIPTABLE virtual QString prettyFileName(KUrl url, FormattingOptions format = \
FormatHtml) const = 0;
public Q_SLOTS:
/**
--- trunk/KDE/kdevplatform/shell/projectcontroller.cpp #989233:989234
@@ -794,15 +794,23 @@
KUrl( QDir::homePath()+"/projects" ) );
}
-QString ProjectController::prettyFileName(KUrl url) const
+QString ProjectController::prettyFileName(KUrl url, FormattingOptions format) const
{
IProject* project = Core::self()->projectController()->findProjectForUrl(url);
QString prefixText = url.upUrl().pathOrUrl(KUrl::AddTrailingSlash);
- if(project)
- prefixText = "<i>" + project->name() + "/</i>" + \
project->relativeUrl(url.upUrl()).path(KUrl::AddTrailingSlash);
-
- return prefixText + "<b>" + url.fileName() + "</b>";
-
+ if (project) {
+ if (format == FormatHtml) {
+ prefixText = "<i>" + project->name() + "/</i>";
+ } else {
+ prefixText = project->name() + '/';
+ }
+ prefixText += \
project->relativeUrl(url.upUrl()).path(KUrl::AddTrailingSlash); + }
+ if (format == FormatHtml) {
+ return prefixText + "<b>" + url.fileName() + "</b>";
+ } else {
+ return prefixText + url.fileName();
+ }
}
}
--- trunk/KDE/kdevplatform/shell/projectcontroller.h #989233:989234
@@ -76,7 +76,7 @@
void setDialogProvider(IProjectDialogProvider*);
KUrl projectsBaseDirectory() const;
- QString prettyFileName(KUrl url) const;
+ QString prettyFileName(KUrl url, FormattingOptions format = FormatHtml) const;
public Q_SLOTS:
virtual void openProjectForUrl( const KUrl &sourceUrl );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic