~ubuntu-branches/ubuntu/utopic/kdevplatform/utopic-proposed

« back to all changes in this revision

Viewing changes to plugins/projectmanagerview/projecttreeview.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2014-08-30 03:52:11 UTC
  • mfrom: (0.3.26)
  • Revision ID: package-import@ubuntu.com-20140830035211-wndqlc843eu2v8nk
Tags: 1.7.0-0ubuntu1
* New upstream release
* Add XS-Testsuite: autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
    setItemDelegate(new ProjectModelItemDelegate(this));
82
82
 
83
83
    connect( this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(popupContextMenu(QPoint)) );
84
 
    connect( this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotActivated(QModelIndex)) );
 
84
    connect( this, SIGNAL(activated(QModelIndex)), this, SLOT(slotActivated(QModelIndex)) );
85
85
 
86
86
    connect( ICore::self(), SIGNAL(aboutToShutdown()),
87
87
             this, SLOT(aboutToShutdown()));
112
112
 
113
113
QList<ProjectBaseItem*> topLevelItemsWithin(QList<ProjectBaseItem*> items)
114
114
{
115
 
    qSort(items.begin(), items.end(), ProjectBaseItem::urlLessThan);
116
 
    KUrl lastFolder;
 
115
    qSort(items.begin(), items.end(), ProjectBaseItem::pathLessThan);
 
116
    Path lastFolder;
117
117
    for (int i = items.size() - 1; i >= 0; --i)
118
118
    {
119
 
        if (lastFolder.isParentOf(items[i]->url()))
 
119
        if (lastFolder.isParentOf(items[i]->path()))
120
120
            items.removeAt(i);
121
121
        else if (items[i]->folder())
122
 
            lastFolder = items[i]->url();
 
122
            lastFolder = items[i]->path();
123
123
    }
124
124
    return items;
125
125
}
187
187
 
188
188
            QList<ProjectBaseItem*> usefulItems = topLevelItemsWithin(selectionCtxt->items());
189
189
            filterDroppedItems(usefulItems, destItem);
190
 
            QList<KUrl> urls;
 
190
            Path::List paths;
191
191
            foreach (ProjectBaseItem* i, usefulItems) {
192
 
                urls << i->url();
 
192
                paths << i->path();
193
193
            }
194
194
            bool success = false;
195
195
            if (executedAction == copy) {
196
 
                success =~ destItem->project()->projectFileManager()->copyFilesAndFolders(urls, folder);
 
196
                success =~ destItem->project()->projectFileManager()->copyFilesAndFolders(paths, folder);
197
197
            } else if (executedAction == move) {
198
198
                success =~ destItem->project()->projectFileManager()->moveFilesAndFolders(usefulItems, folder);
199
199
            }
204
204
 
205
205
                //and select new items
206
206
                QItemSelection selection;
207
 
                foreach (const KUrl &url, urls) {
208
 
                    KUrl targetUrl = folder->url();
209
 
                    targetUrl.addPath(url.fileName());
 
207
                foreach (const Path &path, paths) {
 
208
                    const Path targetPath(folder->path(), path.lastPathSegment());
210
209
                    foreach (ProjectBaseItem *item, folder->children()) {
211
 
                        if (item->url().equals(targetUrl, KUrl::CompareWithoutTrailingSlash)) {
 
210
                        if (item->path() == targetPath) {
212
211
                            QModelIndex indx = mapFromItem( item );
213
212
                            selection.append(QItemSelectionRange(indx, indx));
214
213
                            setCurrentIndex(indx);
275
274
 
276
275
void ProjectTreeView::slotActivated( const QModelIndex &index )
277
276
{
 
277
    if ( QApplication::keyboardModifiers() & Qt::CTRL || QApplication::keyboardModifiers() & Qt::SHIFT ) {
 
278
        // Do not open file when Ctrl or Shift is pressed; that's for selection
 
279
        return;
 
280
    }
278
281
    KDevelop::ProjectBaseItem *item = index.data(ProjectModel::ProjectItemRole).value<ProjectBaseItem*>();
279
282
    if ( item && item->file() )
280
283
    {
281
 
        emit activateUrl( item->file()->url() );
 
284
        emit activate( item->file()->path() );
282
285
    }
283
286
}
284
287
//TODO test whether this could be replaced by projectbuildsetwidget.cpp::showContextMenu_appendActions
408
411
            m_idx=idx;
409
412
            ProjectFileItem* file=it->file();
410
413
            KDevelop::DUChainReadLocker lock(KDevelop::DUChain::lock());
411
 
            TopDUContext* top= DUChainUtils::standardContextForUrl(file->url());
 
414
            TopDUContext* top= DUChainUtils::standardContextForUrl(file->path().toUrl());
412
415
            
413
416
            if(m_tooltip)
414
417
                m_tooltip->close();