Beispiel #1
0
void SearchCommand::processText( Kate::View *view, const TQString &cmd )
{
  static TQRegExp re_ifind("ifind(?::([bcrs]*))?\\s(.*)");
  if ( re_ifind.search( cmd ) > -1 )
  {
    TQString flags = re_ifind.cap( 1 );
    TQString pattern = re_ifind.cap( 2 );


    // if there is no setup, or the text length is 0, set up the properties
    if ( ! m_ifindFlags || pattern.isEmpty() )
      ifindInit( flags );
    // if there is no fromCursor, add it if this is not the first character
    else if ( ! ( m_ifindFlags & KFindDialog::FromCursor ) && ! pattern.isEmpty() )
      m_ifindFlags |= KFindDialog::FromCursor;

    // search..
    if ( ! pattern.isEmpty() )
    {
      KateView *v = (KateView*)view;

      // If it *looks like* we are continuing, place the cursor
      // at the beginning of the selection, so that the search continues.
      // ### check more carefully, like is  the cursor currently at the end
      // of the selection.
      if ( pattern.startsWith( v->selection() ) &&
           v->selection().length() + 1 == pattern.length() )
        v->setCursorPositionInternal( v->selStartLine(), v->selStartCol() );

      v->find( pattern, m_ifindFlags, false );
    }
  }
}
Beispiel #2
0
void CreateSmileyWindow::slotOKClicked( )
{
	bool ok = false;
	TQString destDir = EvaMain::user->getSetting()->getCustomSmileyDir();
	if(cbbGroup->currentItem()>0)
		destDir += ( "/" + cbbGroup->currentText() );
	if(!m_FileName.isEmpty()){

 		TQString destFile = EvaHelper::generateCustomSmiley(m_FileName, destDir, true);
 		if(!destFile.isEmpty()) {
			TQString name = destFile.right( destFile.length() - destFile.findRev("/") - 1);
			CustomFace face(name, leShortcut->text(), leTip->text(), 0, cbbGroup->currentItem());
			ok = m_Config->addFace(face);
		}
	} else {
		///TODO: add multiple files
		for(TQStringList::Iterator it = m_FileNames.begin(); it != m_FileNames.end(); ++it){
			TQString destFile = EvaHelper::generateCustomSmiley((*it), destDir, true);
			if(!destFile.isEmpty()) {
				TQString name = destFile.right( destFile.length() - destFile.findRev("/") - 1);
				CustomFace face( name, name.left(6), name.left(name.findRev(".")), 0, cbbGroup->currentItem());
				ok = m_Config->addFace(face);
			}
		}
	}

	if(ok) m_Config->saveXML();

	emit addCustomSmileyReady(ok);
	close();
}
Beispiel #3
0
bool ObjKsTheme::loadThemeRc( const TQString& activeTheme, bool force )
{
  //kdDebug() << "ObjKsTheme::loadThemeRc: " << activeTheme << endl;
  TQString prefix("Themes/");
  TQString themeFile;
  TDEConfig *cf = 0L;

  // Try our best to find a theme file.
  themeFile = locate( "appdata", prefix + activeTheme + "/" + TQString("Theme.rc") );
  themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+TQString("Theme.RC")):themeFile;
  themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+TQString("theme.rc")):themeFile;
  themeFile = themeFile.isEmpty() ? locate("appdata",prefix+activeTheme+"/"+activeTheme+TQString(".rc")):themeFile;

  if( !themeFile.isEmpty() )
     cf = new TDEConfig( themeFile );

  if( cf )
  {
    mActiveTheme = activeTheme;
    mThemeDir = prefix + activeTheme+"/";
    if( loadTDEConfig( cf, activeTheme, force ) )
    {
      mThemeConfig = cf;
      return true;
    }
    else
      delete cf;
  }
  return false;
}
bool KLpdUnixPrinterImpl::setupCommand(TQString& cmd, KPrinter *printer)
{
	TQString exe = printer->option( "kde-printcommand" );
	if ( exe.isEmpty() || exe == "<automatic>" )
	{
		exe = executable();
		if (!exe.isEmpty())
		{
			cmd = exe;
			if (exe.right(3) == "lpr")
				initLprPrint(cmd,printer);
			else
				initLpPrint(cmd,printer);
			return true;
		}
		else
			printer->setErrorMessage(i18n("No valid print executable was found in your path. Check your installation."));
		return false;
	}
	else
	{
		TQMap<TQString,TQString> map;
		map.insert( "printer", printer->printerName() );
		map.insert( "copies", TQString::number( printer->numCopies() ) );
		cmd = KMacroExpander::expandMacrosShellQuote( exe, map );
		return true;
	}
}
Beispiel #5
0
//---------------------------------------------------------------------------
void KXSConfigDialog::slotPreviewExited(KProcess *)
{
    if ( mKilled ) {
	mKilled = false;
	mPreviewProc->clearArguments();
	TQString saver;
	saver.sprintf( "%s -window-id 0x%lX", mFilename.latin1(), long(mPreview->winId()) );
	saver += command();
	kdDebug() << "Command: " <<  saver << endl;

	unsigned int i = 0;
	TQString word;
	saver = saver.stripWhiteSpace();
	while ( !saver[i].isSpace() ) word += saver[i++];
	//work around a KStandarDirs::findExe() "feature" where it looks in $KDEDIR/bin first no matter what and sometimes finds the wrong executable
	TQFileInfo checkExe;
	TQString saverdir = TQString("%1/%2").tqarg(XSCREENSAVER_HACKS_DIR).tqarg(word);
	TQString path;
	checkExe.setFile(saverdir);
	if (checkExe.exists() && checkExe.isExecutable() && checkExe.isFile())
	{
		path = saverdir;
	}
	if (!path.isEmpty()) {
	    (*mPreviewProc) << path;

	    bool inQuotes = false;
	    while ( i < saver.length() ) {
		word = "";
		while ( saver[i].isSpace() && i < saver.length() ) i++;
		while ( (!saver[i].isSpace() || inQuotes) && i < saver.length() ) {
		    if ( saver[i] == '\"' ) {
			inQuotes = !inQuotes;
		    } else {
			word += saver[i];
		    }
		    i++;
		}
		if (!word.isEmpty()) {
		    (*mPreviewProc) << word;
		}
	    }

	    mPreviewProc->start();
	}
    } else {
	// stops us from spawning the hack really fast, but still not the best
	TQString path = KStandardDirs::findExe(mFilename, XSCREENSAVER_HACKS_DIR);
	if ( TQFile::exists(path) ) {
	    mKilled = true;
	    slotChanged();
	}
    }
}
Beispiel #6
0
bool check(TQString txt, TQString s, TQString a, TQString b)
{
  if (a.isEmpty())
     a = TQString::null;
  if (b.isEmpty())
     b = TQString::null;
  if (a == b)
    kdDebug() << txt << " (" << s << ") : '" << a << "' - ok" << endl;
  else {
    kdDebug() << txt << " (" << s << ") : got '" << a << "' but expected '" << b << "' - KO!" << endl;
    exit(1);
  }
  return true;
}
Beispiel #7
0
TQString TDECompletion::makeCompletion( const TQString& string )
{
    if ( myCompletionMode == TDEGlobalSettings::CompletionNone )
        return TQString::null;

    //kdDebug(0) << "TDECompletion: completing: " << string << endl;

    d->matches.clear();
    myRotationIndex = 0;
    myHasMultipleMatches = false;
    myLastMatch = myCurrentMatch;

    // in Shell-completion-mode, emit all matches when we get the same
    // complete-string twice
    if ( myCompletionMode == TDEGlobalSettings::CompletionShell &&
         string == myLastString ) {
        // Don't use d->matches since calling postProcessMatches()
        // on d->matches here would interfere with call to
        // postProcessMatch() during rotation
    
        findAllCompletions( string, &d->matches, myHasMultipleMatches );
        TQStringList l = d->matches.list();
        postProcessMatches( &l );
        emit matches( l );

        if ( l.isEmpty() )
            doBeep( NoMatch );
    
        return TQString::null;
    }

    TQString completion;
    // in case-insensitive popup mode, we search all completions at once
    if ( myCompletionMode == TDEGlobalSettings::CompletionPopup ||
         myCompletionMode == TDEGlobalSettings::CompletionPopupAuto ) {
        findAllCompletions( string, &d->matches, myHasMultipleMatches );
        if ( !d->matches.isEmpty() )
            completion = d->matches.first();
    }
    else
        completion = findCompletion( string );

    if ( myHasMultipleMatches )
        emit multipleMatches();

    myLastString = string;
    myCurrentMatch = completion;

    postProcessMatch( &completion );

    if ( !string.isEmpty() ) { // only emit match when string is not empty
        //kdDebug(0) << "TDECompletion: Match: " << completion << endl;
        emit match( completion );
    }

    if ( completion.isNull() )
        doBeep( NoMatch );

    return completion;
}
Beispiel #8
0
void KasAboutDialog::addGPLPage()
{
   TQVBox *gplPage = addVBoxPage( i18n("GPL License"), TQString::null, Icon( "filefind" ) );

   new TQLabel( i18n( "Kasbar may be used under the terms of either the BSD license, "
		     "or the GNU Public License." ), gplPage );

   KTextBrowser *text3 = new KTextBrowser( gplPage );
   text3->setText( "Some more text of unsurpassed tediousness goes here." );
   text3->setWordWrap( TQTextEdit::NoWrap );

   TQString gplFile = locate("data", "LICENSES/GPL_V2");
   if ( !gplFile.isEmpty() ) {
     TQString result;
     TQFile file( gplFile );

     if ( file.open( IO_ReadOnly ) )
     {
        TQTextStream str(&file);
        result += str.read();
     }

     text3->setText( result );
   }
}
Beispiel #9
0
void TDECompletion::extractStringsFromNodeCI( const TDECompTreeNode *node,
                                            const TQString& beginning,
                                            const TQString& restString,
                                            TDECompletionMatchesWrapper *matches ) const
{
    if ( restString.isEmpty() ) {
        extractStringsFromNode( node, beginning, matches, false /*noweight*/ );
        return;
    }

    TQChar ch1 = restString.at(0);
    TQString newRest = restString.mid(1);
    TDECompTreeNode *child1, *child2;

    child1 = node->find( ch1 ); // the correct match
    if ( child1 )
        extractStringsFromNodeCI( child1, beginning + *child1, newRest,
                                  matches );

    // append the case insensitive matches, if available
    if ( ch1.isLetter() ) {
        // find out if we have to lower or upper it. Is there a better way?
        TQChar ch2 = ch1.lower();
        if ( ch1 == ch2 )
            ch2 = ch1.upper();
        if ( ch1 != ch2 ) {
            child2 = node->find( ch2 );
            if ( child2 )
                extractStringsFromNodeCI( child2, beginning + *child2, newRest,
                                          matches );
        }
    }
}
Beispiel #10
0
TQString KStringHandler::rPixelSqueeze(const TQString& name, const TQFontMetrics& fontMetrics, uint maxPixels)
{
  uint nameWidth = fontMetrics.width(name);

  if (maxPixels < nameWidth)
  {
    TQString tmp = name;
    const uint em = fontMetrics.maxWidth();
    maxPixels -= fontMetrics.width("...");

    while (maxPixels < nameWidth && !tmp.isEmpty())
    {
      int length = tmp.length();
      int delta = em ? (nameWidth - maxPixels) / em : length;
      delta = kClamp(delta, 1, length) ;

      tmp.remove(length - delta, delta);
      nameWidth = fontMetrics.width(tmp);
    }

    return (tmp + "...");
  }

  return name;
}
Beispiel #11
0
TQString KStringHandler::word( const TQString &text , const char *range )
{
    // Format in: START:END
    // Note index starts a 0 (zero)
    //
    // 0:        first word to end
    // 1:3        second to fourth words
    TQStringList list = TQStringList::split( " ", text , true );
    TQString tmp = "";
    TQString r = range;

    if ( text.isEmpty() )
        return tmp;

    uint pos = 0, cnt = list.count();
    parsePythonRange( range, pos, cnt );

    //
    // Extract words
    //
    int wordsToExtract = cnt-pos+1;
    TQStringList::Iterator it = list.at( pos);

    while ( (it != list.end()) && (wordsToExtract-- > 0))
    {
       tmp += *it;
       tmp += " ";
       it++;
    }

    return tmp.stripWhiteSpace();
}
Beispiel #12
0
void CupsdNetworkPage::slotEdit(int index)
{
	TQString s = listen_->text(index);
	s = PortDialog::editListen(s, this, conf_);
	if (!s.isEmpty())
		listen_->setText(index, s);
}
Beispiel #13
0
TQString KStringHandler::remrange( const TQString &text , const char *range )
{
    // Format in: START:END
    // Note index starts a 0 (zero)
    //
    // 0:        first word to end
    // 1:3        second to fourth words
    TQStringList list = TQStringList::split( " ", text , true );
    TQString tmp = "";
    TQString r = range;

    if ( text.isEmpty() )
        return tmp;

    uint pos = 0, cnt = list.count();
    parsePythonRange( range, pos, cnt );

    //
    // Remove that range of words
    //
    int wordsToDelete = cnt-pos+1;
    TQStringList::Iterator it = list.at( pos);

    while ( (it != list.end()) && (wordsToDelete-- > 0))
       it = list.remove( it );

    return list.join( " " );
}
Beispiel #14
0
void HostConfig::writeIfNotEmpty( TDEConfigBase &config, const TQString &name, const TQString &value )
{
    if ( value.isEmpty() )
        return;

    config.writeEntry( name, value );
}
Beispiel #15
0
bool ClickArea::click( TQMouseEvent *e )
{
    if( rect.contains( e->x(), e->y() ) )
    {
        //tqDebug(TQString::number(e->type()));
	//KShellProcess ksp;
        if( e->button() != Qt::LeftButton )
			return false;
	if (!svc_name.isEmpty())
	{
		KService sv(svc_name, svc_onClick, svc_icon);
		KURL::List l;
		KRun::run(sv, l);
		return false;
	}
	else
	{
		TQString program;
		program = onClick;
		program.replace( TQRegExp("%v", false), value );

		if( !program.isEmpty() )
		{
			//tqDebug(program);
			KRun::runCommand(program);
		}
	}
    }
    return false;
}
Beispiel #16
0
// antlarr: KDE 4: Make it const TQString &
KShred::KShred(TQString fileName)
{
  if (fileName.isEmpty())
  {
    kdError() << "KShred: missing file name in constructor" << endl;
    file = 0L;
  }
  else
  {
    file = new TQFile();
    file->setName(fileName);
    if (!file->open(IO_ReadWrite))
    {
      kdError() << "KShred: cannot open file '" << fileName.local8Bit().data() << "' for writing\n" << endl;
      file = 0L;
      fileSize = 0;
    }
    else
      fileSize = file->size();

    totalBytes    = 0;
    bytesWritten  = 0;
    lastSignalled = 0;
    tbpc          = 0;
    fspc          = 0;
  }
}
Beispiel #17
0
bool KSSLD::cacheAddHost(KSSLCertificate cert, TQString host) {
KSSLCNode *node;

	if (host.isEmpty())
		return true;

	for (node = certList.first(); node; node = certList.next()) {
		if (cert == *(node->cert)) {
			if (!node->permanent && node->expires <
				       	TQDateTime::currentDateTime()) {
				certList.remove(node);
				cfg->deleteGroup(node->cert->getMD5Digest());
				searchRemoveCert(node->cert);
				delete node;
				cacheSaveToDisk();
				return false;
			}

			if (!node->hosts.contains(host)) {
				node->hosts << host;
			}

			certList.remove(node);
			certList.prepend(node);
			cacheSaveToDisk();
			return true;
		}
	}

return false;
}
Beispiel #18
0
void HTMLScriptElementImpl::insertedIntoDocument()
{
    HTMLElementImpl::insertedIntoDocument();

    assert(!m_cachedScript);

    if (m_createdByParser)
        return;

    TQString url = getAttribute(ATTR_SRC).string();
    if (!url.isEmpty()) {
        TQString charset = getAttribute(ATTR_CHARSET).string();
        m_cachedScript = getDocument()->docLoader()->requestScript(DOMString(url), charset);
        if (m_cachedScript)
            m_cachedScript->ref(this);
        return;
    }

    // If there's an empty script node, we shouldn't evaluate the script
    // because if a script is inserted afterwards (by setting text or innerText)
    // it should be evaluated, and evaluateScript only evaluates a script once.
    DOMString scriptString = text();
    if (!scriptString.isEmpty())
        evaluateScript(getDocument()->URL().url(), scriptString);
}
Beispiel #19
0
void AddresseeDialog::addCompletionItem( const TQString &str, TQListViewItem *item )
{
  if ( str.isEmpty() ) return;

  mItemDict.insert( str, item );
  mAddresseeEdit->completionObject()->addItem( str );
}
Beispiel #20
0
int TrashImpl::findTrashDirectory( const TQString& origPath )
{
    kdDebug() << k_funcinfo << origPath << endl;
    // First check if same device as $HOME, then we use the home trash right away.
    KDE_struct_stat buff;
    if ( KDE_lstat( TQFile::encodeName( origPath ), &buff ) == 0
         && buff.st_dev == m_homeDevice )
        return 0;

    TQString mountPoint = TDEIO::findPathMountPoint( origPath );
    const TQString trashDir = trashForMountPoint( mountPoint, true );
    kdDebug() << "mountPoint=" << mountPoint << " trashDir=" << trashDir << endl;
    if ( trashDir.isEmpty() )
        return 0; // no trash available on partition
    int id = idForTrashDirectory( trashDir );
    if ( id > -1 ) {
        kdDebug() << " known with id " << id << endl;
        return id;
    }
    // new trash dir found, register it
    // but we need stability in the trash IDs, so that restoring or asking
    // for properties works even tdeio_trash gets killed because idle.
#if 0
    kdDebug() << k_funcinfo << "found " << trashDir << endl;
    m_trashDirectories.insert( ++m_lastId, trashDir );
    if ( !mountPoint.endsWith( "/" ) )
        mountPoint += '/';
    m_topDirectories.insert( m_lastId, mountPoint );
    return m_lastId;
#endif
    scanTrashDirectories();
    return idForTrashDirectory( trashDir );
}
Beispiel #21
0
void KMMainView::slotToolSelected(int ID)
{
	KMTimer::self()->hold();

	TQString	libname = m_toollist[ID];
	libname.prepend("tdeprint_tool_");
	if (m_current && !m_current->device().isEmpty() && !libname.isEmpty())
	{
		KLibFactory	*factory = KLibLoader::self()->factory(libname.local8Bit());
		if (factory)
		{
			TQStringList	args;
			args << m_current->device() << m_current->printerName();
			KDialogBase	*dlg = static_cast<KDialogBase*>(TQT_TQWIDGET(factory->create(TQT_TQOBJECT(this), "Tool", 0, args)));
			if (dlg)
				dlg->exec();
			delete dlg;
		}
	}
	else
		KMessageBox::error(this,
			i18n("Unable to start printer tool. Possible reasons are: "
			     "no printer selected, the selected printer doesn't have "
			     "any local device defined (printer port), or the tool library "
			     "could not be found."));

	KMTimer::self()->release();
}
Beispiel #22
0
void TDECompletion::addItem( const TQString& item, uint weight )
{
    if ( item.isEmpty() )
        return;

    TDECompTreeNode *node = myTreeRoot;
    uint len = item.length();

    bool sorted = (myOrder == Sorted);
    bool weighted = ((myOrder == Weighted) && weight > 1);

    // knowing the weight of an item, we simply add this weight to all of its
    // nodes.

    for ( uint i = 0; i < len; i++ ) {
        node = node->insert( item.at(i), sorted );
        if ( weighted )
            node->confirm( weight -1 ); // node->insert() sets weighting to 1
    }

    // add 0x0-item as delimiter with evtl. weight
    node = node->insert( 0x0, true );
    if ( weighted )
        node->confirm( weight -1 );
//     tqDebug("*** added: %s (%i)", item.latin1(), node->weight());
}
Beispiel #23
0
void KPImagePage::getOptions(TQMap<TQString,TQString>& opts, bool incldef)
{
	if (incldef || m_brightness->value() != 100)
		opts["brightness"] = TQString::number(m_brightness->value());
	if (m_hue->isEnabled())
	{
		if (incldef || m_hue->value() != 0)
			opts["hue"] = TQString::number(m_hue->value());
		if (incldef || m_saturation->value() != 100)
			opts["saturation"] = TQString::number(m_saturation->value());
	}
	if (incldef || m_gamma->value() != 1000)
		opts["gamma"] = TQString::number(m_gamma->value());

	TQString	name;
	if (incldef)
	{
		opts["ppi"] = "0";
		opts["scaling"] = "0";
		opts["natural-scaling"] = "1";
	}
	switch (m_sizetype->currentItem())
	{
		case 0: break;
		case 1: name = "ppi"; break;
		case 2: name = "scaling"; break;
		case 3: name = "natural-scaling"; break;
	}
	if (!name.isEmpty())
		opts[name] = TQString::number(m_size->value());

	if (incldef || m_position->position() != ImagePosition::Center)
		opts["position"] = m_position->positionString();
}
Beispiel #24
0
void TrashImpl::scanTrashDirectories() const
{
    const KMountPoint::List lst = KMountPoint::currentMountPoints();
    for ( KMountPoint::List::ConstIterator it = lst.begin() ; it != lst.end() ; ++it ) {
        const TQCString str = (*it)->mountType().latin1();
        // Skip pseudo-filesystems, there's no chance we'll find a .Trash on them :)
        // ## Maybe we should also skip readonly filesystems
        if ( str != "proc" && str != "devfs" && str != "usbdevfs" &&
             str != "sysfs" && str != "devpts" && str != "subfs" /* #96259 */ &&
             str != "autofs" /* #101116 */ ) {
            TQString topdir = (*it)->mountPoint();
            TQString trashDir = trashForMountPoint( topdir, false );
            if ( !trashDir.isEmpty() ) {
                // OK, trashDir is a valid trash directory. Ensure it's registered.
                int trashId = idForTrashDirectory( trashDir );
                if ( trashId == -1 ) {
                    // new trash dir found, register it
                    m_trashDirectories.insert( ++m_lastId, trashDir );
                    kdDebug() << k_funcinfo << "found " << trashDir << " gave it id " << m_lastId << endl;
                    if ( !topdir.endsWith( "/" ) )
                        topdir += '/';
                    m_topDirectories.insert( m_lastId, topdir );
                }
            }
        }
    }
    m_trashDirectoriesScanned = true;
}
Beispiel #25
0
// show but don't set into selColor, nor emit colorSelected
void KColorDialog::showColor( const KColor &color, const TQString &name )
{
  d->bRecursion = true;

  if (name.isEmpty())
     d->colorName->setText( i18n("-unnamed-"));
  else
     d->colorName->setText( name );

  d->patch->setColor( color );

  setRgbEdit( color );
  setHsvEdit( color );
  setHtmlEdit( color );

  int h, s, v;
  color.hsv( &h, &s, &v );
  d->hsSelector->setValues( h, s );
  d->valuePal->blockSignals(true);
  d->valuePal->setHue( h );
  d->valuePal->setSaturation( s );
  d->valuePal->setValue( v );
  d->valuePal->updateContents();
  d->valuePal->blockSignals(false);
  d->valuePal->repaint( false );
  d->bRecursion = false;
}
Beispiel #26
0
void KgpgView::updatetxt(TQString newtxt)
{
        if (!newtxt.isEmpty())
                editor->setText(newtxt);
        else
                KMessageBox::sorry(this,i18n("Encryption failed."));
}
Beispiel #27
0
void KMdiDockContainer::save( TDEConfig* cfg, const TQString& group_or_prefix )
{
	TQString grp = cfg->group();
	cfg->deleteGroup( group_or_prefix + TQString( "::%1" ).arg( parent() ->name() ) );
	cfg->setGroup( group_or_prefix + TQString( "::%1" ).arg( parent() ->name() ) );

	if ( isOverlapMode() )
		cfg->writeEntry( "overlapMode", "true" );
	else
		cfg->writeEntry( "overlapMode", "false" );

	// try to save the splitter position
	if ( parentDockWidget() && parentDockWidget() ->parent() )
	{
		KDockSplitter * sp = ::tqqt_cast<KDockSplitter*>( parentDockWidget() -> parent() );
		if ( sp )
			cfg->writeEntry( "separatorPosition", m_separatorPos );
	}

	TQPtrList<KMultiTabBarTab>* tl = m_tb->tabs();
	TQPtrListIterator<KMultiTabBarTab> it( *tl );
	TQStringList::Iterator it2 = itemNames.begin();
	int i = 0;
	for ( ;it.current() != 0;++it, ++it2 )
	{
		//    cfg->writeEntry(TQString("widget%1").arg(i),m_ws->widget(it.current()->id())->name());
		cfg->writeEntry( TQString( "widget%1" ).arg( i ), ( *it2 ) );
		TQString s = tabCaptions[ *it2 ];
		if ( !s.isEmpty() )
		{
			cfg->writeEntry( TQString( "widget%1-tabCaption" ).arg( i ), s );
		}
		s = tabTooltips[ *it2 ];
		if ( !s.isEmpty() )
		{
			cfg->writeEntry( TQString( "widget%1-tabTooltip" ).arg( i ), s );
		}
		//    kdDebug(760)<<"****************************************Saving: "<<m_ws->widget(it.current()->id())->name()<<endl;
		if ( m_tb->isTabRaised( it.current() ->id() ) )
			cfg->writeEntry( m_ws->widget( it.current() ->id() ) ->name(), true );
		++i;
	}
	cfg->sync();
	cfg->setGroup( grp );

}
Beispiel #28
0
void KonqSideBarWebModule::loadFavicon() {
	TQString icon = KonqPixmapProvider::iconForURL(_url.url());
	if (icon.isEmpty()) {
		KonqFavIconMgr::downloadHostIcon(_url);
		icon = KonqPixmapProvider::iconForURL(_url.url());
	}

	if (!icon.isEmpty()) {
		emit setIcon(icon);

		KSimpleConfig ksc(_desktopName);
		ksc.setGroup("Desktop Entry");
		if (icon != ksc.readPathEntry("Icon")) {
			ksc.writePathEntry("Icon", icon);
		}
	}
}
Beispiel #29
0
void KgpgApp::slotFilePreDec()
{

        KURL url=KFileDialog::getOpenURL(TQString(),
                                         i18n("*|All Files"), this, i18n("Open File to Decode"));

        if (url.isEmpty())
                return;
        TQString oldname=url.fileName();

        TQString newname;

        if (oldname.endsWith(".gpg") || oldname.endsWith(".asc") || oldname.endsWith(".pgp"))
                oldname.truncate(oldname.length()-4);
        else
                oldname.append(".clear");
        oldname.prepend(url.directory(0,0));

	KDialogBase *popn=new KDialogBase( KDialogBase::Swallow, i18n("Decrypt File To"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, this, "file_decrypt",true);

	SrcSelect *page=new SrcSelect();
	popn->setMainWidget(page);
	page->newFilename->setURL(oldname);
	page->newFilename->setMode(KFile::File);
	page->newFilename->setCaption(i18n("Save File"));

	page->checkClipboard->setText(i18n("Editor"));
	page->resize(page->minimumSize());
	popn->resize(popn->minimumSize());
        if (popn->exec()==TQDialog::Accepted) {
                if (page->checkFile->isChecked())
                        newname=page->newFilename->url();
        } else {
                delete popn;
                return;
        }
        delete popn;


        if (!newname.isEmpty()) {
                TQFile fgpg(newname);
                if (fgpg.exists()) {
			TDEIO::RenameDlg *over=new TDEIO::RenameDlg(0,i18n("File Already Exists"),TQString(),newname,TDEIO::M_OVERWRITE);
		    	if (over->exec()==TQDialog::Rejected)
	    		{
                	delete over;
                	return;
            		}
	    		newname=over->newDestURL().path();
	    		delete over;
                }
                KgpgLibrary *lib=new KgpgLibrary(this);
                lib->slotFileDec(url,KURL(newname), customDecrypt);
		connect(lib,TQT_SIGNAL(importOver(TQStringList)),this,TQT_SIGNAL(refreshImported(TQStringList)));
        } else
                openEncryptedDocumentFile(url);
}
Beispiel #30
0
void BackgroundEngine::changeLanguage( const TQString& lang )
{
    delete m_dict;
    if ( lang.isEmpty() ) {
        m_dict = 0;
    } else {
        m_dict = m_broker->dictionary( lang );
    }
}