Example #1
0
static QString getEmail2(const KContacts::Addressee &addressee)
{
    // preferred might not be the first one, so remove it and take the first of
    // the remaining instead of always taking the second one
    QStringList emails = addressee.emails();
    emails.removeAll(addressee.preferredEmail());
    if (!emails.isEmpty()) {
        return emails.at( 0 );
    }

    return QString();
}
Example #2
0
void LDesktop::RemoveDeskPlugin(QString ID){
  //This is called after a plugin is manually removed by the user
  //	just need to ensure that the plugin is also removed from the settings file
  QStringList plugs = settings->value(DPREFIX+"pluginlist", QStringList()).toStringList();
  if(plugs.contains(ID)){ 
    plugs.removeAll(ID); 
    issyncing=true; //don't let the change cause a refresh
    settings->setValue(DPREFIX+"pluginlist", plugs);
    settings->sync();
    QTimer::singleShot(200, this, SLOT(UnlockSettings()) );
  }
}
Example #3
0
// -----------------------------------------------------------------------------
static void applyGtkStyles(bool active, int version)
{
   QString gtkkde = KStandardDirs::locateLocal("config", 2==version?"gtkrc-2.0":"gtkrc");
   QByteArray gtkrc = getenv(gtkEnvVar(version));
   QStringList list = QFile::decodeName(gtkrc).split( ':');
   QString userHomeGtkrc = QDir::homePath()+userGtkrc(version);
   if (!list.contains(userHomeGtkrc))
      list.prepend(userHomeGtkrc);
   QLatin1String systemGtkrc = QLatin1String(sysGtkrc(version));
   if (!list.contains(systemGtkrc))
      list.prepend(systemGtkrc);
   list.removeAll("");
   list.removeAll(gtkkde);
   list.append(gtkkde);

   // Pass env. var to kdeinit.
   QString name = gtkEnvVar(version);
   QString value = list.join(":");
   org::kde::KLauncher klauncher(QStringLiteral("org.kde.klauncher5"), QStringLiteral("/KLauncher"), QDBusConnection::sessionBus());
   klauncher.setLaunchEnv(name, value);
}
Example #4
0
void QtSettingsProvider::removeProfile(const std::string& profile) {
    QString profileStart(QString(profile.c_str()) + ":");
    for (auto&& key : settings_.allKeys()) {
        if (key.startsWith(profileStart)) {
            settings_.remove(key);
        }
    }
    QStringList stringList = settings_.value("profileList").toStringList();
    stringList.removeAll(profile.c_str());
    settings_.setValue("profileList", stringList);
    updatePermissions();
}
Example #5
0
void login2::updateRecentOptions()
{
  //if (_cloudOption->isChecked())
  //  return;
  QStringList list = xtsettingsValue("/xTuple/_recentOptionsList").toStringList();
  _recent->setEnabled(list.size());
  list.removeAll(_databaseURL);
  list.prepend(_databaseURL);
      
  xtsettingsSetValue("/xTuple/_recentOptionsList", list);
  xtsettingsSetValue("/xTuple/_databaseURL", _databaseURL);
}
Example #6
0
void CClientExtractor::_scan(const string& dir)
{
	QDir directory(dir);
	if (!directory.exists())
		return;

	const QStringList files = directory.entryList(QStringList("*.res"), QDir::Files);

	for (int i = 0; i < files.size(); i++)
		m_files.append(dir % '/' % files[i]);

	QStringList subDirs = directory.entryList(QDir::Dirs);
	if (subDirs.size() > 0)
	{
		subDirs.removeAll(".");
		subDirs.removeAll("..");

		for (int i = 0; i < subDirs.size(); i++)
			_scan(dir % '/' % subDirs[i]);
	}
}
QStringList PortStruct::extraFiles(){
  QDir dir(basepath);
  QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
  QStringList main = this->mainFiles();
  for(int i=0; i<main.length(); i++){ files.removeAll(main[i]); }
  if(dir.exists("files")){
    dir.cd("files");
    QStringList NF = dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
    for(int i=0; i<NF.length(); i++){ files << "files/"+NF[i]; }
  }
  return files;
}
Example #8
0
static QString getEmail2(const KABC::Addressee &addressee)
{
    // preferred might not be the first one, so remove it and take the first of
    // the remaining instead of always taking the second one
    QStringList emails = addressee.emails();
    emails.removeAll(addressee.preferredEmail());
    if (emails.count() >= 1) {
        return emails[ 0 ];
    }

    return QString();
}
Example #9
0
void Protocol::removeAccount(Account *account, RemoveFlag flags)
{
	Config general = config().group("general");
	QStringList accounts = general.value("accounts",QStringList());
	accounts.removeAll(account->id());
	general.setValue("accounts",accounts);
	general.sync();
	emit accountRemoved(account);

	if (flags & DeleteAccount)
		account->deleteLater();
}
Example #10
0
void GLShaderDev::addRecentFile(const QString& filename)
{
    QSettings settings;
    QStringList   recentFiles = settings.value("recentFiles").toStringList();

    recentFiles.removeAll(filename);
    recentFiles.prepend(filename);
    while (recentFiles.size() > MaxRecentFiles)
        recentFiles.removeLast();
    settings.setValue("recentFiles", recentFiles);
    updateRecentFiles();
}
Example #11
0
QStringList Plugins::getUninstalledPlugins() const
{
    QStringList plugins;

    // Gets all the plugins
    this->_findPlugins(Configurations::c().pluginsPath, "", plugins);
    // Removes the plugins installed
    QStringListIterator it(this->getInstalledPlugins());
    while (it.hasNext())
        plugins.removeAll(it.next());
    return (plugins);
}
Example #12
0
QStringList Plugins::getUnloadedPlugins() const
{
    QStringList plugins;

    // Gets all the installed plugins
    plugins = this->getInstalledPlugins();
    // Removes the plugins loaded
    QStringListIterator it(this->getLoadedPlugins());
    while (it.hasNext())
        plugins.removeAll(it.next());
    return (plugins);
}
Example #13
0
void MainWindow::addToRecentProjects(const QString& fileName)
{
	QSettings settings;
	QStringList files = settings.value("recentProjectList").toStringList();
	files.removeAll(fileName);
	files.prepend(fileName);
	while (files.size() > MAX_RECENT_FILES)
		files.removeLast();
	settings.setValue("recentProjectList", files);

	updateRecentProjectActions();
}
	Media::IPendingAudioSearch* Plugin::Search (const Media::AudioSearchRequest& req)
	{
		auto realReq = req;
		if (realReq.FreeForm_.isEmpty ())
		{
			QStringList parts = { req.Artist_, req.Album_, req.Title_ };
			parts.removeAll (QString ());
			realReq.FreeForm_ = parts.join (" - ");
		}

		return new AudioSearch (Proxy_, realReq, AuthMgr_, Queue_);
	}
void PlayerComponent::setAudioConfiguration()
{
  QStringList ao_defaults;

  QString deviceType = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "devicetype").toString();

  if (SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "exclusive").toBool())
  {
    ao_defaults << "wasapi:exclusive=yes";
    ao_defaults << "coreaudio:exclusive=yes";
  }

  mpv::qt::set_option_variant(m_mpv, "ao-defaults", ao_defaults.join(','));

  // set the audio device
  QVariant device = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "device");
  mpv::qt::set_property_variant(m_mpv, "audio-device", device);

  QString resampleOpts = "";
  bool normalize = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "normalize").toBool();
  resampleOpts += QString(":normalize=") + (normalize ? "yes" : "no");

  // Make downmix more similar to PHT.
  resampleOpts += ":o=[surround_mix_level=1,lfe_mix_level=1]";

  mpv::qt::set_option_variant(m_mpv, "af-defaults", "lavrresample" + resampleOpts);

  QString passthroughCodecs;
  // passthrough doesn't make sense with basic type
  if (deviceType != AUDIO_DEVICE_TYPE_BASIC)
  {
    QStringList enabledCodecs;
    SettingsSection* audioSection = SettingsComponent::Get().getSection(SETTINGS_SECTION_AUDIO);

    QStringList codecs;
    if (deviceType == AUDIO_DEVICE_TYPE_SPDIF)
      codecs = AudioCodecsSPDIF();
    else if (deviceType == AUDIO_DEVICE_TYPE_HDMI && audioSection->value("advanced").toBool())
      codecs = AudioCodecsAll();

    foreach (const QString& key, codecs)
    {
      if (audioSection->value("passthrough." + key).toBool())
        enabledCodecs << key;
    }

    // dts-hd includes dts, but listing dts before dts-hd may disable dts-hd.
    if (enabledCodecs.indexOf("dts-hd") != -1)
      enabledCodecs.removeAll("dts");

    passthroughCodecs = enabledCodecs.join(",");
  }
Example #16
0
void BasicTab::apply()
{
    if (_menuEntryInfo)
    {
        _menuEntryInfo->setDirty();
        _menuEntryInfo->setCaption(_nameEdit->text());
        _menuEntryInfo->setDescription(_descriptionEdit->text());
        _menuEntryInfo->setIcon(_iconButton->icon());

        KDesktopFile *df = _menuEntryInfo->desktopFile();
        KConfigGroup dg = df->desktopGroup();
        dg.writeEntry("Comment", _commentEdit->text());
        if (_systrayCB->isChecked())
          dg.writeEntry("Exec", _execEdit->lineEdit()->text().prepend("ksystraycmd "));
        else
          dg.writeEntry("Exec", _execEdit->lineEdit()->text());

        dg.writePathEntry("Path", _pathEdit->lineEdit()->text());

        if (_terminalCB->isChecked())
            dg.writeEntry("Terminal", 1);
        else
            dg.writeEntry("Terminal", 0);

        dg.writeEntry("TerminalOptions", _termOptEdit->text());
        dg.writeEntry("X-KDE-SubstituteUID", _uidCB->isChecked());
        dg.writeEntry("X-KDE-Username", _uidEdit->text());
        dg.writeEntry("StartupNotify", _launchCB->isChecked());
        dg.writeEntry( "NoDisplay", _hiddenEntryCB->isChecked() );

        QStringList onlyShowIn = df->desktopGroup().readXdgListEntry("OnlyShowIn");
        /* the exact semantics of this checkbox are unclear if there is more than just KDE in the list...
         * For example: - The list is "Gnome;", the user enables "Only show in KDE" - should we remove Gnome?
         *              - The list is "Gnome;KDE;", the user unchecks the box - should we keep Gnome?
         */
        if ( _onlyShowInKdeCB->isChecked() && !onlyShowIn.contains("KDE"))
            onlyShowIn << "KDE";
        else if ( !_onlyShowInKdeCB->isChecked() && onlyShowIn.contains("KDE"))
            onlyShowIn.removeAll("KDE");
        if (onlyShowIn.isEmpty())
            dg.deleteEntry("OnlyShowIn");
        else
            dg.writeXdgListEntry("OnlyShowIn", onlyShowIn);
    }
    else
    {
        _menuFolderInfo->setCaption(_nameEdit->text());
        _menuFolderInfo->setGenericName(_descriptionEdit->text());
        _menuFolderInfo->setComment(_commentEdit->text());
        _menuFolderInfo->setIcon(_iconButton->icon());
    }
}
void CoapNetworkAccessManager::processBlock2Response(CoapReply *reply, const CoapPdu &pdu)
{
    reply->appendPayloadData(pdu.payload());

    // check if this was the last block
    if (!pdu.block().moreFlag()) {
        reply->setMessageType(pdu.messageType());
        reply->setStatusCode(pdu.statusCode());
        reply->setContentType(pdu.contentType());
        reply->setFinished();
        return;
    }

    CoapPdu nextBlockRequest;
    nextBlockRequest.setContentType(reply->request().contentType());
    nextBlockRequest.setMessageType(reply->request().messageType());
    nextBlockRequest.setStatusCode(reply->requestMethod());
    nextBlockRequest.setMessageId(pdu.messageId() + 1);
    nextBlockRequest.setToken(pdu.token());

    // Add the options in correct order
    // Option number 3
    if (reply->m_lockedUp)
        nextBlockRequest.addOption(CoapOption::UriHost, reply->request().url().host().toUtf8());

    // Option number 7
    if (reply->port() != 5683)
        nextBlockRequest.addOption(CoapOption::UriPort, QByteArray::number(reply->request().url().port()));

    QStringList urlTokens = reply->request().url().path().split("/");
    urlTokens.removeAll(QString());

    // Option number 11
    foreach (const QString &token, urlTokens)
        nextBlockRequest.addOption(CoapOption::UriPath, token.toUtf8());

    // Option number 15
    if (reply->request().url().hasQuery())
        nextBlockRequest.addOption(CoapOption::UriQuery, reply->request().url().query().toUtf8());

    // Option number 23
    nextBlockRequest.addOption(CoapOption::Block2, CoapPduBlock::createBlock(pdu.block().blockNumber() + 1, 2, false));

    QByteArray pduData = nextBlockRequest.pack();
    reply->setRequestData(pduData);
    reply->m_timer->start();

    reply->setMessageId(nextBlockRequest.messageId());

    qCDebug(dcCoap) << "--->" << reply->hostAddress() << nextBlockRequest;
    sendData(reply->hostAddress(), reply->port(), pduData);
}
void RecentFiles::setCurrentFile( const QString& file )
{
	QStringList files = loadRecentFiles();
	files.removeAll( file );
	files.prepend( file );

	while ( files.size() > m_actions.size() )
		files.removeLast();

	saveRecentFiles( files );

	updateMenu();
}
Example #19
0
void SysCacheClient::requestFinished(){
  static bool running = false;
  if(running){ return; } //already reading stream
  running = true;
  //qDebug() << "Client Request Finished";
  QTextStream in(this);
  QString line;
  while(!line.endsWith("[FINISHED]")){
    line.append(in.readLine());
    QCoreApplication::processEvents();
  }
  line.remove("[FINISHED]");
  //qDebug() << "Reply:" << line;
  QStringList output = line.split("[INFOSTART]");
    output.removeAll("[/]");
    output.removeAll("");
  //qDebug() << " - In List:" << output;
      ans = output; //save it for later
  running = false;
  //qDebug() << " - Syscache connection closing" << ans;
  this->disconnectFromServer();
}
Example #20
0
	void LocalCollection::AddRootPaths (QStringList paths)
	{
		Q_FOREACH (const auto& path, RootPaths_)
			paths.removeAll (path);
		if (paths.isEmpty ())
			return;

		RootPaths_ << paths;
		emit rootPathsChanged (RootPaths_);

		std::for_each (paths.begin (), paths.end (),
				[this] (decltype (paths.front ()) item) { FilesWatcher_->AddPath (item); });
	}
Example #21
0
void MainWindow::prependToRecentFiles(const QString &fileName)
{
    QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());

    const QStringList oldRecentFiles = readRecentFiles(settings);
    QStringList recentFiles = oldRecentFiles;
    recentFiles.removeAll(fileName);
    recentFiles.prepend(fileName);
    if (oldRecentFiles != recentFiles)
        writeRecentFiles(recentFiles, settings);

    setRecentFilesVisible(!recentFiles.isEmpty());
}
Example #22
0
void login2::updateRecentOptions()
{
  if (_demoOption->isChecked() || _cloudOption->isChecked())
    return;

    
  QStringList list = xtsettingsValue("/xTuple/_recentOptionsList").toStringList();
  list.removeAll(_databaseURL);
  list.prepend(_databaseURL);
      
  xtsettingsSetValue("/xTuple/_recentOptionsList", list);
  xtsettingsSetValue("/xTuple/_databaseURL", _databaseURL);
}
Example #23
0
void MainWindow::update_recent_files_menu(const QString& filepath)
{
    QSettings settings(SettingsOrgString, SettingsRecentFilesEntryString);
    QStringList files = settings.value(SettingsRecentFileListString).toStringList();
    files.removeAll(filepath);
    files.prepend(filepath);

    while (files.size() > MaxRecentlyOpenedFiles)
        files.removeLast();

    settings.setValue(SettingsRecentFileListString, files);
    update_recent_files_menu(files);
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RiuRecentFileActionProvider::addFileName(const QString& fileName)
{
    QSettings settings;
    QStringList files = settings.value("recentFileList").toStringList();
    files.removeAll(fileName);
    files.prepend(fileName);
    while (files.size() > m_maxActionCount)
        files.removeLast();

    settings.setValue("recentFileList", files);

    updateActions();
}
Example #25
0
void OpenDialog::accept()
{
   int maxNofRecentFiles = 10;
   fixCurrentText( m_pLineA );

   QString s = m_pLineA->currentText();
   s = QUrl::fromLocalFile(s).toLocalFile();
   QStringList* sl = &m_pOptions->m_recentAFiles;
   // If an item exist, remove it from the list and reinsert it at the beginning.
   sl->removeAll(s);
   if ( !s.isEmpty() ) sl->prepend( s );
   if (sl->count()>maxNofRecentFiles) sl->erase( sl->begin()+maxNofRecentFiles, sl->end() );

   fixCurrentText( m_pLineB );
   s = m_pLineB->currentText();
   s = QUrl::fromLocalFile(s).toLocalFile();
   sl = &m_pOptions->m_recentBFiles;
   sl->removeAll(s);
   if ( !s.isEmpty() ) sl->prepend( s );
   if (sl->count()>maxNofRecentFiles) sl->erase( sl->begin()+maxNofRecentFiles, sl->end() );

   fixCurrentText( m_pLineC );
   s = m_pLineC->currentText();
   s = QUrl::fromLocalFile(s).toLocalFile();
   sl = &m_pOptions->m_recentCFiles;
   sl->removeAll(s);
   if ( !s.isEmpty() ) sl->prepend( s );
   if (sl->count()>maxNofRecentFiles) sl->erase( sl->begin()+maxNofRecentFiles, sl->end() );

   fixCurrentText( m_pLineOut );
   s = m_pLineOut->currentText();
   s = QUrl::fromLocalFile(s).toLocalFile();
   sl = &m_pOptions->m_recentOutputFiles;
   sl->removeAll(s);
   if ( !s.isEmpty() ) sl->prepend( s );
   if (sl->count()>maxNofRecentFiles) sl->erase( sl->begin()+maxNofRecentFiles, sl->end() );

   QDialog::accept();
}
Example #26
0
void MainWindow::addRecentFile(QString filename)
{
    QSettings settings;
    QStringList files = settings.value("recentFileList").toStringList();
    files.removeAll(filename);
    files.prepend(filename);
    while (files.size() > MAX_RECENT_FILES)
    {
        files.removeLast();
    }
    settings.setValue("recentFileList", files);
    updateRecentFileActions();
}
void CSwordModuleInfo::setHidden(bool hidden)
{
	//qDebug("CSwordModuleInfo::setHidden");
	QStringList hiddenModules = CBTConfig::get(CBTConfig::hiddenModules);
	if (hidden && !hiddenModules.contains(this->name())) {
		hiddenModules.append(this->name());
		CBTConfig::set(CBTConfig::hiddenModules, hiddenModules);
	}
	if (!hidden && hiddenModules.contains(this->name()) ) {
		hiddenModules.removeAll(this->name());
		CBTConfig::set(CBTConfig::hiddenModules, hiddenModules);
	}
}
Example #28
0
QStringList selectDescriptors(const PointLayout& layout,
                              DescriptorType type,
                              const QStringList& select,
                              const QStringList& exclude,
                              bool failOnUnmatched) {

  QStringList selected = layout.descriptorNames(type, select, failOnUnmatched);
  QStringList excluded = layout.descriptorNames(type, exclude, failOnUnmatched);

  // substract one from the other to get final list of desired descriptors
  foreach (QString name, excluded) {
    selected.removeAll(name);
  }
Example #29
0
void SessionManager::removeDependency(Project *project, Project *depProject)
{
    const QString proName = project->projectFilePath();
    const QString depName = depProject->projectFilePath();

    QStringList proDeps = d->m_depMap.value(proName);
    proDeps.removeAll(depName);
    if (proDeps.isEmpty())
        d->m_depMap.remove(proName);
    else
        d->m_depMap[proName] = proDeps;
    emit m_instance->dependencyChanged(project, depProject);
}
Example #30
0
QStringList KACLListView::allowedGroups( bool defaults, KACLListViewItem *allowedItem )
{
    QStringList allowedGroups = m_allGroups;
    QTreeWidgetItemIterator it( this );
    while ( *it ) {
        const KACLListViewItem *item = static_cast<const KACLListViewItem*>( *it );
        ++it;
        if ( item->type != NamedGroup || item->isDefault != defaults ) continue;
        if ( allowedItem && item == allowedItem && allowedItem->isDefault == defaults ) continue;
        allowedGroups.removeAll( item->qualifier );
    }
    return allowedGroups;
}