Logo Search packages:      
Sourcecode: d3lphin version File versions  Download package

void Dolphin::compareFiles (  )  [private, slot]

Opens Kompare for 2 selected files.

Definition at line 938 of file dolphin.cpp.

References DolphinView::selectedURLs().

{
    // The method is only invoked if exactly 2 files have
    // been selected. The selected files may be:
    // - both in the primary view
    // - both in the secondary view
    // - one in the primary view and the other in the secondary
    //   view
    assert(m_view[PrimaryIdx] != 0);

    KURL urlA;
    KURL urlB;
    KURL::List urls = m_view[PrimaryIdx]->selectedURLs();

    switch (urls.count()) {
        case 0: {
            assert(m_view[SecondaryIdx] != 0);
            urls = m_view[SecondaryIdx]->selectedURLs();
            assert(urls.count() == 2);
            urlA = urls[0];
            urlB = urls[1];
            break;
        }

        case 1: {
            urlA = urls[0];
            assert(m_view[SecondaryIdx] != 0);
            urls = m_view[SecondaryIdx]->selectedURLs();
            assert(urls.count() == 1);
            urlB = urls[0];
            break;
        }

        case 2: {
            urlA = urls[0];
            urlB = urls[1];
            break;
        }

        default: {
            // may not happen: compareFiles may only get invoked if 2
            // files are selected
            assert(false);
        }
    }

    QString command("kompare -c \"");
    command.append(urlA.prettyURL());
    command.append("\" \"");
    command.append(urlB.prettyURL());
    command.append('\"');
    KRun::runCommand(command, "Kompare", "kompare");

}


Generated by  Doxygen 1.6.0   Back to index