void KPrHtmlExportDialog::browserAction()
{
    KFileDialog dialog(KUrl(), QString("*.zip"), this);
    if (dialog.exec() == QDialog::Accepted) {
        if (verifyZipFile(dialog.selectedFile())) {
            QString name (dialog.selectedUrl().fileName());
            if (name.endsWith(QLatin1String(".zip"), Qt::CaseInsensitive)) {
                name.chop(4);
            }
            ui.kcombobox->addItem(name, dialog.selectedFile());
            ui.kcombobox->setCurrentIndex(ui.kcombobox->count() - 1);
        }
        this->updateFavoriteButton();
    }
}
Exemplo n.º 2
0
// static
KUrl KDirSelectDialog::selectDirectory( const KUrl& startDir,
                                        bool localOnly,
                                        QWidget *parent,
                                        const QString& caption)
{
    KDirSelectDialog myDialog( startDir, localOnly, parent);

    if ( !caption.isNull() )
        myDialog.setCaption( caption );

    if ( myDialog.exec() == QDialog::Accepted )
        return KIO::NetAccess::mostLocalUrl(myDialog.url(),parent);
    else
        return KUrl();
}
Exemplo n.º 3
0
void KonqPixmapProvider::load( KConfigGroup& kc, const QString& key )
{
    iconMap.clear();
    const QStringList list = kc.readPathEntry( key, QStringList() );
    QStringList::const_iterator it = list.begin();
    QStringList::const_iterator itEnd = list.end();
    while ( it != itEnd ) {
        const QString url (*it);
        if ( (++it) == itEnd )
            break;
        const QString icon (*it);
        iconMap.insert( KUrl( url ), icon );
        ++it;
    }
}
bool KCHMViewWindow_KHTMLPart::openPage (const QString& url)
{
	// Set or change the encoding
	if ( m_currentEncoding != ::mainWindow->chmFile()->currentEncoding()
	&& appConfig.m_advAutodetectEncoding )
	{
		m_currentEncoding = ::mainWindow->chmFile()->currentEncoding();
		setEncoding ( m_currentEncoding->qtcodec, TRUE );
	}
	
	QString fullurl = "ms-its:" + ::mainWindow->getOpenedFileName() + "::" + url;
	KHTMLPart::openUrl ( KUrl(fullurl) );
	
	return true;
}
/**
Test MSdpElementBuilder::BuildURLL()
*/
void CT_DataSdpElementBuilder::DoCmdBuildURLL(MSdpElementBuilder& aElementBuilder, const TDesC& aSection)
{
    iDataWrapper.INFO_PRINTF1(_L("MSdpElementBuilder BuildURLL Call"));

    TPtrC 								theString;
    if( iDataWrapper.GetStringFromConfig(aSection, KUrl(), theString) )
    {
        HBufC8*	theString8=HBufC8::NewLC(theString.Length());
        theString8->Des().Copy(theString);
        TPtrC8	stringPtr = theString8->Des();
        TRAPD(err, aElementBuilder.BuildURLL(stringPtr));
        if(err != KErrNone)
        {
            iDataWrapper.ERR_PRINTF2(_L("MSdpElementBuilder BuildURLL failed with error %d"), err);
            iDataWrapper.SetError(err);
        }
        CleanupStack::PopAndDestroy(theString8);
    }
    else
    {
        iDataWrapper.ERR_PRINTF2(_L("Missing parameter %S"), &KUrl());
        iDataWrapper.SetBlockResult(EFail);
    }
}
void KOEventPopupMenu::forward()
{
  KOrg::MainWindow *w = ActionManager::findInstance( KUrl() );
  if ( !w || !mCurrentIncidence ) {
    return;
  }

  KActionCollection *ac = w->getActionCollection();
  QAction *action = ac->action( "schedule_forward" );
  if ( action ) {
    action->trigger();
  } else {
    kError() << "What happened to the schedule_forward action?";
  }
}
Exemplo n.º 7
0
void ImageTransform::run()
{
    kDebug() << "thread started for operation" << mOperation;

    QImage resultImg;
    QMatrix m;

    switch (mOperation)
    {
case ImageTransform::Rotate90:
        emit statusMessage(i18n("Rotate image +90 degrees"));
        m.rotate(+90);
        resultImg = mImage.transformed(m);
        break;

case ImageTransform::MirrorBoth:
case ImageTransform::Rotate180:
        emit statusMessage(i18n("Rotate image 180 degrees"));
        resultImg = mImage.mirrored(true, true);
        break;

case ImageTransform::Rotate270:
        emit statusMessage(i18n("Rotate image -90 degrees"));
        m.rotate(-90);
        resultImg = mImage.transformed(m);
        break;

case ImageTransform::MirrorHorizontal:
        emit statusMessage(i18n("Mirror image horizontally"));
        resultImg = mImage.mirrored(true, false);
        break;


case ImageTransform::MirrorVertical:
        emit statusMessage(i18n("Mirror image vertically"));
        resultImg = mImage.mirrored(false, true);
        break;

default:
        kDebug() << "Unknown operation" << mOperation;
        break;
    }

    if (resultImg.save(mFileName)) emit done(KUrl(mFileName));
    else emit statusMessage(i18n("Error updating image %1", mFileName));

    kDebug() << "thread finished";
}
void KTNEFMain::viewFileAs()
{
  if ( !mView->getSelection().isEmpty() ) {
    KUrl::List list;
    list.append( KUrl( extractTemp( mView->getSelection().first() ) ) );

    if ( !list.isEmpty() ) {
      KRun::displayOpenWithDialog( list, this );
    }
  } else {
    KMessageBox::information(
      this,
      i18nc( "@info",
             "There is no file selected. Please select a file an try again." ) );
  }
}
/**
 * Slot for clicked events generated by the export button of the logger.
 * Writes the content of the logger widget to a file.
 */
void CodeGenStatusPage::loggerExport()
{
    const QString caption = i18n("Umbrello Code Generation - Logger Export");
    QString fileName = KFileDialog::getSaveFileName(KUrl(), QString(), 0, caption);
    if (!fileName.isEmpty()) {
        QFile file(fileName);
        if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
            QTextStream out(&file);
            out << ui_textEditLogger->toHtml();
            file.close();
        }
        else {
            KMessageBox::error(this, i18n("Cannot open file!"), caption);
        }
    }
}
Exemplo n.º 10
0
static bool checkNetworkAccess() {
    if ( s_networkAccess == Unknown ) {
        QTime tm;
        tm.start();
        KIO::Job* job = KIO::get( KUrl( s_iconUrl ), KIO::NoReload, KIO::HideProgressInfo );
        if( KIO::NetAccess::synchronousRun( job, 0 ) ) {
            s_networkAccess = Yes;
            s_downloadTime = tm.elapsed();
	    qDebug( "Network access OK. Download time %d", s_downloadTime );
        } else {
            qWarning( "%s", qPrintable( KIO::NetAccess::lastErrorString() ) );
            s_networkAccess = No;
        }
    }
    return s_networkAccess == Yes;
}
/** First step of three in the download process */
void POTDElement::step1StartDownload()
{
  // Start downloading the picture
  if ( !mFirstStepCompleted && !mFirstStepJob ) {
    KUrl url = KUrl( "http://en.wikipedia.org/w/index.php?title=Template:POTD/" +
                     mDate.toString( Qt::ISODate ) + "&action=raw" );
                // The file at that URL contains the file name for the POTD

    mFirstStepJob = KIO::storedGet( url, KIO::NoReload, KIO::HideProgressInfo );
    KIO::Scheduler::setJobPriority( mFirstStepJob, 1 );

    connect( mFirstStepJob, SIGNAL(result(KJob*)),
             this, SLOT(step1Result(KJob*)) );
    connect( this, SIGNAL(step1Success()),
             this, SLOT(step2GetImagePage()) );
  }
Exemplo n.º 12
0
void CImagePropertiesDialog::set(const QString &file, int width, int height, int pos, bool onWindowBorder)
{
    if(properties&SCALE)
    {
        scaleImage->setChecked(0!=width || 0!=height);
        scaleWidth->setValue(width<MIN_SIZE || width>MAX_SIZE ? DEF_SIZE : width);
        scaleHeight->setValue(height<MIN_SIZE || height>MAX_SIZE ? DEF_SIZE : height);
    }

    if(properties&BORDER)
        onBorder->setChecked(onWindowBorder);
    if(properties&POS)
        posCombo->setCurrentIndex(pos);

    fileRequester->setUrl(QFile::exists(file) && !QFileInfo(file).isDir() ? KUrl(file) : KUrl());
}
void LogView::slotSaveToFile()
{
    QString savePath = KFileDialog::getSaveFileName(KUrl(), "*.txt");

    if (!savePath.isEmpty()) {
        QFile file(savePath);

        if (file.open(QIODevice::WriteOnly)) {
            QTextStream stream(&file);
            stream << toPlainText();
            file.close();
        } else {
            KMessageBox::error(0L, i18n("Unable to open file for writing."));
        }
    }
}
Exemplo n.º 14
0
KUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const
{
    if (m_suggestionsUrlTemplate.isEmpty())
    {
        return KUrl();
    }

    KUrl retVal = KUrl::fromEncoded(parseTemplate(searchTerm, m_suggestionsUrlTemplate).toUtf8());

    QList<Parameter>::const_iterator i;
    for (i = m_suggestionsParameters.constBegin(); i != m_suggestionsParameters.constEnd(); ++i)
    {
        retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
    }
    return retVal;
}
Exemplo n.º 15
0
void Editor::loadBoard()
{
    if (!testSave()) {
        return;
    }

    KUrl url = KFileDialog::getOpenUrl(KUrl(), i18n("*.layout|Board Layout (*.layout)\n*|All File"
        "s"), this, i18n("Open Board Layout"));

    if (url.isEmpty()) {
            return;
    }

    theBoard.loadBoardLayout(url.path());
    update();
}
Exemplo n.º 16
0
	void PropertiesDlg::accept()
	{
		if (move_on_completion_enabled->isChecked())
		{
			tc->setMoveWhenCompletedDir(move_on_completion_url->url());
		}
		else
		{
			tc->setMoveWhenCompletedDir(KUrl());
		}
		
		tc->setFeatureEnabled(bt::DHT_FEATURE,dht->isChecked());
		tc->setFeatureEnabled(bt::UT_PEX_FEATURE,pex->isChecked());
		tc->setSuperSeeding(superseeding->isChecked());
		QDialog::accept();
	}
Exemplo n.º 17
0
SearchProviderDialog::SearchProviderDialog(SearchProvider *provider, QList<SearchProvider*> &providers, QWidget *parent)
    : KDialog( parent )
    , m_provider(provider)
{
    setModal(true);
    setButtons( Ok | Cancel );

    m_dlg.setupUi(mainWidget());

    m_dlg.leQuery->setMinimumWidth(kapp->fontMetrics().averageCharWidth() * 50);

    connect(m_dlg.leName,      SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leQuery,     SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(shortcutsChanged(QString)));
    connect(m_dlg.pbPaste,     SIGNAL(clicked()),            SLOT(pastePlaceholder()));

    // Data init
    m_providers = providers;
    QStringList charsets = KGlobal::charsets()->availableEncodingNames();
    charsets.prepend(i18nc("@item:inlistbox The default character set", "Default"));
    m_dlg.cbCharset->addItems(charsets);
    if (m_provider)
    {
        setPlainCaption(i18n("Modify Web Shortcut"));
        m_dlg.leName->setText(m_provider->name());
        m_dlg.leQuery->setText(m_provider->query());
        m_dlg.leShortcut->setText(m_provider->keys().join(","));
        m_dlg.cbCharset->setCurrentIndex(m_provider->charset().isEmpty() ? 0 : charsets.indexOf(m_provider->charset()));
        m_dlg.leName->setEnabled(false);
        m_dlg.leQuery->setFocus();
    }
    else
    {
        setPlainCaption(i18n("New Web Shortcut"));
        m_dlg.leName->setFocus();

        //If the clipboard contains a url copy it to the query lineedit
        const QClipboard *clipboard = QApplication::clipboard();
        const QString url = clipboard->text();

        if (!KUrl(url).host().isEmpty())
            m_dlg.leQuery->setText(url);

        enableButton(Ok, false);
    }
}
Exemplo n.º 18
0
void KoPAView::importDocument()
{
    KFileDialog *dialog = new KFileDialog( KUrl("kfiledialog:///OpenDialog"),QString(), this );
    dialog->setObjectName( "file dialog" );
    dialog->setMode( KFile::File );
    if ( d->doc->pageType() == KoPageApp::Slide ) {
        dialog->setCaption(i18n("Import Slideshow"));
    }
    else {
        dialog->setCaption(i18n("Import Document"));
    }

    // TODO make it possible to select also other supported types (then the default format) here.
    // this needs to go via the filters to get the file in the correct format.
    // For now we only support the native mime types
    QStringList mimeFilter;
#if 1
    mimeFilter << KoOdf::mimeType( d->doc->documentType() ) << KoOdf::templateMimeType( d->doc->documentType() );
#else
    mimeFilter = KoFilterManager::mimeFilter( KoDocument::readNativeFormatMimeType(d->doc->componentData()), KoFilterManager::Import,
                                              KoDocument::readExtraNativeMimeTypes() );
#endif

    dialog->setMimeFilter( mimeFilter );
    if (dialog->exec() == QDialog::Accepted) {
        KUrl url(dialog->selectedUrl());
        QString tmpFile;
        if ( KIO::NetAccess::download( url, tmpFile, 0 ) ) {
            QFile file( tmpFile );
            file.open( QIODevice::ReadOnly );
            QByteArray ba;
            ba = file.readAll();

            // set the correct mime type as otherwise it does not find the correct tag when loading
            QMimeData data;
            data.setData( KoOdf::mimeType( d->doc->documentType() ), ba);
            KoPAPastePage paste( d->doc,d->activePage );
            if ( ! paste.paste( d->doc->documentType(), &data ) ) {
                KMessageBox::error(0, i18n("Could not import\n%1", url.pathOrUrl()));
            }
        }
        else {
            KMessageBox::error(0, i18n("Could not import\n%1", url.pathOrUrl()));
        }
    }
    delete dialog;
}
Exemplo n.º 19
0
void Connection::processResponse(const QDomDocument &xml)
{
    QString status = xml.documentElement().attribute("status");
    if (status == "running") {
        setState(DebugSession::ActiveState);
    } else if (status == "stopping") {
        setState(DebugSession::StoppingState);
    } else if (status == "stopped") {
        setState(DebugSession::StoppedState);
    } else if (status == "break") {
        setState(DebugSession::PausedState);
        QDomElement el = xml.documentElement().firstChildElement();
        if (el.nodeName() == "xdebug:message") {
            KUrl file = KUrl(el.attribute("filename"));
            int lineNum = el.attribute("lineno").toInt()-1;
            emit currentPositionChanged(file, lineNum);
        }
    }
    if (xml.documentElement().attribute("command") == "feature_get" && xml.documentElement().attribute("feature_name") == "encoding") {
        QTextCodec* c = QTextCodec::codecForName(xml.documentElement().text().toAscii());
        if (c) {
            m_codec = c;
        }
    }

    CallbackBase* callback = 0;
    if (xml.documentElement().hasAttribute("transaction_id")) {
        int transactionId = xml.documentElement().attribute("transaction_id").toInt();
        if (m_callbacks.contains(transactionId)) {
            callback = m_callbacks[transactionId];
            m_callbacks.remove(transactionId);
        }
    }
    if (callback && !callback->allowError()) {
        //if callback doesn't handle errors himself
        QDomElement el = xml.documentElement().firstChildElement();
        if (el.nodeName() == "error") {
            kWarning() << "error" << el.attribute("code") << "for transaction" << xml.documentElement().attribute("transaction_id");
            kDebug() << el.firstChildElement().text();
            Q_ASSERT(false);
        }
    }
    if (callback) {
        callback->execute(xml);
        delete callback;
    }
}
Exemplo n.º 20
0
bool MPForm::addFile(const QString& name,const QString& path)
{
    KMimeType::Ptr ptr = KMimeType::findByUrl(path);
    QString mime       = ptr->name();
    if (mime.isEmpty())
    {
        // if we ourselves can't determine the mime of the local file,
        // very unlikely the remote site will be able to identify it
        return false;
    }

    QFile imageFile(path);
    if (!imageFile.open(QIODevice::ReadOnly))
        return false;

    QByteArray imageData = imageFile.readAll();

    QString str;
    QString file_size = QString("%1").arg(imageFile.size());

    str += "--";
    str += m_boundary;
    str += "\r\n";
    str += "Content-Disposition: form-data; name=\"";
    str += name.toAscii();
    str += "\"; ";
    str += "filename=\"";
    str += QFile::encodeName(KUrl(path).fileName());
    str += "\"\r\n";
    str += "Content-Length: " ;
    str +=  file_size.toAscii();
    str += "\r\n";
    str += "Content-Type: ";
    str +=  mime.toAscii();
    str += "\r\n\r\n";

    imageFile.close();
    m_buffer.append(str.toUtf8());

    int oldSize = m_buffer.size();
    m_buffer.resize(oldSize + imageData.size() + 2);
    memcpy(m_buffer.data() + oldSize, imageData.data(), imageData.size());
    m_buffer[m_buffer.size()-2] = '\r';
    m_buffer[m_buffer.size()-1] = '\n';

    return true;
}
soundkonverter_codec_fluidsynth::soundkonverter_codec_fluidsynth( QObject *parent, const QStringList& args  )
    : CodecPlugin( parent )
{
    Q_UNUSED(args)

    binaries["fluidsynth"] = "";

    allCodecs += "midi";
    allCodecs += "mod";
    allCodecs += "wav";

    KSharedConfig::Ptr conf = KGlobal::config();
    KConfigGroup group;

    group = conf->group( "Plugin-"+name() );
    soundFontFile = group.readEntry( "soundFontFile", KUrl() );
}
void VectorShapeConfigWidget::open(KoShape *shape)
{
    m_shape = dynamic_cast<VectorShape*>(shape);
    Q_ASSERT(m_shape);
    delete m_fileWidget;
    QVBoxLayout *layout = new QVBoxLayout(this);
    m_fileWidget = new KFileWidget(KUrl("kfiledialog:///OpenDialog"), this);
    m_fileWidget->setOperationMode(KFileWidget::Opening);
    const QStringList mimetypes = QStringList()
        << QLatin1String("image/x-wmf")
        << QLatin1String("image/x-emf")
        << QLatin1String("image/x-svm");
    m_fileWidget->setMimeFilter(mimetypes);
    layout->addWidget(m_fileWidget);
    setLayout(layout);
    connect(m_fileWidget, SIGNAL(accepted()), this, SIGNAL(accept()));
}
JabberFileTransfer::JabberFileTransfer ( JabberAccount *account, JabberBaseContact *contact, const QString &file )
{
	kDebug(JABBER_DEBUG_GLOBAL) << "New outgoing transfer for " << contact->contactId() << ": " << file;

	mAccount = account;
	mContact = contact;
	mLocalFile.setFileName ( file );
	bool canOpen=mLocalFile.open ( QIODevice::ReadOnly );
	
	mKopeteTransfer = Kopete::TransferManager::transferManager()->addTransfer ( contact,
																			  mLocalFile.fileName (),
																			  mLocalFile.size (),
																			  contact->contactId (),
																			  Kopete::FileTransferInfo::Outgoing );


	connect ( mKopeteTransfer, SIGNAL (result(KJob*)), this, SLOT (slotTransferResult()) );

	mXMPPTransfer = mAccount->client()->fileTransferManager()->createTransfer ();

	initializeVariables ();

	connect ( mXMPPTransfer, SIGNAL (connected()), this, SLOT (slotOutgoingConnected()) );
	connect ( mXMPPTransfer, SIGNAL (bytesWritten(qint64)), this, SLOT (slotOutgoingBytesWritten(qint64)) );
	connect ( mXMPPTransfer, SIGNAL (error(int)), this, SLOT (slotTransferError(int)) );
	
	FTThumbnail preview;
	QImage img=QImage(mLocalFile.fileName());
	if(!img.isNull())
	{
		img=img.scaled(64,64,Qt::KeepAspectRatio);
		QByteArray ba;
		QBuffer buffer(&ba);
		buffer.open(QIODevice::WriteOnly);
		img.save(&buffer, "PNG"); // writes image into ba in PNG format
		preview= FTThumbnail(ba,QString("image/png"),img.width(),img.height());
	}

	  
	if(canOpen) {
		mXMPPTransfer->sendFile ( XMPP::Jid ( contact->fullAddress () ), KUrl(file).fileName (), mLocalFile.size (), "", preview);
	} else {
		mKopeteTransfer->slotError ( KIO::ERR_CANNOT_OPEN_FOR_READING, file );
	}

}
Exemplo n.º 24
0
    void GUI::paste()
    {
        if (!paste_action->isEnabled())
            return;

        QClipboard* cb = QApplication::clipboard();
        QString text = cb->text(QClipboard::Clipboard);
        if (text.length() == 0)
            return;

        KUrl url = KUrl(text);

        if (url.isValid())
            load(url);
        else
            KMessageBox::error(this, i18n("Invalid URL: %1", url.prettyUrl()));
    }
Exemplo n.º 25
0
void AmpacheListEngine::sendHandshake(const QString server, const QString username, const QString key)
{
    QString timestamp = QString::number(QDateTime::currentDateTime().toTime_t());
    QString passPhrase = Utilities::sha256Of(timestamp + key);
    QString serverUrlStr = QString("%1/server/xml.server.php?action=handshake&auth=%2&timestamp=%3&version=350001&user=%4")
                                  .arg(server)
                                  .arg(passPhrase)
                                  .arg(timestamp)
                                  .arg(username);
    KUrl serverUrl(serverUrlStr);
    if (!serverUrl.isEmpty()) {
        QString targetFile = QString("bangarang/temp/%1").arg(QString("ampacheResult"));
        KUrl targetUrl = KUrl(KStandardDirs::locateLocal("data", targetFile, true));
        connectDownloader();
        emit download(serverUrl, targetUrl);
    }
}
Exemplo n.º 26
0
void KMimeTypeTest::testHelperProtocols()
{
    QVERIFY(KProtocolInfo::isKnownProtocol("mailto"));
    QVERIFY(KProtocolInfo::isHelperProtocol("mailto"));
    QVERIFY(KProtocolInfo::isHelperProtocol(KUrl("mailto:[email protected]")));
    QCOMPARE(KProtocolInfo::exec("mailto"), QString::fromLatin1("kmailservice %u"));
    QVERIFY(!KProtocolInfo::isHelperProtocol("http"));
    QVERIFY(!KProtocolInfo::isHelperProtocol("ftp"));
    QVERIFY(!KProtocolInfo::isHelperProtocol("file"));
    QVERIFY(!KProtocolInfo::isHelperProtocol("unknown"));
    QVERIFY(KProtocolInfo::isHelperProtocol("telnet"));

    // To test that compat still works
    if (KProtocolInfo::isKnownProtocol("tel")) {
        QVERIFY(KProtocolInfo::isHelperProtocol("tel"));
    }
}
Exemplo n.º 27
0
void ImageWindow::applyButtonPressed()
{
 	QString template_path;
	template_path =	KStandardDirs::locate( "data" , "deckreator/custom-deck.svg");

/*        QFile file(template_path);
           if (!file.open(QIODevice::ReadOnly)){
	       KMessageBox::error(this, QString("Could not open file custom-deck.svg.  Looked in ") + template_path, "ERROR");
               return;
	   }
 */      
//	KIO::Job * job = KIO::get(KUrl(template_path));
	qDebug() << "Template Path: " << template_path;
	KIO::Job * job = KIO::open(KUrl(template_path), QIODevice::ReadOnly);
	connect(job, SIGNAL( open(KIO::Job *)), this, SLOT(slotOpen(KIO::Job*)));
	connect(job, SIGNAL( result(KJob*)), this, SLOT(slotResult(KJob*)));
}
void CppHelperPluginConfigPage::importSanitizeRules()
{
    const auto& export_to = KFileDialog::getOpenFileName(
        KUrl()
      , QString()
      , this
      , i18nc("@title:window", "Import completion sanitizer rules from...")
      );
    auto cfg = KSharedConfig::openConfig(export_to, KConfig::SimpleConfig);
    KConfigGroup the_only_group(cfg, SANITIZER_RULES_GROUP_NAME);
    m_plugin->config().readSanitizeRulesFrom(
        the_only_group
      , !m_completion_settings->appendOnImport->isChecked()
      );
    // Refresh view after import
    pullSanitizeRules();
}
void KTNEFMain::viewDragRequested( const QList<KTNEFAttach *>& list )
{
  KUrl::List urlList;
  QList<KTNEFAttach *>::ConstIterator end( list.constEnd() );
  for ( QList<KTNEFAttach *>::ConstIterator it = list.constBegin();
        it != end; ++it ) {
    urlList << KUrl( extractTemp( *it ) );
  }

  if ( !list.isEmpty() ) {
    QMimeData *mimeData = new QMimeData;
    urlList.populateMimeData( mimeData );

    QDrag *drag = new QDrag( this );
    drag->setMimeData( mimeData );
  }
}
Exemplo n.º 30
0
// Triggered when a word is clicked
void Thesaurus::slotFindTerm(const QString &term, bool addToHistory)
{
    // slotSetReplaceTerm(term);
    if (term.startsWith("http://")) {
        (void) new KRun(KUrl(term),0L);
    }
    else {
        if (addToHistory && m_edit->itemText(0) != term) {
            m_edit->insertItem(0, term);
            m_historyPos = m_edit->count();
            m_edit->setCurrentIndex(0);
        }
        updateNavButtons();
        findTermThesaurus(term);
        findTermWordnet(term);
    }
}