MCPcopy Create free account
hub / github.com/KDE/kdiff3 / selectURL

Method selectURL

src/smalldialogs.cpp:142–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void OpenDialog::selectURL(QComboBox* pLine, bool bDir, qint32 i, bool bSave)
143{
144 QString current = pLine->currentText();
145 QUrl currentUrl;
146
147 if(current.isEmpty() && i > 3)
148 {
149 current = dialogUi.lineC->currentText();
150 }
151 if(current.isEmpty())
152 {
153 current = dialogUi.lineB->currentText();
154 }
155 if(current.isEmpty())
156 {
157 current = dialogUi.lineA->currentText();
158 }
159
160 currentUrl = QUrl::fromUserInput(current, QString(), QUrl::AssumeLocalFile);
161 QUrl newURL = bDir ? QFileDialog::getExistingDirectoryUrl(this, i18n("Open Folder"), currentUrl)
162 : bSave ? QFileDialog::getSaveFileUrl(this, i18n("Select Output File"), currentUrl)
163 : QFileDialog::getOpenFileUrl(this, i18n("Open File"), currentUrl);
164 if(!newURL.isEmpty())
165 {
166 /*
167 Since we are selecting a directory open in the parent directory
168 not the one selected.
169 */
170 //QFileDialog::setStartDir( KIO::upUrl( newURL ) );
171 pLine->setEditText(newURL.url());
172 }
173 // newURL won't be modified if nothing was selected.
174}
175
176void OpenDialog::selectFileA() { selectURL(dialogUi.lineA, false, 1, false); }
177void OpenDialog::selectFileB() { selectURL(dialogUi.lineB, false, 2, false); }

Callers

nothing calls this directly

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected