[Konversation-devel] Review Request: command completion

Antonio Gattoo kdejkffdwitnas at mail.ru
Thu Aug 27 00:46:52 CEST 2009



> On 2009-08-26 08:02:45, Eike Hein wrote:
> > Hmm, well, yes, the obvious first thing to do here is to get rid of the code duplication and put that code somewhere common.
> > 
> > It also just so happens that there has already been someone else working on command completion (and I implemented OutputFilter::getCommandList() recently to aid that effort). Please get in touch with him, perhaps you can work together: develop AT fuchsnet DOT ch

Just to write down thoughts. I think it would be good to:

Classes Channel, Query, StatusPanel are inherited from ChatWindow:
	Channel::Channel(QWidget* parent, QString _name) : ChatWindow(parent)
	Query::Query(QWidget* parent, QString _name) : ChatWindow(parent)
	StatusPanel::StatusPanel(QWidget* parent) : ChatWindow(parent)

So it seems to be ok writing smth like
	IRCInput* Channel::getInput() //same for Query:: and StatusPanel::, will be called virtually

	void Server::tabCompletion(const ChatWindow* tab)
	{
		...
		QStringList commandList = getOutputFilter()->getCommandList();
		QStringList channelList = getRecentChannels(); //list initialized in Server::'s constructor from ServerName.RecentChannels.txt
		QStringList nicknameList;

		ChatWindow::WindowType viewType = tab->getType();
	        if(viewType == ChatWindow::Channel) {
			nicknameList = tab->getSimplifiedNickList(); //converts NickList to QStringList
	        }
		
		QString line = tab->getInput().toPlainText(); //virtual call via ChatWindow*

		//parse line, decide what kind of completion we need
		//btw why do we need nick completion in Query tab?
		...

		QStringList completionList = commandList; //or channelList, or nicknameList - parsing line will let us know

		CompletionAsSuch(tab, completionList); 
		//tab is a parameter, cuz we will need a tab's completionPosition variable
		//we also will need Channel::/Query::/StatusPanel::set/getCompletionPosition()
		//virtual call via ChatWindow*

		...
	}

It's just a draft. Need a discussion.

May be we will need not only completionList, but a QMap. 
I mean some commands are used more often (i'm not common to konversation usage) and in case we want to store ServerName.RecentChannels.txt, i can easely make a mistake typing "/join #kopet" instead of "kopete".
So channel name "kopet" will be in the channelList and may bother me every completion. Incrementing ChannelCount every connection will help us to complete with proper channel name. And so on


- Antonio


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/1399/#review2151
-----------------------------------------------------------


On 2009-08-25 17:37:51, Antonio Gattoo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/1399/
> -----------------------------------------------------------
> 
> (Updated 2009-08-25 17:37:51)
> 
> 
> Review request for konversation.
> 
> 
> Summary
> -------
> 
> it works like nick completion: you type /jo[tab], you get /join. and so on
> works good only with 'cycle' mode, others have troubles
> 
> not sure about realization. actually i repeat the same code three times (need help here)
> 
> 
> This addresses bug 121420.
>     https://bugs.kde.org/show_bug.cgi?id=121420
> 
> 
> Diffs
> -----
> 
>   /trunk/extragear/network/konversation/src/irc/channel.h 1015494 
>   /trunk/extragear/network/konversation/src/irc/channel.cpp 1015494 
>   /trunk/extragear/network/konversation/src/irc/outputfilter.h 1015494 
>   /trunk/extragear/network/konversation/src/irc/outputfilter.cpp 1015494 
>   /trunk/extragear/network/konversation/src/irc/query.h 1015494 
>   /trunk/extragear/network/konversation/src/irc/query.cpp 1015494 
>   /trunk/extragear/network/konversation/src/viewer/ircinput.h 1015494 
>   /trunk/extragear/network/konversation/src/viewer/ircinput.cpp 1015494 
>   /trunk/extragear/network/konversation/src/viewer/statuspanel.h 1015494 
>   /trunk/extragear/network/konversation/src/viewer/statuspanel.cpp 1015494 
> 
> Diff: http://reviewboard.kde.org/r/1399/diff
> 
> 
> Testing
> -------
> 
> it works in server tab and channel tab (one per time), but not in query. need help here
> 
> 
> Thanks,
> 
> Antonio
> 
>



More information about the Konversation-devel mailing list