Exemplo n.º 1
0
void ImageWidget::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu menu;

    if (mType == Photo) {
        if (!mReadOnly) {
            menu.addAction(i18n("Change photo..."), this, SLOT(changeImage()));
            menu.addAction(i18n("Change URL..."), this, SLOT(changeUrl()));
        }

        if (mHasImage) {
            menu.addAction(i18n("Save photo..."), this, SLOT(saveImage()));

            if (!mReadOnly) {
                menu.addAction(i18n("Remove photo"), this, SLOT(deleteImage()));
            }
        }
    } else {
        if (!mReadOnly) {
            menu.addAction(i18n("Change logo..."), this, SLOT(changeImage()));
            menu.addAction(i18n("Change URL..."), this, SLOT(changeUrl()));
        }

        if (mHasImage) {
            menu.addAction(i18n("Save logo..."), this, SLOT(saveImage()));

            if (!mReadOnly) {
                menu.addAction(i18n("Remove logo"), this, SLOT(deleteImage()));
            }
        }
    }

    menu.exec(event->globalPos());
}
Exemplo n.º 2
0
void Dialog::buttonMinusWasClicked()
{
    QString qStr = "http://bash.im/quote/" + id.at(currentIndexOfElements).toPlainText().mid(1);
    QUrl url(qStr);
    QNetworkRequest networkRequest(url);
    networkRequest.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
    QNetworkAccessManager *nam = new QNetworkAccessManager(this);
    nam->post(networkRequest, "/sux");
    changeUrl(-1);
}
void StorageServiceNavigationButtons::slotGoForwardClicked()
{
    if (!mForwardUrls.isEmpty()) {
        InformationUrl url = mForwardUrls.takeFirst();
        qCDebug(STORAGESERVICEMANAGER_LOG) << " forward clicked" << url;
        Q_EMIT changeUrl(url);
        mBackUrls.prepend(url);
        updateButtons();
    }
}
Exemplo n.º 4
0
void MysqlConnection::doSwitchDatabase(const QString& database)
{
	QSqlQuery q(m_db);
	if(q.exec("USE " + database)) {
		QUrl newurl = url();
		newurl.setPath(database);
		changeUrl(newurl);
		doGetDbList();
		doGetDbStructure();
	}
}
Exemplo n.º 5
0
void HttpWindow::downloadFile()
{

    statusLabel->setText("Waiting for download pic ...");
    statusLabel->show();
    changeUrl(bing_url);
    urlLineEdit->setText(bing_url);

    url = urlLineEdit->text();
    QFile::remove(index_filename);



    QFileInfo fileInfo(url.path());
    QString fileName = fileInfo.fileName();
    if (fileName.isEmpty())
        fileName = "D:/index.html";
    else
        fileName = "D:/bing.jpg";

    if (QFile::exists(fileName)) {
        if (QMessageBox::question(this, tr("HTTP"),
                                  tr("There already exists a file called %1 in "
                                     "the current directory. Overwrite?").arg(fileName),
                                  QMessageBox::Yes|QMessageBox::No, QMessageBox::No)
            == QMessageBox::No)
            return;
        QFile::remove(fileName);
    }

    file = new QFile(fileName);
    if (!file->open(QIODevice::WriteOnly)) {
        QMessageBox::information(this, tr("HTTP"),
                                 tr("Unable to save the file %1: %2.")
                                 .arg(fileName).arg(file->errorString()));
        delete file;
        file = 0;
        return;
    }

#ifndef Q_WS_MAEMO_5
    progressDialog->setWindowTitle(tr("HTTP"));
    progressDialog->setLabelText(tr("Downloading %1.").arg(fileName));
#endif
    downloadButton->setEnabled(false);

    // schedule the request
    httpRequestAborted = false;
    startRequest(url);
}
Exemplo n.º 6
0
void KSnapshotObject::autoincFilename()
{
    // Extract the filename from the path
    QFileInfo info(file_path_);

    QString name= info.fileName();

    // If the name contains a number then increment it
    QRegExp numSearch( "(^|[^\\d])(\\d+)" ); // we want to match as far left as possible, and when the number is at the start of the name

    // Does it have a number?
    int start = numSearch.lastIndexIn( name );
    if (start != -1) {
        // It has a number, increment it
        start = numSearch.pos( 2 ); // we are only interested in the second group
        QString numAsStr = numSearch.capturedTexts()[ 2 ];
        QString number = QString::number( numAsStr.toInt() + 1 );
        number = number.rightJustified( numAsStr.length(), '0' );
        name.replace( start, numAsStr.length(), number );
    }
    else {
        // no number
        start = name.lastIndexOf('.');
        if (start != -1) {
            // has a . somewhere, e.g. it has an extension
            name.insert(start, '1');
        }
        else {
            // no extension, just tack it on to the end
            name += '1';
        }
    }

    //Rebuild the path
    QString newUrl = info.absolutePath() + '/' + name;
    changeUrl( newUrl );
}
Exemplo n.º 7
0
void KSnapshot::setURL( const QString &url )
{
    changeUrl( url );
}
Exemplo n.º 8
0
int webPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: loading((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 1: isLoading((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 2: titleChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: pageChanged((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 4: showSources((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 5: speedDial(); break;
        case 6: needPrint((*reinterpret_cast< QPrinter*(*)>(_a[1]))); break;
        case 7: openTab((*reinterpret_cast< webPage*(*)>(_a[1]))); break;
        case 8: setFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: startLoading(); break;
        case 10: finishLoading((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: changeTitle((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 12: changeUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 13: goToHome(); break;
        case 14: loadUrl(); break;
        case 15: loadUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 16: loadUrl((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 17: addToBookMark(); break;
        case 18: downloadFile((*reinterpret_cast< const QNetworkRequest(*)>(_a[1]))); break;
        case 19: downloadFile((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
        case 20: loadBookMark(); break;
        case 21: showBookMark(); break;
        case 22: sources(); break;
        case 23: defineHome(); break;
        case 24: findNext(); break;
        case 25: findPrevious(); break;
        case 26: print(); break;
        case 27: createNewPage((*reinterpret_cast< WebView*(*)>(_a[1]))); break;
        case 28: createNewPage(); break;
        case 29: updateIcon(); break;
        case 30: copy(); break;
        case 31: authentification((*reinterpret_cast< QNetworkReply*(*)>(_a[1])),(*reinterpret_cast< QAuthenticator*(*)>(_a[2]))); break;
        case 32: inspectPage(); break;
        case 33: goToDial(); break;
        case 34: updateUrlIcon((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 35: updateBookMark(); break;
        case 36: updateOptions(); break;
        case 37: showBar(); break;
        case 38: showPage(); break;
        case 39: showDial(); break;
        case 40: inCache(); break;
        case 41: showConsole(); break;
        case 42: zoomIn(); break;
        case 43: zoomOut(); break;
        case 44: restoreZoom(); break;
        case 45: savePage(); break;
        case 46: back(); break;
        case 47: forward(); break;
        default: ;
        }
        _id -= 48;
    }
    return _id;
}