Click here to Skip to main content
13,253,212 members (50,808 online)
Click here to Skip to main content

Stats

250.2K views
1.1K downloads
32 bookmarked
Posted 25 Jun 2007

RSS Reader Plug-in for Internet Explorer

, 17 Jul 2007
This is a toolbar for the Internet Explorer which shows information from RSS taken from the Internet.
Setup.exe
RssReader_src
RRPRssFetcher
RRPRssFetcher
res
RRPRssFetcher.ico
toolbar.bmp
RRPRssFetcher.vcproj.TEKAWADE.Prafulla V Tekawade.user
RSSReaderplugin
Debug
res
RssReaderPlugin.dll.manifest
RRPComInterfaceImplementor.rgs
RssReaderPlugin.aps
RssReaderPlugin.def
RssReaderPlugin.dsp
RssReaderPlugin.dsw
RssReaderPlugin.opt
RssReaderPlugin.plg
RssReaderPlugin.tlb
RssReaderPlugin.vcproj.TEKAWADE.Prafulla V Tekawade.user
RssReaderPluginps.def
RssReaderPluginps.mk
Setup.iss
/*
	Project		: RSS Reader plugin for Internet Explorer
	File Name	: RRPConfigurationDialog.cpp
	Date		: 
	Purpose		: It contains the code for the settings dialog box which is used to change 
				  the settings of the rss reader
	Note		: 
	Send comments 
	or Bugs to	: prafulla_t@users.sourceforge.net
*/
#include "stdafx.h"
#include "RRPConfigurationDialog.h"
#include <string>



LRESULT RRPConfigurationDialog::OnCbnSelchangeNewsCombo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
	int currentSelection = newsCombo.GetCurSel();
	if(addNewsButtonIndex != currentSelection) {
		char *aText = comboEntries[currentSelection];
		NewsButtonInfo *newsButton = NULL;
		UINT n = configManager->getSize();
		for(UINT i = 0;i<n;i++) { 
			newsButton = configManager->getItem(i);
			if(newsButton)
				if(strcmp(newsButton->title,aText) == 0)
					break;
		}
		if(newsButton) {
			SetDlgItemText(IDC_TITLE,newsButton->title);
			SetDlgItemText(IDC_LINK,newsButton->link);
			return 0;
		}
	}
	SetDlgItemText(IDC_TITLE,"Enter title!");
	SetDlgItemText(IDC_LINK,"Enter link!");
	CEdit edit = GetDlgItem(IDC_TITLE);
	edit.SetFocus();
	return 0;
}

LRESULT RRPConfigurationDialog::OnEnSetfocusTitle(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
	return 0;
}

LRESULT RRPConfigurationDialog::OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
	unsigned int currentSelection = newsCombo.GetCurSel();
	if(currentSelection == addNewsButtonIndex)
		return 0;
	char *aText = comboEntries[currentSelection];
	NewsButtonInfo *newsButton = NULL;
	UINT n = configManager->getSize();
	UINT i = 0;
	for(i = 0;i<n;i++) { 
		newsButton = configManager->getItem(i);
		if(newsButton)
			if(strcmp(newsButton->title,aText) == 0)
				break;
	}
	if(newsButton) {
		//i specifies the index of the button,to be deleted
		configManager->getToolbar()->removeButton(i);
		newsCombo.ResetContent();
		fillComboBox();
		newsCombo.AddString("Add news button!!");
		newsCombo.SetCurSel(0);
		BOOL handled = true;
		OnCbnSelchangeNewsCombo(0,0,0,handled);
	}
	return 0;
}

LRESULT RRPConfigurationDialog::OnSave(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
	char *title = new char[100];
	char *link = new char[100];
	int tFlag = 0,lFlag = 0;
	GetDlgItemText(IDC_TITLE,title,100);
	GetDlgItemText(IDC_LINK,link,100);
	int currentSelection = newsCombo.GetCurSel();
	NewsButtonInfo *newsButton = configManager->getItem(currentSelection);
	int validFlag = 0;
	if(strcmp(title,"Enter title!") == 0)
		tFlag = 1;
	if(strcmp(link,"Enter link!") == 0)
		lFlag = 1;
	if(strcmp(title,"") == 0)
		tFlag = 1;
	if(strcmp(link,"") == 0)
		lFlag = 1;
	if(checkHyperLink(link) == 0) 
		validFlag = 1;
	if(tFlag && lFlag) 
		MessageBox("Enter title and link of RSS for the new Button!","Error",MB_ICONERROR);
	else if(tFlag)
			MessageBox("Enter title for the new Button!","Error",MB_ICONERROR);
		else if(lFlag && !validFlag)
				MessageBox("Enter link of RSS for the new Button!","Error",MB_ICONERROR);
	if(validFlag)
		MessageBox("Enter valid link of RSS for the new Button!","Error",MB_ICONERROR);
	if(currentSelection == addNewsButtonIndex) {
/*
	int validFlag = 0;
	if(strcmp(title,"Enter title!") == 0)
		tFlag = 1;
	if(strcmp(link,"Enter link!") == 0)
		lFlag = 1;
	if(strcmp(title,"") == 0)
		tFlag = 1;
	if(strcmp(link,"") == 0)
		lFlag = 1;
	if(checkHyperLink(link) == 0) 
		validFlag = 1;
	if(tFlag && lFlag) 
		MessageBox("Enter title and link of RSS for the new Button!","Error",MB_ICONERROR);
	else if(tFlag)
			MessageBox("Enter title for the new Button!","Error",MB_ICONERROR);
		else if(lFlag && !validFlag)
				MessageBox("Enter link of RSS for the new Button!","Error",MB_ICONERROR);
	if(validFlag)
		MessageBox("Enter valid link of RSS for the new Button!","Error",MB_ICONERROR);*/
		if(tFlag == 0 && lFlag == 0 && validFlag == 0)
			configManager->addNews(title,link);
	}
	else {
		configManager->modifyNews(currentSelection,title,link);
	}
	//Reset everything
	newsCombo.ResetContent();
	fillComboBox();
	newsCombo.AddString("Add news button!!");
	newsCombo.SetCurSel(0);
	BOOL handled = true;
	OnCbnSelchangeNewsCombo(0,0,0,handled);
	delete title,link;
	return 0;
}

//False if link is invalid
BOOL RRPConfigurationDialog::checkHyperLink(char *link) {
	if(strstr(link,"http://") == link)
		return 1;
	return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

PrafullaT
India India
Quote : "Life is all about solving problems and enjoying their solutions !! "

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 17 Jul 2007
Article Copyright 2007 by PrafullaT
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid