D4772: projectmanagerview: Make cut-paste work by fixing project manager's Paste action

Milian Wolff noreply at phabricator.kde.org
Sun Mar 19 13:15:09 UTC 2017


mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.


  sorry for the delay Alexander

INLINE COMMENTS

> cutcopypastehelpers.cpp:78
> +    QList<QTreeWidgetItem *> items;
> +    foreach (const TaskInfo& task, tasks) {
> +        int srcCount = task.m_src.size();

add a TODO to create a model for the task list, and use it here instead of using QTreeWidget

> cutcopypastehelpers.cpp:78
> +    QList<QTreeWidgetItem *> items;
> +    foreach (const TaskInfo& task, tasks) {
> +        int srcCount = task.m_src.size();

also here and elsewhere: do not use foreach, use range-based for

> cutcopypastehelpers.cpp:186
> +
> +static void classifyPaths(const Path::List& paths, KDevelop::ProjectModel* projectModel,
> +                          QHash<IProject*, QList<KDevelop::ProjectBaseItem*>>& itemsPerProject,

again return a struct, instead of using out parameters

> cutcopypastehelpers.cpp:226
> +        Path::List pathsList;
> +        foreach (KDevelop::ProjectBaseItem* item, itemsList)
> +            pathsList.append(item->path());

add braces

> cutcopypastehelpers.cpp:337
> +
> +    QPointer<QDialog> guardedDialog = dialog;
> +    guardedDialog->exec();

dialog->setAttribute(Qt::WA_DeleteOnClose);
  dialog->show();

> cutcopypastehelpers.h:59
> +
> +void getSrcDestMapping(const KDevelop::Path::List& paths, const KDevelop::Path& destPath,
> +                       KDevelop::Path::List& filteredPaths,

rename to `mapSourceToDestination`, return a struct with the mapping instead of taking two out-parameters

rename first `paths` argument to sourcePaths, rename `destPath` to `destinationPath`

> cutcopypastehelpers.h:63
> +
> +QVector<TaskInfo> copyMoveItems(const KDevelop::Path::List& paths, KDevelop::ProjectBaseItem* destItem, const bool isCut);
> +

please use an enum instead of a boolean here

> cutcopypastehelpers.h:65
> +
> +void warningPasteFailed(QWidget* parent, const QVector<TaskInfo>& tasks);
> +

rename to `showWarningDialogForFailedPaste`

> projectmanagerviewplugin.cpp:728
> +            if (task.m_status == CutCopyPasteHelpers::TaskStatus::SUCCESS && task.m_type != CutCopyPasteHelpers::TaskType::DELETION) {
> +                foreach (const Path& src, task.m_src)
> +                    finalPathsList.append(finalPaths[src]);

add braces

REPOSITORY
  R33 KDevPlatform

REVISION DETAIL
  https://phabricator.kde.org/D4772

To: aspotashev, kfunk, mwolff
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170319/2a3b7e48/attachment.html>


More information about the KDevelop-devel mailing list